Skip to content

Commit

Permalink
Accept a commented line at end of document
Browse files Browse the repository at this point in the history
FIX: Fix an issue where a commented line at the end of the input would
emit an error node.

Closes #25
  • Loading branch information
marijnh committed Jun 25, 2024
1 parent 2a7e8e3 commit 7606e06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/python.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ skw<term> { @extend[@name={term}]<identifier, term> }
formatStringSpec { FormatSpec { ":" (formatStringSpecChars | nestedFormatReplacement)* } "}" }

blankLine {
blankLineStart space? Comment? newline
blankLineStart space? Comment? (newline | eof)
}
}

Expand Down
10 changes: 10 additions & 0 deletions test/statement.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ Script(
ExpressionStatement(VariableName))),
ExpressionStatement(VariableName))

# Script ending in a comment

x = 1

# End

==>

Script(AssignStatement(VariableName,AssignOp,Number),Comment)

# Escaped newlines

x = 1 + \
Expand Down

0 comments on commit 7606e06

Please sign in to comment.