I am trying to use pyparsing to parse a configuration file of following form
x = "/user/test"
y = 3
Here is my code snippet
ParserElement.defaultWhitespaceChars = (" \t")
END = StringEnd()
NL = LineEnd().suppress()
assignment = Literal('=')
key_str = CharsNotIn("=")
value_str = Group(~assignment + restOfLine)
line = Group(key_str + assignment + value_str)
lines = ZeroOrMore(line)
lines.ignore(NL)
text = """
y = 3
x = 2
"""
The output that I get from parseFile tells me it is parsing the first line only. Can anybody please help me find out what I am doing wrong?
pyparsingtag. You can also visit the wiki at pyparsing.wikispace.com, and read through the Discussion tab on the wiki Home page.