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

Multiline string is messing up decoding #12

Open
awvwgk opened this issue Apr 7, 2020 · 1 comment
Open

Multiline string is messing up decoding #12

awvwgk opened this issue Apr 7, 2020 · 1 comment

Comments

@awvwgk
Copy link
Member

awvwgk commented Apr 7, 2020

Another take on strings in HSD, this time to see what happens if I feed in a multiline string:

Valid? = Multiline
String
Invalid? = "Multiline
String"
Invalid! = """Multiline
String"""

Apparently an even number of quotation mark allows me to feed multiple lines to the HSD decoder, which are assumed to be arrays:

{'valid?': 'Multiline', 'invalid?': ['"Multiline', 'String"'], 'invalid!': ['"""Multiline', 'String"""']}

Note that the first key-value pair drops the second line without further notice, but should probably raise a syntax error (all of them actually should).

@awvwgk
Copy link
Member Author

awvwgk commented Apr 7, 2020

Probably related to the missing second line. An minimal input of the kind

parent = {
   "value" "value" "value"
   child = "something else"
}

will deserialize to

{'parent': {'child': '"something else"'}}

and drop all the values already read in (of course we are not allowed to mix values and objects, but then we also expect an appropriate error from the decoder). Going one step further with

parent = {
   "value" "value" "value"
   child = "something else"
   0.0 1.0 2.0
}

will deserialize to

{'parent': [0.0, 1.0, 2.0]}

and therefore drop its previous content twice without error.

Then again, I wonder how the first key-value pair from the initial report actually survived the deserialization.

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

1 participant