ridencww / goldengine

Java implementation of Devin Cook's GOLD Parser engine
Other
35 stars 14 forks source link

Line comments not working #23

Closed mbrassesco closed 8 months ago

mbrassesco commented 6 years ago

I'm trying to parse line comments and the following error appears:

Runaway group (no closing group terminator found). Last position line 6, column 9.

It might be related to issue #17 To temporarly fix that issue I've used the following String text = ltsInputString.getSource().replaceAll("\n", "\r");

When I remove the replacement of the /n for /r to fix issue 17, the comments work properly. But the errors are reported in the wrong line (issue 17 still occurs).

I'm running on Linux.

Block comments work.

GRM file contain:

Comment Start = '/*'
Comment End = '*/'
Comment Line = '//'

I don't think the whole grammar file will help.

codemanyak commented 6 years ago

@mbrassesco Just an editorial remark: You should use the suited markdown delimiters for code snippets, otherwise the asterisks will be virtually "eaten" for italic or emphasis text, which may be misleading. I think your grammar extract actually looks like:

Comment Start = '/*'
Comment End = '*/'
Comment Line = '//'

which works fine with the grammars I use. EDIT: Your error message looks rather like a defective block comment (i.e. a missing */ delimiter). It might be helpful for analysis to provide a minimum source file provoking this error (and ideally the grammar file, too).