Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could you drop also the trailing whitespace of property names? #27

Closed
Mikolaj opened this issue Sep 15, 2023 · 6 comments
Closed

Could you drop also the trailing whitespace of property names? #27

Mikolaj opened this issue Sep 15, 2023 · 6 comments

Comments

@Mikolaj
Copy link
Contributor

Mikolaj commented Sep 15, 2023

Regarding

Drop leading whitespace when reading property name

I have an issue, where

movementViKeys_hjklyubn = True

is parsed as

( "movementViKeys_hjklyubn " , "True" )

(note the trailing whitespace) breaking the lookup later on. Do you think we could drop also the trailing whitespace of property names?

@Mikolaj
Copy link
Contributor Author

Mikolaj commented Sep 26, 2023

@magthe: humble ping?

@magthe
Copy link
Owner

magthe commented Sep 26, 2023

If you look at the test that was updated as part of the change you linked to, this should already happen. (There are both leading and trailing whitespace to the left of the equal sign.) So, exactly what kind of whitespace is it that gets left in?

@Mikolaj
Copy link
Contributor Author

Mikolaj commented Sep 26, 2023

Yes, you are right, but there are also the \t characters in the test --- perhaps they make a difference? I may be totally wrong regarding which change cause my problem, but they appeared rather recently.

My test cases is movementViKeys_hjklyubn = True that gets parsed to ( "movementViKeys_hjklyubn " , "True" ), notice the trailing space after movementViKeys_hjklyubn. The whole Ini.Config I'm getting after the parse is

fromList
    [ ( "additional_commands"
      , fromList
          [ ( "Cmd_2 "
            , "(\"KP_Insert\", ([CmdAim], \"\", ByAimMode AimModeCmd {exploration = Dashboard, aiming = Accept}))"
            )
          ]
      )
    , ( "fonts"
      , fromList
          [ ( "16x16xwBitmap " , "FontMapBitmap \"16x16xw.bdf\" 0" )
          , ( "16x16xwScalable "
            , "FontMapScalable \"16x16xw.woff\" 16 HintingHeavy 0"
            )
          , ( "8x8xBitmap " , "FontMapBitmap \"8x8x.fnt\" 2" )
          , ( "8x8xbBitmap " , "FontMapBitmap \"8x8xb.fnt\" 2" )
          , ( "binaryBold "
            , "FontProportional \"BinarySansProLH-Semibold.ttf.woff\" 16 HintingHeavy"
            )
          , ( "binaryMono "
            , "FontMonospace \"BinaryCodeProLH-Bold.ttf.woff\" 14 HintingHeavy"
            )
          , ( "binaryRegular "
            , "FontProportional \"BinarySansProLH-Regular.ttf.woff\" 16 HintingHeavy"
            )
          , ( "dejavuBold "
            , "FontProportional \"DejaVuLGCSans-Bold.ttf.woff\" 13 HintingHeavy"
            )
          , ( "dejavuMono "
            , "FontMonospace \"Hack-Bold.ttf.woff\" 13 HintingHeavy"
            )
          , ( "dejavuRegular "
            , "FontProportional \"DejaVuLGCSans.ttf.woff\" 15 HintingHeavy"
            )
          ]
      )
    , ( "fontsets"
      , fromList
          [ ( "16x16xw "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"\", fontPropBold = \"\", fontMono = \"\"}"
            )
          , ( "8x8x "
            , "FontSet {fontMapScalable = \"\", fontMapBitmap = \"8x8xBitmap\", fontPropRegular = \"\", fontPropBold = \"\", fontMono = \"\"}"
            )
          , ( "8x8xb "
            , "FontSet {fontMapScalable = \"\", fontMapBitmap = \"8x8xbBitmap\", fontPropRegular = \"\", fontPropBold = \"\", fontMono = \"\"}"
            )
          , ( "binary "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"binaryRegular\", fontPropBold = \"binaryBold\", fontMono = \"binaryMono\"}"
            )
          , ( "binaryBold "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"binaryBold\", fontPropBold = \"binaryBold\", fontMono = \"binaryMono\"}"
            )
          , ( "binaryMono "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"binaryMono\", fontPropBold = \"binaryMono\", fontMono = \"binaryMono\"}"
            )
          , ( "dejavu "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"dejavuRegular\", fontPropBold = \"dejavuBold\", fontMono = \"dejavuMono\"}"
            )
          , ( "dejavuBold "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwScalable\", fontPropRegular = \"dejavuBold\", fontPropBold = \"dejavuBold\", fontMono = \"dejavuMono\"}"
            )
          , ( "dejavuBold_original "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"dejavuBold\", fontPropBold = \"dejavuBold\", fontMono = \"dejavuMono\"}"
            )
          , ( "dejavuMono "
            , "FontSet {fontMapScalable = \"16x16xwScalable\", fontMapBitmap = \"16x16xwBitmap\", fontPropRegular = \"dejavuMono\", fontPropBold = \"dejavuMono\", fontMono = \"dejavuMono\"}"
            )
          ]
      )
    , ( "hero_names"
      , fromList
          [ ( "HeroName_0 " , "(\"Haskell Alvin\", \"he\")" )
          , ( "HeroName_1 " , "(\"Alonzo Barkley\", \"he\")" )
          , ( "HeroName_2 " , "(\"In\233s Galenti\", \"she\")" )
          , ( "HeroName_3 " , "(\"Ernst Abraham\", \"he\")" )
          , ( "HeroName_4 " , "(\"Samuel Saunders\", \"he\")" )
          , ( "HeroName_5 " , "(\"Roger Robin\", \"he\")" )
          , ( "HeroName_6 " , "(\"Christopher Flatt\", \"he\")" )
          , ( "HeroName_7 " , "(\"Simon Wise\", \"he\")" )
          , ( "HeroName_8 " , "(\"Daniel Homer\", \"he\")" )
          , ( "HeroName_9 " , "(\"Oleg Cracker\", \"he\")" )
          ]
      )
    , ( "ui"
      , fromList
          [ ( "allFontsScale " , "1.0" )
          , ( "chosenFontset " , "\"dejavuBold\"" )
          , ( "fullscreenMode " , "NotFullscreen" )
          , ( "historyMax " , "5000" )
          , ( "hpWarningPercent " , "20" )
          , ( "maxFps " , "24" )
          , ( "movementLeftHandKeys_axwdqezc " , "True" )
          , ( "movementViKeys_hjklyubn " , "True" )
          , ( "msgWrapColumn " , "80" )
          , ( "noAnim " , "False" )
          , ( "overrideCmdline " , "\"\"" )
          ]
      )
    , ( "version" , fromList [ ( "version " , "0.11.0" ) ] )
    ]

parsed from this source:

https://github.com/LambdaHack/LambdaHack/blob/master/GameDefinition/config.ui.default

@Mikolaj
Copy link
Contributor Author

Mikolaj commented Sep 26, 2023

The spaces in my config are not any fancy Unicode characters, but normal ASCII spaces, I've just checked.

@magthe magthe closed this as completed in 5c68ab8 Sep 26, 2023
@magthe
Copy link
Owner

magthe commented Sep 26, 2023

Let me know if 0.5.2.2 doesn't solve this for you.

@Mikolaj
Copy link
Contributor Author

Mikolaj commented Sep 26, 2023

It works perfectly. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants