It looks like you are on the right track. Maybe you are doing something wrong when you acutally pass the text
to the grammar. Adding the following line in your code
print lines.parseString(text)
Gives the expected output
[['y ', '=', [' 3']], ['x ', '=', [' 2']]]
As an aside, normally you don't want to keep the whitespace when parsing. The tokens are usually the only thing that matters. This is how I would parse your example:
EOL = LineEnd().suppress()
EQ = Literal("=").suppress()
val = Word(alphanums)
line = Group(val('key') + EQ + val('val') + EOL)
grammar = OneOrMore(line)
for x in grammar.parseString(text):
print x.dump()
The output in this case is much nicer
['y', '3']
- key: y
- val: 3
['x', '2']
- key: x
- val: 2