cronburg / antlr-haskell

A language parsing quasiquoter for Haskell based heavily on ANTLR4.
Other
49 stars 7 forks source link

[tentative] g4 quasiquoter (parser) ignores lexemes after double-semicolon #37

Open cronburg opened 5 years ago

cronburg commented 5 years ago

Delete the // on line 11 in test/g4/DoubleSemi.hs and we get the following error:

/home/karl/w/antlr-haskell/test/g4/DoubleSemi.hs:15:6: error:
    Not in scope: data constructor ‘T_WS’                    
   |                                                         
15 | isWS T_WS = True                                        
   |      ^^^^                                               

First off G4 probably shouldn't parse successfully on two semicolons (bug), but just as importantly the parser shouldn't be throwing away if we want to allow for multiple semicolons in a row as a kind of no-op.

If we choose the latter, perhaps a warning message will be pertinent.

cronburg commented 5 years ago

This is low priority (triggered by a user's code formatting error, results in a compile-time error rather than unexpected runtime behavior), but is somewhat pernicious (it's not at all obvious to an end-user why the quasiquoter "worked" but didn't give them the right symbols).

https://github.com/cronburg/antlr-haskell/blob/master/test/g4/DoubleSemi.hs