SDF Java PT generator and {case-insensitive} attribute yields wrong AST
The
case-insensitive
attribute on a template production is supposed to make all keywords case-insensitive (source, source). With the new Java parse table generator (sdf2table: java
) in Spoofax Eclipse 2.4.0.20171026-103626-master, the AST is wrong. For example, given the following (simplified Pascal) language:module foo context-free start-symbols Start context-free syntax Start.Program = < <Programheading> > Programheading.ProgramHeading = < program <Identifier> (<{Identifier ", "}*>); > {case-insensitive} lexical syntax // Variable and Identifier Categories Identifier = [a-zA-Z][a-zA-Z0-9\_]* lexical restrictions Identifier -/- [a-zA-Z0-9\_] lexical syntax // layout LAYOUT = [\ \t\n\r] // whitespace LAYOUT = Comment Comment = "{" InsideComment* "}" InsideComment = ~[\}] InsideComment = Comment // nested comment, not in standard Comment = "(*" InsideParComment* "*)" InsideParComment = ~[\*] InsideParComment = Asterisk Asterisk = "*" lexical restrictions Asterisk -/- [\)] context-free restrictions LAYOUT? -/- [\ \t\n\r\{]
parsing the following program:
program x ();
yields the following AST:
Program( ProgramHeading( (112, 114, 111, 103, 114, 97, 109) , "x" , 40 , [] , 41 , 59 ) )
Instead, one would expect:
Program( ProgramHeading( "x" , [] ) )
Indeed, with the C parse table generator (
Submitted by Martijn on 16 November 2017 at 22:08sdf2table: c
), we get the latter AST.
Issue Log
On 23 February 2018 at 14:58 Eduardo Amorim commented:
This issue should be fixed in the latest/nightly version of Spoofax.
Log in to post comments