Skip to content
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

Plugin Internal Error on EOF #41

Closed
blkt opened this issue Jul 30, 2018 · 0 comments
Closed

Plugin Internal Error on EOF #41

blkt opened this issue Jul 30, 2018 · 0 comments
Assignees
Labels
bug

Comments

@blkt
Copy link

@blkt blkt commented Jul 30, 2018

Hi,

I'm getting the following error

[Internal Error] Unhandled error message (code 50, message: syntax error: mismatched character '<EOF>' expecting '"'

on this grammar


program 
    : (description NL+)? stmts* EOF
    ;

description
    : 'desc' WS+ string NL*
    ;

stmts
    : stmt NL*
    | stmts NL+ stmt NL+
    ;

stmt
    : assignment
    | return
    | expr
    ;

expr
    : number
    | identifier
    | fapply
    | addexpr
    ;

addexpr
    : mulexpr
    | addexpr WS* '+' WS* mulexpr
    | addexpr WS* '-' WS* mulexpr
    ;

mulexpr
    : unary
    | mulexpr WS* '*' WS* unary
    | mulexpr WS* '/' WS* unary
    ;

fapply
    : identifier '(' ( ')' | arglist ')' )
    ;

assignment
    : identifier WS* '=' WS* expr
    ;
return
    : 'return' WS* expr
    ;

arglist
    : expr
    | arglist WS* ',' WS* expr
    ;

unary
    : number
    | identifier
    ;

primary
    : number
    | string
    | identifier
    ;

string
    : '"' [a-zA-Z-_ ()']+ '"'
    ;

number
    : [+-]?([1-9][0-9]+|[0-9])
    ;

identifier
    : [a-zA-Z_][a-zA-Z0-9_]+
    ;

NL  : '\r'? '\n' -> skip
    ;

WS  : [ \t\r\u000C]+ -> skip
    ;

I ported this grammar from an instaparse source grammar file, so it may be broken in a number of ways.
Let me know if you need help/more info.

Regards,
Michelangelo

@mike-lischke mike-lischke added the bug label Jul 30, 2018
@mike-lischke mike-lischke self-assigned this Jul 30, 2018
mike-lischke added a commit that referenced this issue Jul 30, 2018
This is a weird one. With the existing code I could reproduce the bug but not debug it. After transpiling all JS code debugging started working and the bug was gone. Go figure...

At least I enabled strict null checks, which showed me a few weak points in the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.