lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.77k stars 406 forks source link

Example Python 3 does not parse floating-point imaginary numbers #387

Closed brady-ds closed 5 years ago

brady-ds commented 5 years ago

On this line, it appears that the IMAG_NUMBER regular expression is attempting to reference the FLOAT_NUMBER terminal, but there does not seem to be any code in Lark to treat the ${} syntax that way. Consequently, the following code raises an exception:

#! /usr/bin/env python3

from lark import Lark

if __name__ == '__main__':
    Lark(open('…/python3.lark'), parser='lalr', start='single_input').parse('x = 0.0j\n')
erezsh commented 5 years ago

Fixed, thanks for the report!

It was a remnant of an obsolete feature.