Issue #6 new

Warn against blank rules

Henrik Vendelbo
repo owner created an issue

If a rule can match zero characters it can create an infinite loop. Such rules should be detected.

    Grammar = OMeta.makeGrammar(r"""

letters = letter:l -> ''.join(l)
breaks = ('{CR}' '{LF}') | '{CR}' | '{LF}' stream = (letters | breaks)
""", {}) result, error = Grammar("abc\r\n\nabc\n").apply("stream") assert result == ['abc','\r\n', '\n', 'abc' '\n']

Change * to a + and the test runs

Comments (0)

  1. Log in to comment