Skip to content

Update to Syntax 0.6 #69

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

Merged
merged 29 commits into from
Jul 24, 2018
Merged

Update to Syntax 0.6 #69

merged 29 commits into from
Jul 24, 2018

Conversation

stasm
Copy link
Contributor

@stasm stasm commented Jul 11, 2018

@stasm stasm force-pushed the feature/syntax-0.6 branch from fd10b56 to 26fe543 Compare July 16, 2018 16:48
@stasm stasm force-pushed the feature/syntax-0.6 branch from 26fe543 to fe11a32 Compare July 16, 2018 16:53
stasm and others added 16 commits July 16, 2018 18:53
Port of projectfluent/fluent.js#255

Move the message.span.start logic from the wrapper to the point
where the comment is hooked up to the message.
As the message already has the span when it gets there, the
wrapper refuses to do it again.
Port of projectfluent/fluent.js#257.

Comments' content includes the terminal line break and the span should
reflect it. The end span should be the offset of the beginning of the
next line following the Comment, not the offset of the Comment's
terminal line break.

This also means that we can remvoe the special case in skipBlankLines.
The meaning changes slightly: skipBlankLines now return the number of
all line breaks skipped, regardless of whether they belonged to
fully-blank lines or not. This is OK for our use-case, however.
Port of projectfluent/fluent.js#258

This is similar to the change made to Comments except here it doesn't
affect the values, just the spans. The EBNF defines Message and Term as:

    Message ::= Comment? Identifier inline_space? "=" inline_space? ((Pattern Attribute*) | (Attribute+)) line_end
    Term ::= Comment? TermIdentifier inline_space? "=" inline_space? Value Attribute* line_end
Port of projectfluent/fluent.js#259

Revert earlier changes which added the trailing newline to the spans of
the Message, Term and Comment, as well as to the content of Comments.
The trailing line break should not be part of the span nor the content.

Make Junk subclass SyntaxNode directly, rather than Entry. Entry is now
an abstract class for useful AST nodes carrying content: Messages, Terms
and Comments.

Remove the annotations field from Entry togather with the add_annotation
method and move it directly onto Junk.
@stasm stasm merged commit 468fe28 into master Jul 24, 2018
@stasm stasm deleted the feature/syntax-0.6 branch July 24, 2018 16:17
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

Successfully merging this pull request may close these issues.

3 participants