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

Multi-line values are created when they shouldn't be #4

Closed
minikomi opened this issue Mar 12, 2015 · 3 comments
Closed

Multi-line values are created when they shouldn't be #4

minikomi opened this issue Mar 12, 2015 · 3 comments

Comments

@minikomi
Copy link
Contributor

I'm not sure what the expected result is but this seems a little odd:

key:value
multi-line-value
[singleword]
another multi line value
:end

Output:

{
  "key": "valueanother multi line value",
  "yeah": []
}

multi-line-value has disappeared, and there's also no newlines in the output.

When there is a multi-word value within the square brackets, it is treated as a comment and we get:

key:value
multi-line-value
[double word]
another multi line value
:end

{
  "key": "value\nmulti-line-value\n\nanother multi line value"
}

Which seems more consistent with the other rules.

@minikomi
Copy link
Contributor Author

Another strange edge case:

key:value
multi-line-value
[singleword]
newkey:yeah
[]
another multi line value
:end

Result:

{
  "key": "value",
  "singleword": [
    {
      "newkey": "yeah"
    }
  ],
  "newkey": "undefinedanother multi line value"
}

@minikomi
Copy link
Contributor Author

Also seems to be related:

{scope}
key:value
{}
value2
:end

result:

{
  "scope": {
    "key": "value"
  },
  "key": "undefinedvalue2"
}

@abstrctn
Copy link
Contributor

Hey @minikomi - thanks for all of the examples, these were all bugs in the way archieml-js was handling multi-line values. We can continue the discussion here if there are any questions / concerns about the behavior in any specific circumstances, but the way we intended it to work was:

Start any value with either a key: value, or with an asterisk in the case of a simple array * value). The value as defined on that line is always included as the value. Sequential lines are added to the value only if those lines 1) do not contain any lines that would be interpreted as commands (i.e., {}), and are followed with an :end line.

All of the examples above broke because the javascript parser was trying to add the lines immediately preceding :end to the last key that was defined, even though there was a command line in the middle of the value that should have prevented it from being interpreted as a multi-line value.

I'm uploading a patch now that will cause key in most of your examples to wind up as a single-line value, value.

@abstrctn abstrctn changed the title Square bracket, single words within multi-line strings create new empty arrays Multi-line values are created when they shouldn't be Mar 16, 2015
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