UoYCS-plasma/GP2

Invalid characters in host graph labels

ivaylohristakiev opened this issue · 1 comments

Currently, a generated GP program may throw a runtime error when it builds a host graph whose labels contain some (allowed) characters like '.' and '!' even though these graphs are valid (using the validation option).

Example host graph:

[<80,98>
    | (0, "a!" <63.5, 68> )
    |
]

Validating the host graph before the program is compiled:
"Host graph myhostgraphname is valid."

Running any program on above host graph produces the following error:

> ./GP2-run
Warning: Invalid character in string: '!'.
Error at '': syntax error, unexpected $end, expecting ')' or '<'

Error parsing host graph file. Execution aborted.

Removing the ! from the label fixes the problem.

I guess it's an issue when the host graph is parsed and built at runtime. Perhaps different characters are allowed?

Bug seems to be coming from the lib's lexer (https://github.com/UoYCS-plasma/GP2/blob/master/Compiler/lib/hostLexer.lex#L67) which has different matching compared to the compiler lexer (https://github.com/UoYCS-plasma/GP2/blob/master/Compiler/src/gpLexer.lex#L110).