[Pyparsing] White space
Brought to you by:
ptmcg
From: cathal c. <cof...@gm...> - 2011-06-21 22:35:16
|
Hello, I have a quick question. Shouldn't the below grammar accept the given string? from pyparsing import Word, alphas g = "$" + "as" + Word(alphas) g.parseString('$ as abc') ParseException: Expected "$as" (at char 0), (line:1, col:1) I want the grammar to accept $ followed by: any number of spaces followed by: as followed by: any number of spaces followed by: any string of characters. The reason I am confused is that the following grammar accepts regardless of white space... why doesn't the above? g = "as" + Word(alphas) g.parseString(' as abc ') Out: (['as', 'abc'], {}) Kind regards, Cathal |