Created
May 29, 2017 02:04
-
-
Save shixzie/5a6eaa607c2b8a790c8d1b920c13b805 to your computer and use it in GitHub Desktop.
literal rule definition overrided by regex
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
// Excluding first block | |
Let <- "let" // This is overrided by the following, same happens if i put this rule below the Identifier rule | |
Identifier <- ([a-z_]i+([a-z0-9_]i)*) { | |
return string(c.text), nil | |
} |
I guess, this is part of a much larger peg file, right? It looks like the relevant/important section is missing in this gist. My assumption is, that you have a choice expression some where and that the order in your choice expression is wrong. you have to put the most specific conditions first in your choice expression followed by the more generic ones. See https://godoc.org/github.com/mna/pigeon#hdr-Choice_expression
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course happens to all keyword like rules