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

Update to Syntax 0.6 #69

Merged
merged 29 commits into from Jul 24, 2018

Conversation

Projects
None yet
3 participants
@stasm
Member

stasm commented Jul 11, 2018

stasm and others added some commits Jul 11, 2018

Port changes from ast.js. Only minor changes. Expression(SyntaxNode) …
…implementation removed in ast.js, but left functional in this commit.
Fix span.start for Messages/Terms with Comments.
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.
Fix Comment span to include the terminal line break
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.
Include the line end in spans of Messages and Terms
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
Don't include the terminal newline in Entries
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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@stasm stasm deleted the feature/syntax-0.6 branch Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment