Created
May 22, 2015 05:21
-
-
Save rns/9b788e134d297ed83984 to your computer and use it in GitHub Desktop.
locations in LPeg messages on errors in grammars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lpeg = require 'lpeg' | |
equalcount = lpeg.P{ | |
"S"; -- initial rule name | |
S = "a" * lpeg.V"B" + "b" * lpeg.V"A" + "", | |
A = "a" * lpeg.V"S" + "b" * lpeg.V"A" * lpeg.V"A", | |
-- , '1' added to produce error | |
B = "b", '1' * lpeg.V"S" + "a" * lpeg.V"B" * lpeg.V"B", | |
} * -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lua: lpeg-locations.lua:3: rule 'B' is not a pattern | |
stack traceback: | |
[C]: in function 'P' | |
lpeg-locations.lua:3: in main chunk | |
[C]: ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lpeg = require 'lpeg' | |
equalcount = lpeg.P{ | |
"S"; -- initial rule name | |
S = "a" * lpeg.V"B" + "b" * lpeg.V"A" + "", | |
-- ++++ added to produce error | |
A = "a" * lpeg.V"S++++" + "b" * lpeg.V"A" * lpeg.V"A", | |
B = "b" * lpeg.V"S" + "a" * lpeg.V"B" * lpeg.V"B", | |
} * -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lua: lpeg-locations.lua:3: rule 'S++++' undefined in given grammar | |
stack traceback: | |
[C]: in function 'P' | |
lpeg-locations.lua:3: in main chunk | |
[C]: ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment