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

Spec may incorrectly limit multiline escaping #26

Open
partlyhuman opened this issue Oct 7, 2015 · 1 comment
Open

Spec may incorrectly limit multiline escaping #26

partlyhuman opened this issue Oct 7, 2015 · 1 comment

Comments

@partlyhuman
Copy link

Hi there, I'm in the middle of implementing an ArchieML parser for C# from the ground up, using your tests and spec as my guide. I may have run into a contradiction regarding escaping of backslashes in multiline values. On one hand, the spec states:

To avoid as much processing as possible, leading backslashes should be removed only when the backslash is the first character of a line (but not a value's first line), and when the second character is any of the following: {, [, *, : or .

On the other hand, test multi_line.17.aml would fail if this were done. It asserts that a key-value line like \key:value should have its leading backslash stripped, but the spec wouldn't strip this since the second character is 'k'.

I'm going by the tests for now over the spec, and stripping initial backslashes from all internal multiline lines when it is at column 0 regardless of what follows it. Feedback appreciated. I may be wrong about something.

@abstrctn
Copy link
Contributor

Hi @partlyhuman, thanks for pointing this out!

You're right that that's an inconsistent description; it's an artifact from a prior implementation of escaping. The current method is I think more straightforward, and seems to be what you've gone ahead with: the first leading backslash within a multiline value should be stripped, regardless of what follows it.

As with other aspects of the archieml syntax, whitespace shouldn't be significant to detecting the backslash. This means that spaces should be allowed, and preserved, at the beginning of escaped lines, as long as the first non-whitespace character on the line is a backslash:

mutlilinevalue: Two examples:
\key: value
  \key: value
:end

Would result in:

Two examples:
key: value
  key: value

Does that seem reasonable? I'll update the spec to be consistent with the existing parsers.

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