presets: allow presets to end with a comment
This commit is contained in:
parent
58ed82e245
commit
b1a6952020
|
@ -64,7 +64,7 @@ fn multiline_comment(i: Span) -> IResult<Span, Span> {
|
|||
}
|
||||
|
||||
fn single_comment(i: Span) -> IResult<Span, Span> {
|
||||
delimited(alt((tag("//"), tag("#"))), not_line_ending, line_ending)(i)
|
||||
delimited(alt((tag("//"), tag("#"))), not_line_ending, alt((line_ending, eof)))(i)
|
||||
}
|
||||
|
||||
fn whitespace(i: Span) -> IResult<Span, ()> {
|
||||
|
@ -133,6 +133,7 @@ pub fn do_lex(input: &str) -> Result<Vec<Token>, ParsePresetError> {
|
|||
let (_, tokens) = parse_tokens(span).map_err(|e| match e {
|
||||
nom::Err::Error(e) | nom::Err::Failure(e) => {
|
||||
let input: Span = e.input;
|
||||
println!("{:?}", input);
|
||||
ParsePresetError::LexerError {
|
||||
offset: input.location_offset(),
|
||||
row: input.location_line(),
|
||||
|
@ -161,7 +162,7 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn parses_key_value_line() {
|
||||
let parsed = do_lex(TEST);
|
||||
let parsed = do_lex(TEST3);
|
||||
eprintln!("{parsed:#?}")
|
||||
}
|
||||
|
||||
|
@ -594,4 +595,115 @@ gamma_out = 1.95
|
|||
|
||||
// DREZ Parameters
|
||||
SHARPEN = 0"#;
|
||||
|
||||
const TEST3: &str = r#"// DUIMON MEGA BEZEL GRAPHICS AND PRESETS | https://duimon.github.io/Gallery-Guides/ | duimonmb@gmail.com
|
||||
// SOME RIGHTS RESERVED - RELEASED UNDER CC BY NC ND LICENSE https://creativecommons.org/licenses/by-nc-nd/4.0/deed
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// PRESET START
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SHADER :: CONNECTOR | Interface to Mega Bezel Presets folders.
|
||||
// Edit the target file in the following reference to globally define the base preset.
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#reference "../../../zzz_global_params/Base_Shader/ADV_Bezel.slangp"
|
||||
|
||||
// SHADER :: CONNECTOR :: LOCAL OVERRIDES | Interface to specific base presets.
|
||||
// Comment out the top reference line and uncomment the following reference line to locally define the base preset.
|
||||
// Keep in mind that some of the base presets use Integer Scale and may yield unexpected results. (e.g. Megatron)
|
||||
|
||||
//#reference "../../../zzz_global_params/Local_Shader/ADV_06.slangp"
|
||||
|
||||
// "ADV_06" matches the default "MBZ__1__ADV__GDV.slangp".
|
||||
// Replace the "06" with any from the following list.
|
||||
// 01. SMOOTH-ADV__GDV 08. ADV__GDV-MINI-NTSC
|
||||
// 02. SMOOTH-ADV__GDV-NTSC 09. ADV__GDV-NTSC
|
||||
// 03. SMOOTH-ADV__MEGATRON 10. ADV__MEGATRON
|
||||
// 04. SMOOTH-ADV__MEGATRON-NTSC 11. ADV__MEGATRON-NTSC
|
||||
// 05. ADV__EASYMODE 12. ADV-RESHADE-FX__GDV
|
||||
// 06. ADV__GDV 13. ADV-SUPER-XBR__GDV
|
||||
// 07. ADV__GDV-MINI 14. ADV-SUPER-XBR__GDV-NTSC
|
||||
|
||||
// INTRO | Intro animation
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// ON
|
||||
#reference "../../../zzz_global_params/Intro/on.params"
|
||||
// ON - No Image
|
||||
//#reference "../../../zzz_global_params/Intro/on_no_image.params"
|
||||
// ON - Default Mega Bezel intro
|
||||
//#reference "../../../zzz_global_params/Intro/on_default.params"
|
||||
// OFF
|
||||
//#reference "../../../zzz_global_params/Intro/off.params"
|
||||
|
||||
// DEVICE | Screen/Monitor/CRT/TV settings
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// DEVICE :: BASE
|
||||
#reference "../../../res/bezel/Nintendo_GBA/bezel.params"
|
||||
|
||||
// DEVICE :: SCALING
|
||||
#reference "../../../res/scale/Nintendo_GBA/bezel.params"
|
||||
|
||||
// DEVICE :: CRT
|
||||
#reference "../../../res/crt/Nintendo_GBA/bezel.params"
|
||||
|
||||
// IMAGE LAYERS
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
#reference "../../../res/layers/Nintendo_GBA/bezel.params"
|
||||
|
||||
// HSV :: Hue, Saturation, and Value parameters
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GRAPHICS OVERRIDES | Overrides for Image layers, scaling, etc
|
||||
// that are not related to Guest's shader. (Three examples are provided)
|
||||
// These are intended for [Bezel] versions and the following reference should be left commented out for others.
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// GRAPHICS :: OVERRIDES
|
||||
//#reference "../../../res/overrides/batocera.params"
|
||||
//#reference "../../../res/overrides/batocera_nocurve.params"
|
||||
//#reference "../../../res/overrides/batocera_hud.params"
|
||||
|
||||
// GLOBAL GRAPHICS :: OVERRIDES
|
||||
// The user can edit the "user.params" to globally change the presets.
|
||||
// These are for the bezel, frame, and other graphic attributes.
|
||||
// Examples are included in the params file and commented out.
|
||||
// These are also intended for [Bezel] versions and the following reference should be left commented out for others.
|
||||
#reference "../../../zzz_global_params/Graphics/user.params"
|
||||
|
||||
// The following is restricted to the [Custom-Bezel_002] presets.
|
||||
// One example is included in the params file and commented out.
|
||||
//#reference "../../../zzz_global_params/Graphics/user2.params"
|
||||
|
||||
// SHADER OVERRIDES | Place *.params references to Guest derivatives here.
|
||||
// (Make sure you are using ADV__GDV, STD__GDV, or POTATO__GDV base presets for variations on the Guest shader.)
|
||||
// Two examples were kindly provided by guest.r. ;-)
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// SHADER :: OVERRIDES
|
||||
//#reference "../../../res/overrides_shader/guest_custom_aperture.params"
|
||||
//#reference "../../../res/overrides_shader/guest_custom_slotmask.params"
|
||||
|
||||
// GLOBAL SHADER :: OVERRIDES
|
||||
// The user can edit the target params file to globally change the presets.
|
||||
// To use community params that require another base preset, change the global base reference to match.
|
||||
// Examples are included in the params file and commented out.
|
||||
// Separate folders let users change global settings on each of the sets.
|
||||
// These are intentionally commented out for LCD-GRID presets.
|
||||
//#reference "../../../zzz_global_params/Shader/ADV/user_Bezel.params"
|
||||
//#reference "../../../zzz_global_params/Shader/ADV_DREZ/user_Bezel.params"
|
||||
//#reference "../../../zzz_global_params/Shader/STD/user_Bezel.params"
|
||||
//#reference "../../../zzz_global_params/Shader/STD_DREZ/user_Bezel.params"
|
||||
//#reference "../../../zzz_global_params/Shader/LITE/user_Bezel.params"
|
||||
|
||||
// AMBIENT LIGHTING
|
||||
//#reference "../../../res/lighting/night.params"
|
||||
|
||||
// PRESET END
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
"#;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue