Skip to content

Instantly share code, notes, and snippets.

@Kami Kami/gist:818385

Created Feb 9, 2011
Embed
What would you like to do?
Waxeye carser code
# Generated by the Waxeye Parser Generator - version 0.7.0
# www.waxeye.org
from waxeye import Edge, State, FA, WaxeyeParser
class Parser (WaxeyeParser):
start = 0
eof_check = True
automata = [FA("query", [State([Edge(16, 1, False)], False),
State([Edge(1, 2, False)], False),
State([], True)], FA.LEFT),
FA("or_level", [State([Edge(2, 1, False)], False),
State([Edge(13, 2, False)], True),
State([Edge(2, 1, False)], False)], FA.PRUNE),
FA("and_level", [State([Edge(3, 1, False)], False),
State([Edge(12, 2, False)], True),
State([Edge(3, 1, False)], False)], FA.PRUNE),
FA("paren_level", [State([Edge(15, 1, False),
Edge(4, 6, False),
Edge("(", 2, False)], False),
State([Edge("(", 2, False)], False),
State([Edge(16, 3, False)], False),
State([Edge(1, 4, False)], False),
State([Edge(")", 5, False)], False),
State([Edge(16, 6, False)], False),
State([], True)], FA.PRUNE),
FA("main_token", [State([Edge(5, 1, False),
Edge(7, 1, False),
Edge(6, 1, False)], False),
State([Edge(16, 2, False)], False),
State([], True)], FA.PRUNE),
FA("node_token", [State([Edge(15, 1, False),
Edge(["N", "n"], 2, False)], False),
State([Edge(["N", "n"], 2, False)], False),
State([Edge(["O", "o"], 3, False)], False),
State([Edge(["D", "d"], 4, False)], False),
State([Edge(["E", "e"], 5, False)], False),
State([Edge([":"], 6, False)], False),
State([Edge(9, 7, False)], False),
State([], True)], FA.PRUNE),
FA("provider_token", [State([Edge(15, 1, False),
Edge(["P", "p"], 2, False)], False),
State([Edge(["P", "p"], 2, False)], False),
State([Edge(["R", "r"], 3, False)], False),
State([Edge(["O", "o"], 4, False)], False),
State([Edge(["V", "v"], 5, False)], False),
State([Edge(["I", "i"], 6, False)], False),
State([Edge(["D", "d"], 7, False)], False),
State([Edge(["E", "e"], 8, False)], False),
State([Edge(["R", "r"], 9, False)], False),
State([Edge([":"], 10, False)], False),
State([Edge(11, 11, False)], False),
State([], True)], FA.PRUNE),
FA("tag_token", [State([Edge(15, 1, False),
Edge(["T", "t"], 2, False)], False),
State([Edge(["T", "t"], 2, False)], False),
State([Edge(["A", "a"], 3, False)], False),
State([Edge(["G", "g"], 4, False)], False),
State([Edge([":"], 5, False)], False),
State([Edge(10, 6, False)], False),
State([], True)], FA.PRUNE),
FA("provider", [State([Edge(["A", "a"], 1, False),
Edge(["E", "e"], 4, False),
Edge(["G", "g"], 10, False),
Edge(["L", "l"], 15, False),
Edge(["R", "r"], 20, False),
Edge(["S", "s"], 30, False),
Edge(["V", "v"], 45, False),
Edge(["P", "p"], 50, False)], False),
State([Edge(["W", "w"], 2, False)], False),
State([Edge(["S", "s"], 3, False)], False),
State([], True),
State([Edge(["C", "c"], 5, False)], False),
State([Edge(["2"], 6, False)], False),
State([Edge(["E", "e"], 7, False)], False),
State([Edge(["A", "a"], 8, False),
Edge(["U", "u"], 3, False)], False),
State([Edge(["S", "s"], 9, False)], False),
State([Edge(["T", "t"], 3, False)], False),
State([Edge(["O", "o"], 11, False)], False),
State([Edge(["G", "g"], 12, False)], False),
State([Edge(["R", "r"], 13, False)], False),
State([Edge(["I", "i"], 14, False)], False),
State([Edge(["D", "d"], 3, False)], False),
State([Edge(["I", "i"], 16, False)], False),
State([Edge(["N", "n"], 17, False)], False),
State([Edge(["O", "o"], 18, False)], False),
State([Edge(["D", "d"], 19, False)], False),
State([Edge(["E", "e"], 3, False)], False),
State([Edge(["A", "a"], 21, False),
Edge(["I", "i"], 28, False)], False),
State([Edge(["C", "c"], 22, False)], False),
State([Edge(["K", "k"], 23, False)], False),
State([Edge(["S", "s"], 24, False)], False),
State([Edge(["P", "p"], 25, False)], False),
State([Edge(["A", "a"], 26, False)], False),
State([Edge(["C", "c"], 27, False)], False),
State([Edge(["E", "e"], 3, False)], False),
State([Edge(["M", "m"], 29, False)], False),
State([Edge(["U", "u"], 3, False)], False),
State([Edge(["L", "l"], 31, False),
Edge(["O", "o"], 38, False)], False),
State([Edge(["I", "i"], 32, False)], False),
State([Edge(["C", "c"], 33, False)], False),
State([Edge(["E", "e"], 34, False)], False),
State([Edge(["H", "h"], 35, False)], False),
State([Edge(["O", "o"], 36, False)], False),
State([Edge(["S", "s"], 37, False)], False),
State([Edge(["T", "t"], 3, False)], False),
State([Edge(["F", "f"], 39, False)], False),
State([Edge(["T", "t"], 40, False)], False),
State([Edge(["L", "l"], 41, False)], False),
State([Edge(["A", "a"], 42, False)], False),
State([Edge(["Y", "y"], 43, False)], False),
State([Edge(["E", "e"], 44, False)], False),
State([Edge(["R", "r"], 3, False)], False),
State([Edge(["P", "p"], 46, False)], False),
State([Edge(["S", "s"], 47, False)], False),
State([Edge(["N", "n"], 48, False)], False),
State([Edge(["E", "e"], 49, False)], False),
State([Edge(["T", "t"], 3, False)], False),
State([Edge(["R", "r"], 51, False)], False),
State([Edge(["I", "i"], 52, False)], False),
State([Edge(["V", "v"], 53, False)], False),
State([Edge(["A", "a"], 54, False)], False),
State([Edge(["T", "t"], 55, False)], False),
State([Edge(["E", "e"], 3, False)], False)], FA.LEFT),
FA("node_name", [State([Edge(["*", "-", (48, 57), (65, 122)], 1, False),
Edge("\"", 3, True)], False),
State([Edge(["*", "-", (48, 57), (65, 122)], 1, False),
Edge(16, 2, False)], False),
State([], True),
State([Edge([" ", "*", "-", (48, 57), (65, 122)], 4, False)], False),
State([Edge([" ", "*", "-", (48, 57), (65, 122)], 4, False),
Edge("\"", 5, True)], False),
State([Edge(16, 2, False)], False)], FA.LEFT),
FA("tag_name", [State([Edge(["*", "-", (48, 57), (65, 122)], 1, False),
Edge("\"", 3, True)], False),
State([Edge(["*", "-", (48, 57), (65, 122)], 1, False),
Edge(16, 2, False)], False),
State([], True),
State([Edge([" ", "*", "-", (48, 57), (65, 122)], 4, False)], False),
State([Edge([" ", "*", "-", (48, 57), (65, 122)], 4, False),
Edge("\"", 5, True)], False),
State([Edge(16, 2, False)], False)], FA.LEFT),
FA("provider_name", [State([Edge(8, 1, False),
Edge("\"", 3, True)], False),
State([Edge(16, 2, False)], False),
State([], True),
State([Edge(8, 4, False)], False),
State([Edge("\"", 1, True)], False)], FA.LEFT),
FA("and_token", [State([Edge(["A", "a"], 1, False),
Edge("&", 5, False)], False),
State([Edge(["N", "n"], 2, False)], False),
State([Edge(["D", "d"], 3, False)], False),
State([Edge(16, 4, False)], False),
State([], True),
State([Edge("&", 3, False)], False)], FA.LEFT),
FA("or_token", [State([Edge(["O", "o"], 1, False),
Edge("|", 4, False)], False),
State([Edge(["R", "r"], 2, False)], False),
State([Edge(16, 3, False)], False),
State([], True),
State([Edge("|", 2, False)], False)], FA.LEFT),
FA("all_token", [State([Edge(["A", "a"], 1, False),
Edge("*", 3, False)], False),
State([Edge(["L", "l"], 2, False)], False),
State([Edge(["L", "l"], 3, False)], False),
State([Edge(16, 4, False)], False),
State([], True)], FA.LEFT),
FA("negate_token", [State([Edge("-", 1, False)], False),
State([], True)], FA.LEFT),
FA("ws", [State([Edge([" "], 0, False)], True)], FA.VOID)]
def __init__(self):
WaxeyeParser.__init__(self, Parser.start, Parser.eof_check, Parser.automata)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.