Grammar is incorrect. He cannot be satisfied.
- Each
file ends with clause . - Each
clause ends with a '0' . literal in clause , being greedy reg-exp , will eat the final '0' .
Conclusion: No clause .
For instance...
=> (parser "60") Parse error at line 1, column 3: 60 ^ Expected one of: "0" #"\s+" #"-\d+" #"[1-9]\d*"
We can analyze a literal
=> (parser "60" :start :literal) ("60")
... but not clause
=> (parser "60" :start :clause) Parse error at line 1, column 3: 60 ^ Expected one of: "0" (followed by end-of-string)
Why is it so slow?
If comment exists:
- he can assimilate the whole file;
- or break into any character
'c' into consecutive comment s; - or termination at any point after the initial
'c' .
This means that each tail should be represented by the rest of the grammar, which includes reg-exp for literal , which Instaparse does not see inside. Therefore, everything must be judged, and all this will ultimately fail. No wonder it's slow.
I suspect this file is actually line split. And your problems arise from trying to combine new lines with other forms of white space.
May I fondly point out that playing with a few tiny examples - and thatβs all I did - could save you a ton of trouble.
source share