A-binary-parser-generator
A-binary-parser-generator copied to clipboard
parse error for TYPE[something / 2] recordname
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 ^)
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. :)
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