Skip to content

Commit

Permalink
Add test case for #55
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jul 25, 2024
1 parent 699dea8 commit e8c9d52
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/cases/EmptyAfterLookahead.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// This example caused the moving of nodes for reductions to move a
// node across a buffer position stored on the parser stack, causing a
// node to fall out of its parent node.

@skip { space | lineComment }
@top Program { (GlobalConstantDeclaration ";")* }
GlobalConstantDeclaration {
AttributeList @specialize[@name='Keyword']<Identifier, 'const'> Identifier "="
}
AttributeList { Attribute { "@" Identifier }* }
@tokens {
space { std.whitespace+ }
lineComment { "//" ![\n\r]* $[\n\r]? }
Identifier { $[a-zA-Z_] $[0-9a-zA-Z_]* }
}

# Doesn't produce corrupt trees

// Comment

// Comment Comment
const ACES_INPUT = ;

// Comment Comment Comment
const ACES_OUTPUT = ;

==>

Program(
GlobalConstantDeclaration(AttributeList,Keyword,Identifier),
GlobalConstantDeclaration(AttributeList,Keyword,Identifier))

0 comments on commit e8c9d52

Please sign in to comment.