A-binary-parser-generator icon indicating copy to clipboard operation
A-binary-parser-generator copied to clipboard

parse error for TYPE[something / 2] recordname

Open Pomax opened this issue 13 years ago • 2 comments

The RegExp for this is currently

search = "([ \\t]*)([\\w_]+)\\[([^\\.\\s]+(\\s*[\\+\\-\\*\\/]\\s*[^)]+)*)\\]\\s*(\\w+)($|\s*[^O])";

but this should be

search = "([ \\t]*)([\\w_]+)\\[([^\\.\\s]+(\\s*[\\+\\-\\*\\/]\\s*[^\\]]+)*)\\]\\s*(\\w+)($|\s*[^O])";

difference is in matching until ^] rather than ^)

Pomax avatar Oct 07 '12 17:10 Pomax

As noted in 29e897a16548dec59bf66879d8ed00085be5030b I just removed the spaces from the definition source lines and all was well. If I left the spaces embedded, e.g.

   USHORT[segCountX2 / 2] startCount

then it would leave trash at end of the following line.

That is, this was surprising and distressing, but there was a workaround. :)

tshinnic avatar Dec 02 '14 08:12 tshinnic

aye. turning the parser into a true AST builder (probably using the struct.js from the CFF-Glyphlet-Font repo) should solve this problem later, taking out the spaces for now seems imminently sensible

Pomax avatar Dec 02 '14 15:12 Pomax