[SimpleParse] Having SimpleParser ignore whitespaces
Brought to you by:
mcfletch
From: Karl T. K. <ka...@pr...> - 2002-09-10 15:32:14
|
Hi fellow parsists. I notice that all of the example grammars include whitespaces in the productions explicitly. Is there any simple way to tell SimpleParse that the charset "[ \t\n\r]+" is considered a generic token separator, as is customary with other EBNF tools ? funcall := id, '(', arglist, ')', ';' is most definitely easier to read and reason about than funcall := id, ws, '(', ws, arglist, ws, ')', ws, ';' I tried modifying the resultant tuple returned by generator.buildParser thusly; parser = generator.buildParser(decl).parserbyname('root') parser = ((None,TextTools.AllInSet,TextTools.set(' \r\n\t'),+1),) + parser pprint.pprint( TextTools.tag( input, parser )) but that does not seem to have any effect. Any suggestions/pointers to solutions are most welcome. Kind regards, Karl T |