The problem is that LineEnd also matches the end-of-string. The bug that you have hit is that, when matching on end-of-string, LineEnd does not advance the parse location. So the current release will match the end-of-string as an infinite number of LineEnd's.
Overwriting with a Literal("\n") is okay, as long as you know that the file ends with a terminating \n, or if your BNF is such that it does not care about the string ending case.
I've corrected this in the current pyparsing code, so that LineEnd will only match a single time as the end-of-string.
-- Paul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
got a bug where pyparsing enters into an infinite loop with the following code.
lineEnds = OneOrMore(lineEnd).suppress()
line = delimitedList(Word(alphas), lineEnds)
line.parseString('a')
Strangely, if I redefine lineEnd to be Literal('\n'), it runs fine. Any idea what's going on?
-e
The problem is that LineEnd also matches the end-of-string. The bug that you have hit is that, when matching on end-of-string, LineEnd does not advance the parse location. So the current release will match the end-of-string as an infinite number of LineEnd's.
Overwriting with a Literal("\n") is okay, as long as you know that the file ends with a terminating \n, or if your BNF is such that it does not care about the string ending case.
I've corrected this in the current pyparsing code, so that LineEnd will only match a single time as the end-of-string.
-- Paul