javascript - PEG Parser generator how to fix Expected "whitespace" but " " found -


i have readable stream of text input (including unicode characters html) trying extract information specifying structure in peg.js , returning custom json objects matched items.

i have text input in following format -

1. input [tags] (a) text (b) text ans. (b)   2. input [tags] (a) text (b) text ans. (b)  

so after searching available node.js lexical parsers out there found peg , tried sample script in online version -

start     = demo _ "whitespace"   = [ \t\n\r]* demo     = digits:[0-9]+."whitespace" "literal"+  integer "integer"   = _ [0-9]+ { return parseint(text(), 10); } 

but getting error -

"line 1, column 3: expected "whitespace" " " found." 

so, how can include whitespaces in expression or, there better ways / libraries accomplish node.js

you using "whitespace" should using _.

you can think of "whitespace" comment explains _ supposed mean.

peg.js should work fine in case, long input data formed.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -