├── __init__.py ├── kopl ├── __init__.py ├── utils.py ├── parser.py ├── translator.py ├── Kopl.tokens ├── KoplLexer.tokens ├── Kopl.g4 └── Kopl.interp ├── sparql ├── __init__.py ├── parser.py ├── translator.py ├── Sparql.tokens ├── SparqlLexer.tokens └── Sparql.g4 ├── docs └── imgs │ └── icon.png ├── .gitignore ├── ir ├── parser.py ├── utils.py ├── IRLexer.tokens ├── IRParser.tokens ├── translator.py ├── IRLexer.g4 ├── IRParser.g4 └── IRParser.interp ├── cypher ├── CypherLexer.tokens ├── CypherParser.tokens ├── parser.py ├── translator.py ├── CypherLexer.g4 ├── CypherParser.g4 ├── utils.py ├── CypherParserListener.py ├── CypherParser.interp ├── CypherLexer.interp └── CypherLexer.py ├── overnight ├── parser.py ├── Overnight.tokens ├── OvernightLexer.tokens ├── grammar │ ├── publications.grammar │ ├── blocks.grammar │ ├── calendar.grammar │ ├── recipes.grammar │ ├── basketball.grammar │ ├── housing.grammar │ ├── restaurants.grammar │ └── socialnetwork.grammar ├── translator.py ├── Overnight.g4 ├── Overnight.interp ├── OvernightLexer.interp └── OvernightLexer.py ├── utils.py ├── README.md └── LICENSE /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /kopl/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sparql/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/imgs/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Flitternie/GraphQ_Trans/HEAD/docs/imgs/icon.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | */java 2 | */.antlr 3 | *.javac 4 | *.java 5 | __pycache__ 6 | *.pyc 7 | *.pyo 8 | *.DS_Store 9 | -------------------------------------------------------------------------------- /kopl/utils.py: -------------------------------------------------------------------------------- 1 | def get_program_seq(program): 2 | seq = [] 3 | for item in program: 4 | func = item['function'] 5 | inputs = item['inputs'] 6 | seq.append(func + '(' + ''.join(inputs) + ')') 7 | seq = ''.join(seq) 8 | return seq -------------------------------------------------------------------------------- /ir/parser.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.ir.IRLexer import IRLexer 5 | from graphq_trans.ir.IRParser import IRParser 6 | 7 | from graphq_trans.utils import ErrorHandler 8 | 9 | 10 | class Parser(): 11 | def __init__(self): 12 | self.walker = ParseTreeWalker() 13 | self.error_listener = ErrorHandler() 14 | 15 | def parse(self, input): 16 | input_stream = InputStream(input) 17 | lexer = IRLexer(input_stream) 18 | lexer.removeErrorListeners() 19 | lexer.addErrorListener(self.error_listener) 20 | 21 | token_stream = CommonTokenStream(lexer) 22 | parser = IRParser(token_stream) 23 | parser.removeErrorListeners() 24 | parser.addErrorListener(self.error_listener) 25 | tree = parser.root() 26 | lisp_tree_str = tree.toStringTree(recog=parser) 27 | 28 | return lisp_tree_str 29 | 30 | -------------------------------------------------------------------------------- /cypher/CypherLexer.tokens: -------------------------------------------------------------------------------- 1 | Call=1 2 | Match=2 3 | Where=3 4 | Return=4 5 | Union=5 6 | With=6 7 | As=7 8 | And=8 9 | Or=9 10 | OrderBy=10 11 | Limit=11 12 | Distinct=12 13 | CountFunction=13 14 | IsEmptyFunction=14 15 | Desc=15 16 | SEP=16 17 | LP=17 18 | RP=18 19 | LB=19 20 | COL=20 21 | TORIGHT=21 22 | TOLEFT=22 23 | UND=23 24 | RB=24 25 | LSB=25 26 | RSB=26 27 | EQ=27 28 | NEQ=28 29 | GTE=29 30 | GT=30 31 | LTE=31 32 | LT=32 33 | DOT=33 34 | INTEGER=34 35 | STRING_SYMBOL=35 36 | STRING_LITERAL=36 37 | OR=37 38 | COMMA=38 39 | WS=39 40 | 'CALL'=1 41 | 'MATCH'=2 42 | 'WHERE'=3 43 | 'RETURN'=4 44 | 'UNION'=5 45 | 'WITH'=6 46 | 'AS'=7 47 | 'AND'=8 48 | 'OR'=9 49 | 'ORDER BY'=10 50 | 'LIMIT'=11 51 | 'DISTINCT'=12 52 | 'count'=13 53 | 'isEmpty'=14 54 | 'DESC'=15 55 | '('=17 56 | ')'=18 57 | '{'=19 58 | ':'=20 59 | '->'=21 60 | '<-'=22 61 | '-'=23 62 | '}'=24 63 | '['=25 64 | ']'=26 65 | '='=27 66 | '<>'=28 67 | '>='=29 68 | '>'=30 69 | '<='=31 70 | '<'=32 71 | '.'=33 72 | '|'=37 73 | ','=38 74 | -------------------------------------------------------------------------------- /cypher/CypherParser.tokens: -------------------------------------------------------------------------------- 1 | Call=1 2 | Match=2 3 | Where=3 4 | Return=4 5 | Union=5 6 | With=6 7 | As=7 8 | And=8 9 | Or=9 10 | OrderBy=10 11 | Limit=11 12 | Distinct=12 13 | CountFunction=13 14 | IsEmptyFunction=14 15 | Desc=15 16 | SEP=16 17 | LP=17 18 | RP=18 19 | LB=19 20 | COL=20 21 | TORIGHT=21 22 | TOLEFT=22 23 | UND=23 24 | RB=24 25 | LSB=25 26 | RSB=26 27 | EQ=27 28 | NEQ=28 29 | GTE=29 30 | GT=30 31 | LTE=31 32 | LT=32 33 | DOT=33 34 | INTEGER=34 35 | STRING_SYMBOL=35 36 | STRING_LITERAL=36 37 | OR=37 38 | COMMA=38 39 | WS=39 40 | 'CALL'=1 41 | 'MATCH'=2 42 | 'WHERE'=3 43 | 'RETURN'=4 44 | 'UNION'=5 45 | 'WITH'=6 46 | 'AS'=7 47 | 'AND'=8 48 | 'OR'=9 49 | 'ORDER BY'=10 50 | 'LIMIT'=11 51 | 'DISTINCT'=12 52 | 'count'=13 53 | 'isEmpty'=14 54 | 'DESC'=15 55 | '('=17 56 | ')'=18 57 | '{'=19 58 | ':'=20 59 | '->'=21 60 | '<-'=22 61 | '-'=23 62 | '}'=24 63 | '['=25 64 | ']'=26 65 | '='=27 66 | '<>'=28 67 | '>='=29 68 | '>'=30 69 | '<='=31 70 | '<'=32 71 | '.'=33 72 | '|'=37 73 | ','=38 74 | -------------------------------------------------------------------------------- /cypher/parser.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.cypher.CypherLexer import CypherLexer 5 | from graphq_trans.cypher.CypherParser import CypherParser 6 | 7 | from graphq_trans.utils import ErrorHandler 8 | 9 | 10 | class Parser(): 11 | def __init__(self): 12 | self.walker = ParseTreeWalker() 13 | self.error_listener = ErrorHandler() 14 | 15 | def parse(self, input): 16 | input_stream = InputStream(input) 17 | lexer = CypherLexer(input_stream) 18 | lexer.removeErrorListeners() 19 | lexer.addErrorListener(self.error_listener) 20 | 21 | token_stream = CommonTokenStream(lexer) 22 | parser = CypherParser(token_stream) 23 | parser.removeErrorListeners() 24 | parser.addErrorListener(self.error_listener) 25 | tree = parser.root() 26 | lisp_tree_str = tree.toStringTree(recog=parser) 27 | 28 | return lisp_tree_str 29 | 30 | -------------------------------------------------------------------------------- /sparql/parser.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.sparql.SparqlLexer import SparqlLexer 5 | from graphq_trans.sparql.SparqlParser import SparqlParser 6 | 7 | from graphq_trans.utils import ErrorHandler 8 | 9 | 10 | class Parser(): 11 | def __init__(self): 12 | self.walker = ParseTreeWalker() 13 | self.error_listener = ErrorHandler() 14 | 15 | def parse(self, input): 16 | input_stream = InputStream(input) 17 | lexer = SparqlLexer(input_stream) 18 | lexer.removeErrorListeners() 19 | lexer.addErrorListener(self.error_listener) 20 | 21 | token_stream = CommonTokenStream(lexer) 22 | parser = SparqlParser(token_stream) 23 | parser.removeErrorListeners() 24 | parser.addErrorListener(self.error_listener) 25 | tree = parser.root() 26 | lisp_tree_str = tree.toStringTree(recog=parser) 27 | 28 | return lisp_tree_str 29 | 30 | 31 | -------------------------------------------------------------------------------- /overnight/parser.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.overnight.OvernightLexer import OvernightLexer 5 | from graphq_trans.overnight.OvernightParser import OvernightParser 6 | 7 | from graphq_trans.utils import ErrorHandler 8 | 9 | 10 | class Parser(): 11 | def __init__(self): 12 | self.walker = ParseTreeWalker() 13 | self.error_listener = ErrorHandler() 14 | 15 | def parse(self, input): 16 | input_stream = InputStream(input) 17 | lexer = OvernightLexer(input_stream) 18 | lexer.removeErrorListeners() 19 | lexer.addErrorListener(self.error_listener) 20 | 21 | token_stream = CommonTokenStream(lexer) 22 | parser = OvernightParser(token_stream) 23 | parser.removeErrorListeners() 24 | parser.addErrorListener(self.error_listener) 25 | tree = parser.root() 26 | lisp_tree_str = tree.toStringTree(recog=parser) 27 | 28 | return lisp_tree_str 29 | 30 | 31 | -------------------------------------------------------------------------------- /kopl/parser.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.kopl.KoplLexer import KoplLexer 5 | from graphq_trans.kopl.KoplParser import KoplParser 6 | 7 | from graphq_trans.utils import ErrorHandler 8 | from graphq_trans.kopl.utils import get_program_seq 9 | 10 | class Parser(): 11 | def __init__(self): 12 | self.walker = ParseTreeWalker() 13 | self.error_listener = ErrorHandler() 14 | 15 | def parse(self, input): 16 | input = get_program_seq(input) 17 | input_stream = InputStream(input) 18 | lexer = KoplLexer(input_stream) 19 | lexer.removeErrorListeners() 20 | lexer.addErrorListener(self.error_listener) 21 | 22 | token_stream = CommonTokenStream(lexer) 23 | parser = KoplParser(token_stream) 24 | parser.removeErrorListeners() 25 | parser.addErrorListener(self.error_listener) 26 | tree = parser.root() 27 | lisp_tree_str = tree.toStringTree(recog=parser) 28 | 29 | return lisp_tree_str 30 | 31 | -------------------------------------------------------------------------------- /overnight/Overnight.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | PREFIX=33 34 | LB=34 35 | RB=35 36 | DATE=36 37 | YEAR=37 38 | TIME=38 39 | INTEGER=39 40 | STRING_LITERAL=40 41 | WS=41 42 | 'en.'=1 43 | '.'=2 44 | 'string'=3 45 | 'number'=4 46 | '!'=5 47 | 'type'=6 48 | 'var'=7 49 | 'lambda'=8 50 | '='=9 51 | '<'=10 52 | '>'=11 53 | 'min'=12 54 | 'max'=13 55 | 'sum'=14 56 | 'avg'=15 57 | 'listValue'=16 58 | 'size'=17 59 | 'domain'=18 60 | 'singleton'=19 61 | 'filter'=20 62 | 'getProperty'=21 63 | 'superlative'=22 64 | 'countSuperlative'=23 65 | 'countComparative'=24 66 | 'aggregate'=25 67 | 'concat'=26 68 | 'reverse'=27 69 | 'ensureNumericProperty'=28 70 | 'ensureNumericEntity'=29 71 | 'date'=30 72 | 'year'=31 73 | 'time'=32 74 | '('=34 75 | ')'=35 76 | -------------------------------------------------------------------------------- /overnight/OvernightLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | PREFIX=33 34 | LB=34 35 | RB=35 36 | DATE=36 37 | YEAR=37 38 | TIME=38 39 | INTEGER=39 40 | STRING_LITERAL=40 41 | WS=41 42 | 'en.'=1 43 | '.'=2 44 | 'string'=3 45 | 'number'=4 46 | '!'=5 47 | 'type'=6 48 | 'var'=7 49 | 'lambda'=8 50 | '='=9 51 | '<'=10 52 | '>'=11 53 | 'min'=12 54 | 'max'=13 55 | 'sum'=14 56 | 'avg'=15 57 | 'listValue'=16 58 | 'size'=17 59 | 'domain'=18 60 | 'singleton'=19 61 | 'filter'=20 62 | 'getProperty'=21 63 | 'superlative'=22 64 | 'countSuperlative'=23 65 | 'countComparative'=24 66 | 'aggregate'=25 67 | 'concat'=26 68 | 'reverse'=27 69 | 'ensureNumericProperty'=28 70 | 'ensureNumericEntity'=29 71 | 'date'=30 72 | 'year'=31 73 | 'time'=32 74 | '('=34 75 | ')'=35 76 | -------------------------------------------------------------------------------- /overnight/grammar/publications.grammar: -------------------------------------------------------------------------------- 1 | # Agile grammar for publications 2 | 3 | (include general.grammar) 4 | 5 | # Types 6 | (rule $TypeNP (article) (ConstantFn en.article)) 7 | (rule $EntityNP1 (multivariate data analysis) (ConstantFn en.article.multivariate_data_analysis)) 8 | 9 | # Properties 10 | (rule $RelNP (author) (ConstantFn (string author))) 11 | (rule $TypeNP (person) (ConstantFn en.person)) 12 | (rule $EntityNP1 (efron) (ConstantFn en.person.efron)) 13 | (rule $EntityNP2 (lakoff) (ConstantFn en.person.lakoff)) 14 | 15 | (rule $RelNP (venue) (ConstantFn (string venue))) 16 | (rule $TypeNP (venue) (ConstantFn en.venue)) 17 | (rule $EntityNP1 (annals of statistics) (ConstantFn en.venue.annals_of_statistics)) 18 | (rule $EntityNP2 (computational linguistics) (ConstantFn en.venue.computational_linguistics)) 19 | 20 | (rule $RelNP (publication date) (ConstantFn (string publication_date))) 21 | (rule $EntityNP1 (2004) (ConstantFn (date 2004 -1 -1))) 22 | (rule $EntityNP2 (2010) (ConstantFn (date 2010 -1 -1))) 23 | 24 | (rule $VP/NP (cites) (ConstantFn (string cites))) 25 | 26 | # Unaries 27 | (rule $VP (won an award) (ConstantFn (string won_award))) 28 | -------------------------------------------------------------------------------- /ir/utils.py: -------------------------------------------------------------------------------- 1 | import re 2 | from graphq_trans.utils import * 3 | 4 | data_type = { 5 | "entity": "E", 6 | "entitySet": "ES", 7 | "attribute": "A", 8 | "concept": "C", 9 | "value": "V", 10 | "qualifier": "Q", 11 | "relation": "R" 12 | } 13 | 14 | symbolOP_vocab = { 15 | "=": "is", 16 | "<": "smaller than", 17 | ">": "larger than", 18 | "!=": "is not", 19 | "<=": "at most", 20 | ">=": "at least", 21 | "max": "most", 22 | "min": "least" 23 | } 24 | 25 | 26 | def scoping(type, value): 27 | if type not in data_type.keys(): 28 | raise TypeError("{} is not a valid type.".format(type)) 29 | if value == "": 30 | return "" 31 | if type == "entity": 32 | if value.is_pop: 33 | return value 34 | elif not value.is_atom: 35 | return "<{}> {} ".format(data_type["entitySet"], value, data_type["entitySet"]) 36 | elif type == "value": 37 | if value.startswith("<{}>".format(data_type["attribute"])) or re.match(r".*? or .*?", value): 38 | return value 39 | return "<{}> {} ".format(data_type[type], value, data_type[type]) 40 | -------------------------------------------------------------------------------- /overnight/grammar/blocks.grammar: -------------------------------------------------------------------------------- 1 | (include general.grammar) 2 | 3 | # Types 4 | (rule $TypeNP (block) (ConstantFn en.block)) 5 | (rule $EntityNP1 (block 1) (ConstantFn en.block.block1)) 6 | (rule $EntityNP2 (block 2) (ConstantFn en.block.block2)) 7 | 8 | # Properties 9 | (rule $RelNP (shape) (ConstantFn (string shape))) 10 | (rule $EntityNP1 (a pyramid) (ConstantFn en.shape.pyramid)) 11 | (rule $EntityNP2 (a cube) (ConstantFn en.shape.cube)) 12 | 13 | (rule $RelNP (color) (ConstantFn (string color))) 14 | (rule $EntityNP1 (red) (ConstantFn en.color.red)) 15 | (rule $EntityNP2 (green) (ConstantFn en.color.green)) 16 | 17 | (rule $RelNP (length) (ConstantFn (string length))) 18 | (rule $RelNP (width) (ConstantFn (string width))) 19 | (rule $RelNP (height) (ConstantFn (string height))) 20 | (rule $EntityNP1 (3 inches) (ConstantFn (number 3 en.inch))) 21 | (rule $EntityNP2 (6 inches) (ConstantFn (number 6 en.inch))) 22 | 23 | (rule $VP/NP (is left of) (ConstantFn (string left))) 24 | (rule $VP/NP (is right of) (ConstantFn (string right))) 25 | (rule $VP/NP (is above) (ConstantFn (string above))) 26 | (rule $VP/NP (is below) (ConstantFn (string below))) 27 | 28 | (rule $VP (is special) (ConstantFn (string is_special))) 29 | -------------------------------------------------------------------------------- /sparql/translator.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.sparql.SparqlLexer import SparqlLexer 5 | from graphq_trans.sparql.SparqlParser import SparqlParser 6 | from graphq_trans.sparql.SparqlListener import SparqlListener 7 | from graphq_trans.sparql.IREmitter import IREmitter 8 | 9 | from graphq_trans.utils import ErrorHandler 10 | 11 | 12 | class Translator(): 13 | def __init__(self): 14 | self.emitter = IREmitter() 15 | self.walker = ParseTreeWalker() 16 | self.error_listener = ErrorHandler() 17 | 18 | def parse(self, input): 19 | input_stream = InputStream(input) 20 | lexer = SparqlLexer(input_stream) 21 | lexer.removeErrorListeners() 22 | lexer.addErrorListener(self.error_listener) 23 | 24 | token_stream = CommonTokenStream(lexer) 25 | parser = SparqlParser(token_stream) 26 | parser.removeErrorListeners() 27 | parser.addErrorListener(self.error_listener) 28 | return parser.query() 29 | 30 | def to_ir(self, input): 31 | tree = self.parse(input) 32 | self.walker.walk(self.emitter, tree) 33 | ir = self.emitter.emit(tree) 34 | return ir 35 | -------------------------------------------------------------------------------- /cypher/translator.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.cypher.CypherLexer import CypherLexer 5 | from graphq_trans.cypher.CypherParser import CypherParser 6 | from graphq_trans.cypher.CypherParserListener import CypherParserListener 7 | from graphq_trans.cypher.IREmitter import IREmitter 8 | 9 | from graphq_trans.utils import ErrorHandler 10 | 11 | 12 | class Translator(): 13 | def __init__(self): 14 | self.emitter = IREmitter() 15 | self.walker = ParseTreeWalker() 16 | self.error_listener = ErrorHandler() 17 | 18 | def parse(self, input): 19 | input_stream = InputStream(input) 20 | lexer = CypherLexer(input_stream) 21 | lexer.removeErrorListeners() 22 | lexer.addErrorListener(self.error_listener) 23 | 24 | token_stream = CommonTokenStream(lexer) 25 | parser = CypherParser(token_stream) 26 | parser.removeErrorListeners() 27 | parser.addErrorListener(self.error_listener) 28 | return parser.root() 29 | 30 | def to_ir(self, input): 31 | tree = self.parse(input) 32 | self.walker.walk(self.emitter, tree) 33 | ir = self.emitter.emit(tree) 34 | return ir -------------------------------------------------------------------------------- /overnight/translator.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.overnight.OvernightLexer import OvernightLexer 5 | from graphq_trans.overnight.OvernightParser import OvernightParser 6 | from graphq_trans.overnight.OvernightListener import OvernightListener 7 | from graphq_trans.overnight.IREmitter import IREmitter 8 | 9 | from graphq_trans.utils import ErrorHandler 10 | 11 | 12 | class Translator(): 13 | def __init__(self): 14 | self.emitter = IREmitter() 15 | self.walker = ParseTreeWalker() 16 | self.error_listener = ErrorHandler() 17 | 18 | def parser(self, input): 19 | input_stream = InputStream(input) 20 | lexer = OvernightLexer(input_stream) 21 | lexer.removeErrorListeners() 22 | lexer.addErrorListener(self.error_listener) 23 | 24 | token_stream = CommonTokenStream(lexer) 25 | parser = OvernightParser(token_stream) 26 | parser.removeErrorListeners() 27 | parser.addErrorListener(self.error_listener) 28 | return parser.root() 29 | 30 | def to_ir(self, input): 31 | tree = self.parser(input) 32 | self.walker.walk(self.emitter, tree) 33 | ir = self.emitter.emit(tree) 34 | return ir 35 | 36 | 37 | -------------------------------------------------------------------------------- /kopl/translator.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.kopl.KoplLexer import KoplLexer 5 | from graphq_trans.kopl.KoplParser import KoplParser 6 | from graphq_trans.kopl.KoplListener import KoplListener 7 | from graphq_trans.kopl.IREmitter import IREmitter 8 | 9 | from graphq_trans.utils import ErrorHandler 10 | from graphq_trans.kopl.utils import get_program_seq 11 | 12 | class Translator(): 13 | def __init__(self): 14 | self.emitter = IREmitter() 15 | self.walker = ParseTreeWalker() 16 | self.error_listener = ErrorHandler() 17 | 18 | def parse(self, input): 19 | input_stream = InputStream(input) 20 | lexer = KoplLexer(input_stream) 21 | lexer.removeErrorListeners() 22 | lexer.addErrorListener(self.error_listener) 23 | 24 | token_stream = CommonTokenStream(lexer) 25 | parser = KoplParser(token_stream) 26 | parser.removeErrorListeners() 27 | parser.addErrorListener(self.error_listener) 28 | return parser.root() 29 | 30 | def to_ir(self, input): 31 | input = get_program_seq(input) if isinstance(input, list) else input 32 | tree = self.parse(input) 33 | self.walker.walk(self.emitter, tree) 34 | ir = self.emitter.emit(tree) 35 | return ir 36 | -------------------------------------------------------------------------------- /kopl/Kopl.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | WS=38 39 | STRING_LITERAL=39 40 | INTEGER=40 41 | DECIMAL=41 42 | DOUBLE=42 43 | EXPONENT=43 44 | DIGIT=44 45 | FUNC_SEP=45 46 | IN_FUNC_SEP=46 47 | 'What()'=1 48 | 'Count()'=2 49 | 'FindAll()'=3 50 | 'And()'=4 51 | 'Or()'=5 52 | 'FilterStr('=6 53 | ')'=7 54 | 'FilterNum('=8 55 | 'FilterYear('=9 56 | 'FilterDate('=10 57 | 'QueryRelation()'=11 58 | 'Select('=12 59 | 'QueryAttrUnderCondition('=13 60 | 'QueryAttr('=14 61 | 'VerifyStr('=15 62 | 'VerifyNum('=16 63 | 'VerifyYear('=17 64 | 'VerifyDate('=18 65 | 'QueryAttrQualifier('=19 66 | 'QueryRelationQualifier('=20 67 | 'Relate('=21 68 | 'QFilterStr('=22 69 | 'QFilterNum('=23 70 | 'QFilterYear('=24 71 | 'QFilterDate('=25 72 | 'FilterConcept('=26 73 | 'Find('=27 74 | '='=28 75 | '<'=29 76 | '>'=30 77 | '!='=31 78 | 'largest'=32 79 | 'smallest'=33 80 | 'forward'=34 81 | 'backward'=35 82 | '('=36 83 | '-'=37 84 | ''=45 85 | ''=46 86 | -------------------------------------------------------------------------------- /kopl/KoplLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | WS=38 39 | STRING_LITERAL=39 40 | INTEGER=40 41 | DECIMAL=41 42 | DOUBLE=42 43 | EXPONENT=43 44 | DIGIT=44 45 | FUNC_SEP=45 46 | IN_FUNC_SEP=46 47 | 'What()'=1 48 | 'Count()'=2 49 | 'FindAll()'=3 50 | 'And()'=4 51 | 'Or()'=5 52 | 'FilterStr('=6 53 | ')'=7 54 | 'FilterNum('=8 55 | 'FilterYear('=9 56 | 'FilterDate('=10 57 | 'QueryRelation()'=11 58 | 'Select('=12 59 | 'QueryAttrUnderCondition('=13 60 | 'QueryAttr('=14 61 | 'VerifyStr('=15 62 | 'VerifyNum('=16 63 | 'VerifyYear('=17 64 | 'VerifyDate('=18 65 | 'QueryAttrQualifier('=19 66 | 'QueryRelationQualifier('=20 67 | 'Relate('=21 68 | 'QFilterStr('=22 69 | 'QFilterNum('=23 70 | 'QFilterYear('=24 71 | 'QFilterDate('=25 72 | 'FilterConcept('=26 73 | 'Find('=27 74 | '='=28 75 | '<'=29 76 | '>'=30 77 | '!='=31 78 | 'largest'=32 79 | 'smallest'=33 80 | 'forward'=34 81 | 'backward'=35 82 | '('=36 83 | '-'=37 84 | ''=45 85 | ''=46 86 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | from antlr4.error.ErrorListener import ErrorListener 2 | 3 | class ErrorHandler(ErrorListener): 4 | 5 | __slots__ = [ 'file_name' ] 6 | 7 | def __init__(self, file_name=""): 8 | self.file_name = file_name 9 | 10 | def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e): 11 | print(f"{self.file_name} {line}:{column} {msg}") 12 | 13 | class strictDict(dict): 14 | def __setitem__(self, key, value): 15 | if key not in self: 16 | raise KeyError("{} is not a legal key of this strictDict".format(repr(key))) 17 | dict.__setitem__(self, key, value) 18 | 19 | class entitySet(str): 20 | def __new__(cls, value="", is_atom=False, is_pop=False, concept=None): 21 | return str.__new__(cls, value) 22 | 23 | def __init__(self, value="", is_atom=False, is_pop=False, concept=None): 24 | self.is_atom = is_atom 25 | self.is_pop = is_pop 26 | self.concept = concept 27 | 28 | def reassign(self, value: str): 29 | return entitySet(value, is_atom=self.is_atom, is_pop=self.is_pop) 30 | 31 | def insert(ctx, value, is_atom=False, is_pop=False, concept=None): 32 | if isinstance(ctx.slots["entitySet"], list): 33 | ctx.slots["entitySet"].append(entitySet(value, is_atom=is_atom, is_pop=is_pop, concept=concept)) 34 | else: 35 | ctx.slots["entitySet"] = entitySet(value, is_atom=is_atom, is_pop=is_pop, concept=concept) -------------------------------------------------------------------------------- /overnight/grammar/calendar.grammar: -------------------------------------------------------------------------------- 1 | (include general.grammar) 2 | 3 | # Types 4 | (rule $TypeNP (meeting) (ConstantFn en.meeting)) 5 | (rule $EntityNP1 (weekly standup) (ConstantFn en.meeting.weekly_standup)) 6 | (rule $EntityNP2 (annual review) (ConstantFn en.meeting.annual_review)) 7 | 8 | # Properties 9 | (rule $RelNP (date) (ConstantFn (string date))) 10 | (rule $EntityNP1 (jan 2) (ConstantFn (date 2015 1 2))) 11 | (rule $EntityNP2 (jan 3) (ConstantFn (date 2015 1 3))) 12 | 13 | (rule $RelNP (start time) (ConstantFn (string start_time))) 14 | (rule $RelNP (end time) (ConstantFn (string end_time))) 15 | (rule $EntityNP1 (10am) (ConstantFn (time 10 0))) 16 | (rule $EntityNP2 (3pm) (ConstantFn (time 15 0))) 17 | 18 | (rule $RelNP (length) (ConstantFn (string length))) 19 | (rule $EntityNP1 (three hours) (ConstantFn (number 3 en.hour))) 20 | (rule $EntityNP2 (one hour) (ConstantFn (number 1 en.hour))) 21 | 22 | (rule $RelNP (attendee) (ConstantFn (string attendee))) 23 | (rule $TypeNP (person) (ConstantFn en.person)) 24 | (rule $EntityNP1 (alice) (ConstantFn en.person.alice)) 25 | (rule $EntityNP2 (bob) (ConstantFn en.person.bob)) 26 | 27 | (rule $RelNP (location) (ConstantFn (string location))) 28 | (rule $TypeNP (location) (ConstantFn en.location)) 29 | (rule $EntityNP1 (greenberg cafe) (ConstantFn en.location.greenberg_cafe)) 30 | (rule $EntityNP2 (central office) (ConstantFn en.location.central_office)) 31 | 32 | # Unaries 33 | (rule $VP (is important) (ConstantFn (string is_important))) 34 | -------------------------------------------------------------------------------- /overnight/grammar/recipes.grammar: -------------------------------------------------------------------------------- 1 | # Agile grammar for recipes (based on allrecipes.com) 2 | 3 | (include general.grammar) 4 | 5 | # Types 6 | (rule $TypeNP (recipe) (ConstantFn en.recipe)) 7 | (rule $EntityNP1 (rice pudding) (ConstantFn en.recipe.rice_pudding)) 8 | (rule $EntityNP2 (quiche) (ConstantFn en.recipe.quiche)) 9 | 10 | # Properties 11 | (rule $RelNP (preparation time) (ConstantFn (string preparation_time))) 12 | (rule $RelNP (cooking time) (ConstantFn (string cooking_time))) 13 | (rule $Value (10) (ConstantFn (number 10 en.minute))) 14 | (rule $Value (30) (ConstantFn (number 300 en.minute))) 15 | 16 | (rule $RelNP (cuisine) (ConstantFn (string cuisine))) 17 | (rule $TypeNP (cuisine) (ConstantFn fb:en.cuisine)) 18 | (rule $EntityNP1 (chinese) (ConstantFn (string chinese))) 19 | (rule $EntityNP2 (french) (ConstantFn (string french))) 20 | 21 | (rule $VP/NP (requires) (ConstantFn (string requires))) 22 | (rule $TypeNP (ingredient) (ConstantFn en.ingredient)) 23 | (rule $EntityNP1 (milk) (ConstantFn en.ingredient.milk)) 24 | (rule $EntityNP2 (spinach) (ConstantFn en.ingredient.spinach)) 25 | 26 | (rule $VP/NP (is for) (ConstantFn (string meal))) 27 | (rule $TypeNP (meal) (ConstantFn en.meal)) 28 | (rule $EntityNP1 (lunch) (ConstantFn en.meal.lunch)) 29 | (rule $EntityNP2 (dinner) (ConstantFn en.meal.dinner)) 30 | 31 | (rule $RelNP (posting date) (ConstantFn (string posting_date))) 32 | (rule $EntityNP1 (2004) (ConstantFn (date 2004 -1 -1))) 33 | (rule $EntityNP2 (2010) (ConstantFn (date 2010 -1 -1))) 34 | -------------------------------------------------------------------------------- /ir/IRLexer.tokens: -------------------------------------------------------------------------------- 1 | WS=1 2 | What=2 3 | Select=3 4 | Count=4 5 | Verify=5 6 | Of=6 7 | From=7 8 | To=8 9 | Among=9 10 | Top=10 11 | Ones=11 12 | The=12 13 | Whose=13 14 | That=14 15 | Has=15 16 | Not=16 17 | LB=17 18 | RB=18 19 | Forward=19 20 | Backward=20 21 | And=21 22 | Or=22 23 | Sum=23 24 | Average=24 25 | Is=25 26 | IsNot=26 27 | LargerThan=27 28 | SmallerThan=28 29 | AtLeast=29 30 | AtMost=30 31 | Largest=31 32 | Smallest=32 33 | Text=33 34 | Quantity=34 35 | Date=35 36 | Month=36 37 | Year=37 38 | Time=38 39 | SPACE=39 40 | ES_START=40 41 | ES_END=41 42 | ENTI_START=42 43 | ATTR_START=43 44 | PRED_START=44 45 | CONC_START=45 46 | QUAL_START=46 47 | VALU_START=47 48 | INTEGER=48 49 | DECIMAL=49 50 | DIGIT=50 51 | STRING_LITERAL=51 52 | ENTI_END=52 53 | ATTR_END=53 54 | PRED_END=54 55 | CONC_END=55 56 | QUAL_END=56 57 | VALU_END=57 58 | LITERAL=58 59 | 'which one has the'=3 60 | 'how many'=4 61 | 'whether'=5 62 | 'of'=6 63 | 'from'=7 64 | 'to'=8 65 | 'among'=9 66 | 'top'=10 67 | 'the'=12 68 | 'whose'=13 69 | 'that'=14 70 | 'has'=15 71 | 'not'=16 72 | '('=17 73 | ')'=18 74 | 'forward'=19 75 | 'backward'=20 76 | 'and'=21 77 | 'or'=22 78 | 'sum'=23 79 | 'average'=24 80 | 'at least'=29 81 | 'at most'=30 82 | 'text'=33 83 | 'number'=34 84 | 'date'=35 85 | 'month'=36 86 | 'year'=37 87 | 'time'=38 88 | ' '=39 89 | ''=40 90 | ''=41 91 | ''=42 92 | ''=43 93 | ''=44 94 | ''=45 95 | ''=46 96 | ''=47 97 | ''=52 98 | ''=53 99 | ''=54 100 | ''=55 101 | ''=56 102 | ''=57 103 | -------------------------------------------------------------------------------- /ir/IRParser.tokens: -------------------------------------------------------------------------------- 1 | WS=1 2 | What=2 3 | Select=3 4 | Count=4 5 | Verify=5 6 | Of=6 7 | From=7 8 | To=8 9 | Among=9 10 | Top=10 11 | Ones=11 12 | The=12 13 | Whose=13 14 | That=14 15 | Has=15 16 | Not=16 17 | LB=17 18 | RB=18 19 | Forward=19 20 | Backward=20 21 | And=21 22 | Or=22 23 | Sum=23 24 | Average=24 25 | Is=25 26 | IsNot=26 27 | LargerThan=27 28 | SmallerThan=28 29 | AtLeast=29 30 | AtMost=30 31 | Largest=31 32 | Smallest=32 33 | Text=33 34 | Quantity=34 35 | Date=35 36 | Month=36 37 | Year=37 38 | Time=38 39 | SPACE=39 40 | ES_START=40 41 | ES_END=41 42 | ENTI_START=42 43 | ATTR_START=43 44 | PRED_START=44 45 | CONC_START=45 46 | QUAL_START=46 47 | VALU_START=47 48 | INTEGER=48 49 | DECIMAL=49 50 | DIGIT=50 51 | STRING_LITERAL=51 52 | ENTI_END=52 53 | ATTR_END=53 54 | PRED_END=54 55 | CONC_END=55 56 | QUAL_END=56 57 | VALU_END=57 58 | LITERAL=58 59 | 'which one has the'=3 60 | 'how many'=4 61 | 'whether'=5 62 | 'of'=6 63 | 'from'=7 64 | 'to'=8 65 | 'among'=9 66 | 'top'=10 67 | 'the'=12 68 | 'whose'=13 69 | 'that'=14 70 | 'has'=15 71 | 'not'=16 72 | '('=17 73 | ')'=18 74 | 'forward'=19 75 | 'backward'=20 76 | 'and'=21 77 | 'or'=22 78 | 'sum'=23 79 | 'average'=24 80 | 'at least'=29 81 | 'at most'=30 82 | 'text'=33 83 | 'number'=34 84 | 'date'=35 85 | 'month'=36 86 | 'year'=37 87 | 'time'=38 88 | ' '=39 89 | ''=40 90 | ''=41 91 | ''=42 92 | ''=43 93 | ''=44 94 | ''=45 95 | ''=46 96 | ''=47 97 | ''=52 98 | ''=53 99 | ''=54 100 | ''=55 101 | ''=56 102 | ''=57 103 | -------------------------------------------------------------------------------- /overnight/grammar/basketball.grammar: -------------------------------------------------------------------------------- 1 | (include general.grammar) 2 | 3 | # Types 4 | (rule $TypeNP (player) (ConstantFn en.player)) 5 | (rule $EntityNP1 (kobe bryant) (ConstantFn en.player.kobe_bryant)) 6 | (rule $EntityNP2 (lebron james) (ConstantFn en.player.lebron_james)) 7 | 8 | (rule $TypeNP (team) (ConstantFn en.team)) 9 | (rule $EntityNP1 (los angeles lakers) (ConstantFn en.team.lakers)) 10 | (rule $EntityNP2 (cleveland cavaliers) (ConstantFn en.team.cavaliers)) 11 | 12 | (rule $TypeNP (position) (ConstantFn en.position)) 13 | (rule $EntityNP1 (point guard) (ConstantFn en.position.point_guard)) 14 | (rule $EntityNP2 (forward) (ConstantFn en.position.forward)) 15 | 16 | (rule $EntityNP1 (2004) (ConstantFn (date 2004 -1 -1))) 17 | (rule $EntityNP2 (2010) (ConstantFn (date 2010 -1 -1))) 18 | 19 | (for @x (point assist steal turnover rebound block foul game fg ft) 20 | (rule $EntityNP1 (3) (ConstantFn (number 3 @x))) 21 | #(rule $EntityNP2 (6) (ConstantFn (number 6 @x))) 22 | ) 23 | 24 | # Season statistics 25 | 26 | (rule $Rel0NP (player) (ConstantFn (string player))) 27 | (rule $RelNP (position) (ConstantFn (string position))) 28 | (rule $RelNP (team) (ConstantFn (string team))) 29 | (rule $RelNP (season) (ConstantFn (string season))) 30 | 31 | (rule $RelNP (number of points "(over a season)") (ConstantFn (string num_points))) 32 | (rule $RelNP (number of assists "(over a season)") (ConstantFn (string num_assists))) 33 | (rule $RelNP (number of steals "(over a season)") (ConstantFn (string num_steals))) 34 | (rule $RelNP (number of turnovers "(over a season)") (ConstantFn (string num_turnovers))) 35 | (rule $RelNP (number of rebounds "(over a season)") (ConstantFn (string num_rebounds))) 36 | (rule $RelNP (number of blocks "(over a season)") (ConstantFn (string num_blocks))) 37 | (rule $RelNP (number of fouls "(over a season)") (ConstantFn (string num_fouls))) 38 | (rule $RelNP (number of played games "(over a season)") (ConstantFn (string num_games_played))) 39 | -------------------------------------------------------------------------------- /overnight/grammar/housing.grammar: -------------------------------------------------------------------------------- 1 | # Agile grammar for housing (based on craigslist) 2 | # - What is the price of house? 3 | # - How many apartments are there? 4 | # - Create house with price 225000 5 | # - Move price of house from 225000 to 250000 6 | # - Is there any apartment whose rent is less than 2000 7 | 8 | (include general.grammar) 9 | 10 | # Types 11 | (rule $TypeNP (housing unit) (ConstantFn en.housing_unit)) 12 | (rule $EntityNP1 (123 sesame street) (ConstantFn en.housing_unit.123_sesame_street)) 13 | (rule $EntityNP2 (900 mission ave) (ConstantFn en.housing_unit.900_mission_ave)) 14 | 15 | # Properties 16 | (rule $RelNP (monthly rent) (ConstantFn (string rent))) 17 | (rule $EntityNP1 (1500 dollars) (ConstantFn (number 1500 en.dollar))) 18 | (rule $EntityNP2 (2000 dollars) (ConstantFn (number 2000 en.dollar))) 19 | 20 | (rule $RelNP (size) (ConstantFn (string size))) 21 | (rule $EntityNP1 (800 square feet) (ConstantFn (number 800 en.square_feet))) 22 | (rule $EntityNP2 (1000 square feet) (ConstantFn (number 1000 en.square_feet))) 23 | 24 | (rule $RelNP (posting date) (ConstantFn (string posting_date))) 25 | (rule $EntityNP1 (jan 2) (ConstantFn (date 2015 1 2))) 26 | (rule $EntityNP2 (feb 3) (ConstantFn (date 2015 2 3))) 27 | 28 | (rule $RelNP (neighborhood) (ConstantFn (string neighborhood))) 29 | (rule $TypeNP (neighborhood) (ConstantFn en.neighborhood)) 30 | (rule $EntityNP1 (midtown west) (ConstantFn en.neighborhood.midtown_west)) 31 | (rule $EntityNP2 (chelsea) (ConstantFn en.neighborhood.chelsea)) 32 | 33 | (rule $RelNP (housing type) (ConstantFn (string housing_type))) 34 | (rule $TypeNP (housing type) (ConstantFn en.housing)) 35 | (rule $EntityNP1 (apartment) (ConstantFn en.housing.apartment)) 36 | (rule $EntityNP2 (condo) (ConstantFn en.housing.condo)) 37 | 38 | # Unaries 39 | (rule $VP (allows cats) (ConstantFn (string allows_cats))) 40 | (rule $VP (allows dogs) (ConstantFn (string allows_dogs))) 41 | (rule $VP (has a private bath) (ConstantFn (string has_private_bath))) 42 | (rule $VP (has a private room) (ConstantFn (string has_private_room))) 43 | -------------------------------------------------------------------------------- /cypher/CypherLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar CypherLexer; 2 | 3 | Match 4 | : 'MATCH' 5 | ; 6 | 7 | Where 8 | : 'WHERE' 9 | ; 10 | 11 | Return 12 | : 'RETURN' 13 | ; 14 | 15 | Union 16 | : 'UNION' 17 | ; 18 | 19 | With 20 | : 'WITH' 21 | ; 22 | 23 | As 24 | : 'AS' 25 | ; 26 | 27 | And 28 | : 'AND' 29 | ; 30 | 31 | Or 32 | : 'OR' 33 | ; 34 | 35 | OrderBy 36 | : 'ORDER BY' 37 | ; 38 | 39 | Limit 40 | : 'LIMIT' 41 | ; 42 | 43 | Distinct 44 | : 'DISTINCT' 45 | ; 46 | 47 | CountFunction 48 | : 'count' 49 | ; 50 | 51 | IsEmptyFunction 52 | : 'isEmpty' 53 | ; 54 | 55 | Desc 56 | : 'DESC' 57 | ; 58 | 59 | SEP 60 | : '\'' | '"' 61 | ; 62 | 63 | LP 64 | : '(' 65 | ; 66 | 67 | RP 68 | : ')' 69 | ; 70 | 71 | LB 72 | : '{' 73 | ; 74 | 75 | COL 76 | : ':' 77 | ; 78 | 79 | TORIGHT 80 | : '->' 81 | ; 82 | 83 | TOLEFT 84 | : '<-' 85 | ; 86 | 87 | UND 88 | : '-' 89 | ; 90 | 91 | RB 92 | : '}' 93 | ; 94 | 95 | LSB 96 | : '[' 97 | ; 98 | 99 | RSB 100 | : ']' 101 | ; 102 | 103 | EQ 104 | : '=' 105 | ; 106 | 107 | NEQ 108 | : '<>' 109 | ; 110 | 111 | GTE 112 | : '>=' 113 | ; 114 | 115 | GT 116 | : '>' 117 | ; 118 | 119 | LTE 120 | : '<=' 121 | ; 122 | 123 | LT 124 | : '<' 125 | ; 126 | 127 | DOT 128 | : '.' 129 | ; 130 | 131 | INTEGER 132 | : DIGIT+ 133 | ; 134 | 135 | STRING_SYMBOL 136 | : SYMBOL+ 137 | ; 138 | 139 | STRING_LITERAL 140 | : CHAR+ 141 | ; 142 | 143 | OR 144 | : '|' 145 | ; 146 | 147 | COMMA 148 | : ',' 149 | ; 150 | 151 | fragment 152 | DIGIT 153 | : '0'..'9' 154 | | [\p{Other_Number}] 155 | ; 156 | 157 | fragment 158 | SYMBOL 159 | : '!' | '/' | '?' | '%' | '*' | '¡' | ',' 160 | ; 161 | 162 | fragment 163 | CHAR 164 | : '_' 165 | | [\p{Uppercase_Letter}\p{Lowercase_Letter}] 166 | | [\p{Math_Symbol}\p{Currency_Symbol}] 167 | ; 168 | 169 | WS 170 | : ( '\t' | '\n' | '\r' | ' ' )+ ->skip 171 | ; -------------------------------------------------------------------------------- /overnight/grammar/restaurants.grammar: -------------------------------------------------------------------------------- 1 | # Agile grammar for restaurants (based on yelp) 2 | 3 | (include general.grammar) 4 | 5 | # Types 6 | (rule $TypeNP (restaurant) (ConstantFn en.restaurant)) 7 | (rule $EntityNP1 (thai cafe) (ConstantFn en.restaurant.thai_cafe)) 8 | (rule $EntityNP2 (pizzeria juno) (ConstantFn en.restaurant.pizzeria_juno)) 9 | 10 | # Properties 11 | (rule $RelNP (star rating) (ConstantFn (string star_rating))) 12 | (rule $EntityNP1 (3 stars) (ConstantFn (number 3 en.star))) 13 | (rule $EntityNP2 (5 stars) (ConstantFn (number 5 en.star))) 14 | 15 | (rule $RelNP (price rating) (ConstantFn (string price_rating))) 16 | (rule $EntityNP1 (2 dollar signs) (ConstantFn (number 2 en.dollar_sign))) 17 | (rule $EntityNP2 (3 dollar signs) (ConstantFn (number 3 en.dollar_sign))) 18 | 19 | (rule $RelNP (number of reviews) (ConstantFn (string reviews))) 20 | (rule $EntityNP1 (30 reviews) (ConstantFn (number 30 en.review))) 21 | (rule $EntityNP2 (40 reviews) (ConstantFn (number 40 en.review))) 22 | 23 | (rule $RelNP (neighborhood) (ConstantFn (string neighborhood))) 24 | (rule $TypeNP (neighborhood) (ConstantFn en.neighborhood)) 25 | (rule $EntityNP1 (midtown west) (ConstantFn en.neighborhood.midtown_west)) 26 | (rule $EntityNP2 (chelsea) (ConstantFn en.neighborhood.chelsea)) 27 | 28 | (rule $RelNP (cuisine) (ConstantFn (string cuisine))) 29 | (rule $TypeNP (cuisine) (ConstantFn en.cuisine)) 30 | (rule $EntityNP1 (thai) (ConstantFn en.cuisine.thai)) 31 | (rule $EntityNP2 (italian) (ConstantFn en.cuisine.italian)) 32 | 33 | (rule $VP/NP (serves) (ConstantFn (string meals))) 34 | (rule $TypeNP (meal) (ConstantFn en.food)) 35 | (rule $EntityNP1 (lunch) (ConstantFn en.food.lunch)) 36 | (rule $EntityNP2 (dinner) (ConstantFn en.food.dinner)) 37 | 38 | # Unaries 39 | (rule $VP (takes reservations) (ConstantFn (string reserve))) 40 | (rule $VP (takes credit cards) (ConstantFn (string credit))) 41 | (rule $VP (has outdoor seating) (ConstantFn (string outdoor))) 42 | (rule $VP (has take-out) (ConstantFn (string takeout))) 43 | (rule $VP (has delivery) (ConstantFn (string delivery))) 44 | (rule $VP (has waiter service) (ConstantFn (string waiter))) 45 | (rule $VP (is good for kids) (ConstantFn (string kids))) 46 | (rule $VP (is good for groups) (ConstantFn (string groups))) 47 | -------------------------------------------------------------------------------- /sparql/Sparql.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | T__37=38 39 | T__38=39 40 | T__39=40 41 | T__40=41 42 | T__41=42 43 | T__42=43 44 | T__43=44 45 | T__44=45 46 | T__45=46 47 | T__46=47 48 | T__47=48 49 | T__48=49 50 | T__49=50 51 | T__50=51 52 | T__51=52 53 | T__52=53 54 | T__53=54 55 | T__54=55 56 | T__55=56 57 | T__56=57 58 | T__57=58 59 | T__58=59 60 | T__59=60 61 | IRI_REF=61 62 | PNAME_NS=62 63 | PNAME_LN=63 64 | BLANK_NODE_LABEL=64 65 | VAR1=65 66 | VAR2=66 67 | LANGTAG=67 68 | INTEGER=68 69 | DECIMAL=69 70 | DOUBLE=70 71 | INTEGER_POSITIVE=71 72 | DECIMAL_POSITIVE=72 73 | DOUBLE_POSITIVE=73 74 | INTEGER_NEGATIVE=74 75 | DECIMAL_NEGATIVE=75 76 | DOUBLE_NEGATIVE=76 77 | EXPONENT=77 78 | STRING_LITERAL1=78 79 | STRING_LITERAL2=79 80 | STRING_LITERAL_LONG1=80 81 | STRING_LITERAL_LONG2=81 82 | ECHAR=82 83 | NIL=83 84 | ANON=84 85 | PN_CHARS_U=85 86 | VARNAME=86 87 | PN_PREFIX=87 88 | PN_LOCAL=88 89 | WS=89 90 | 'BASE'=1 91 | 'PREFIX'=2 92 | 'SELECT'=3 93 | 'DISTINCT'=4 94 | 'REDUCED'=5 95 | '*'=6 96 | '('=7 97 | 'COUNT'=8 98 | ')'=9 99 | 'AS'=10 100 | 'CONSTRUCT'=11 101 | 'DESCRIBE'=12 102 | 'ASK'=13 103 | 'FROM'=14 104 | 'NAMED'=15 105 | 'WHERE'=16 106 | 'ORDER'=17 107 | 'BY'=18 108 | 'ASC'=19 109 | 'DESC'=20 110 | 'LIMIT'=21 111 | 'OFFSET'=22 112 | '{'=23 113 | '.'=24 114 | '}'=25 115 | 'OPTIONAL'=26 116 | 'GRAPH'=27 117 | 'UNION'=28 118 | 'FILTER'=29 119 | ','=30 120 | ';'=31 121 | 'a'=32 122 | '['=33 123 | ']'=34 124 | '||'=35 125 | '&&'=36 126 | '='=37 127 | '!='=38 128 | '<'=39 129 | '>'=40 130 | '<='=41 131 | '>='=42 132 | '+'=43 133 | '-'=44 134 | '/'=45 135 | '!'=46 136 | 'STR'=47 137 | 'LANG'=48 138 | 'LANGMATCHES'=49 139 | 'DATATYPE'=50 140 | 'BOUND'=51 141 | 'sameTerm'=52 142 | 'isIRI'=53 143 | 'isURI'=54 144 | 'isBLANK'=55 145 | 'isLITERAL'=56 146 | 'REGEX'=57 147 | '^^'=58 148 | 'true'=59 149 | 'false'=60 150 | -------------------------------------------------------------------------------- /sparql/SparqlLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | T__37=38 39 | T__38=39 40 | T__39=40 41 | T__40=41 42 | T__41=42 43 | T__42=43 44 | T__43=44 45 | T__44=45 46 | T__45=46 47 | T__46=47 48 | T__47=48 49 | T__48=49 50 | T__49=50 51 | T__50=51 52 | T__51=52 53 | T__52=53 54 | T__53=54 55 | T__54=55 56 | T__55=56 57 | T__56=57 58 | T__57=58 59 | T__58=59 60 | T__59=60 61 | IRI_REF=61 62 | PNAME_NS=62 63 | PNAME_LN=63 64 | BLANK_NODE_LABEL=64 65 | VAR1=65 66 | VAR2=66 67 | LANGTAG=67 68 | INTEGER=68 69 | DECIMAL=69 70 | DOUBLE=70 71 | INTEGER_POSITIVE=71 72 | DECIMAL_POSITIVE=72 73 | DOUBLE_POSITIVE=73 74 | INTEGER_NEGATIVE=74 75 | DECIMAL_NEGATIVE=75 76 | DOUBLE_NEGATIVE=76 77 | EXPONENT=77 78 | STRING_LITERAL1=78 79 | STRING_LITERAL2=79 80 | STRING_LITERAL_LONG1=80 81 | STRING_LITERAL_LONG2=81 82 | ECHAR=82 83 | NIL=83 84 | ANON=84 85 | PN_CHARS_U=85 86 | VARNAME=86 87 | PN_PREFIX=87 88 | PN_LOCAL=88 89 | WS=89 90 | 'BASE'=1 91 | 'PREFIX'=2 92 | 'SELECT'=3 93 | 'DISTINCT'=4 94 | 'REDUCED'=5 95 | '*'=6 96 | '('=7 97 | 'COUNT'=8 98 | ')'=9 99 | 'AS'=10 100 | 'CONSTRUCT'=11 101 | 'DESCRIBE'=12 102 | 'ASK'=13 103 | 'FROM'=14 104 | 'NAMED'=15 105 | 'WHERE'=16 106 | 'ORDER'=17 107 | 'BY'=18 108 | 'ASC'=19 109 | 'DESC'=20 110 | 'LIMIT'=21 111 | 'OFFSET'=22 112 | '{'=23 113 | '.'=24 114 | '}'=25 115 | 'OPTIONAL'=26 116 | 'GRAPH'=27 117 | 'UNION'=28 118 | 'FILTER'=29 119 | ','=30 120 | ';'=31 121 | 'a'=32 122 | '['=33 123 | ']'=34 124 | '||'=35 125 | '&&'=36 126 | '='=37 127 | '!='=38 128 | '<'=39 129 | '>'=40 130 | '<='=41 131 | '>='=42 132 | '+'=43 133 | '-'=44 134 | '/'=45 135 | '!'=46 136 | 'STR'=47 137 | 'LANG'=48 138 | 'LANGMATCHES'=49 139 | 'DATATYPE'=50 140 | 'BOUND'=51 141 | 'sameTerm'=52 142 | 'isIRI'=53 143 | 'isURI'=54 144 | 'isBLANK'=55 145 | 'isLITERAL'=56 146 | 'REGEX'=57 147 | '^^'=58 148 | 'true'=59 149 | 'false'=60 150 | -------------------------------------------------------------------------------- /cypher/CypherParser.g4: -------------------------------------------------------------------------------- 1 | parser grammar CypherParser; 2 | 3 | options { tokenVocab = CypherLexer; } 4 | 5 | root 6 | : queryBlock (Union queryBlock)* limitClause? EOF 7 | ; 8 | 9 | queryBlock 10 | : matchClause+ returnClause orderByClause? 11 | ; 12 | 13 | matchClause 14 | : Match path ( Where constraint )? 15 | | Match path ( Where LP constraint (logicOP constraint)+ RP ) 16 | ; 17 | 18 | returnClause 19 | : Return Distinct? ( specialQuery | variableAttribute | variable ) ( As alias )? 20 | ; 21 | 22 | specialQuery 23 | : queryFunction LP ( variableAttribute | variable ) RP 24 | ; 25 | 26 | queryFunction 27 | : CountFunction 28 | | IsEmptyFunction 29 | ; 30 | 31 | orderByClause 32 | : OrderBy (variableAttribute | variable) Desc? 33 | ; 34 | 35 | limitClause 36 | : Limit INTEGER 37 | ; 38 | 39 | path 40 | : node ( ( ( TOLEFT relationship? UND ) | ( UND relationship? UND ) | ( UND relationship? TORIGHT ) ) node )* 41 | ; 42 | 43 | node 44 | : LP variable? ( COL nodeLabel )+ propertyConstraint? RP 45 | | LP variable ( COL nodeLabel )* propertyConstraint? RP 46 | ; 47 | 48 | nodeLabel 49 | : varString 50 | ; 51 | 52 | propertyConstraint 53 | : LB nodeOrRelationshipProperty ( COMMA nodeOrRelationshipProperty )* RB 54 | ; 55 | 56 | relationship 57 | : LSB variable? COL relationshipLabel ( OR COL relationshipLabel )? propertyConstraint? RSB 58 | | LSB variable ( COL relationshipLabel ( OR COL relationshipLabel )? propertyConstraint? )? RSB 59 | ; 60 | 61 | relationshipLabel 62 | : varString 63 | ; 64 | 65 | constraint 66 | : ( variableAttribute | variable ) symbolOP value 67 | ; 68 | 69 | alias 70 | : variable 71 | ; 72 | 73 | symbolOP 74 | : EQ 75 | | NEQ 76 | | GTE 77 | | GT 78 | | LTE 79 | | LT 80 | ; 81 | 82 | logicOP 83 | : And 84 | | Or 85 | ; 86 | variable 87 | : varString 88 | ; 89 | 90 | variableAttribute 91 | : variable DOT variable 92 | ; 93 | 94 | nodeOrRelationshipProperty 95 | : variable COL value 96 | ; 97 | 98 | value 99 | : string 100 | | SEP string SEP 101 | ; 102 | 103 | varString 104 | : ( STRING_LITERAL | INTEGER )+ 105 | ; 106 | 107 | string 108 | : ( STRING_LITERAL | STRING_SYMBOL | INTEGER | DOT )+ 109 | ; 110 | -------------------------------------------------------------------------------- /ir/translator.py: -------------------------------------------------------------------------------- 1 | from antlr4 import * 2 | from antlr4.InputStream import InputStream 3 | 4 | from graphq_trans.ir.IRLexer import IRLexer 5 | from graphq_trans.ir.IRParser import IRParser 6 | from graphq_trans.ir.IRParserListener import IRParserListener 7 | 8 | from graphq_trans.ir.SparqlEmitter import SparqlEmitter 9 | from graphq_trans.ir.OvernightEmitter import OvernightEmitter, overnight_domains 10 | from graphq_trans.ir.CypherEmitter import CypherEmitter 11 | from graphq_trans.ir.KoplEmitter import KoplEmitter 12 | 13 | from graphq_trans.utils import ErrorHandler 14 | 15 | 16 | def post_process_ir(ir): 17 | for token in ["","","","","","","","","","","","","",""]: 18 | ir = ir.replace(" {}".format(token), token) 19 | ir = ir.replace("{} ".format(token), token) 20 | return ir 21 | 22 | 23 | class Translator(): 24 | def __init__(self, ungrounded=False): 25 | self.sparql_emitter = SparqlEmitter() 26 | self.kopl_emitter = KoplEmitter() 27 | self.overnight_emitter = OvernightEmitter(ungrounded) 28 | self.cypher_emitter = CypherEmitter() 29 | self.walker = ParseTreeWalker() 30 | self.error_listener = ErrorHandler() 31 | 32 | def set_domain(self, domain_idx): 33 | assert domain_idx < len(overnight_domains) 34 | self.overnight_emitter.set_domain(overnight_domains[domain_idx]) 35 | 36 | def parse(self, input): 37 | input_stream = InputStream(input) 38 | lexer = IRLexer(input_stream) 39 | lexer.removeErrorListeners() 40 | lexer.addErrorListener(self.error_listener) 41 | 42 | token_stream = CommonTokenStream(lexer) 43 | parser = IRParser(token_stream) 44 | parser.removeErrorListeners() 45 | parser.addErrorListener(self.error_listener) 46 | return parser.root() 47 | 48 | def to_sparql(self, input): 49 | input = post_process_ir(input) 50 | tree = self.parse(input) 51 | self.walker.walk(self.sparql_emitter, tree) 52 | logical_form = self.sparql_emitter.emit(tree) 53 | return logical_form 54 | 55 | def to_kopl(self, input): 56 | input = post_process_ir(input) 57 | tree = self.parse(input) 58 | self.walker.walk(self.kopl_emitter, tree) 59 | logical_form = self.kopl_emitter.emit(tree) 60 | return logical_form 61 | 62 | def to_overnight(self, input, domain_idx=None): 63 | if domain_idx != None and self.overnight_emitter.domain != overnight_domains[domain_idx]: 64 | self.set_domain(domain_idx) 65 | tree = self.parse(input) 66 | self.walker.walk(self.overnight_emitter, tree) 67 | logical_form = self.overnight_emitter.emit(tree) 68 | return logical_form 69 | 70 | def to_cypher(self, input): 71 | tree = self.parse(input) 72 | self.walker.walk(self.cypher_emitter, tree) 73 | logical_form = self.cypher_emitter.emit(tree) 74 | return logical_form -------------------------------------------------------------------------------- /overnight/grammar/socialnetwork.grammar: -------------------------------------------------------------------------------- 1 | # Agile grammar for social network (think Facebook Graph Search) 2 | 3 | (include general.grammar) 4 | 5 | # Types 6 | (rule $TypeNP (person) (ConstantFn en.person)) 7 | (rule $EntityNP1 (alice) (ConstantFn en.person.alice)) 8 | (rule $EntityNP2 (bob) (ConstantFn en.person.bob)) 9 | 10 | (rule $VP/NP (is friends with) (ConstantFn (string friend))) 11 | 12 | # Properties 13 | (rule $RelNP (birthdate) (ConstantFn (string birthdate))) 14 | (rule $EntityNP1 (2004) (ConstantFn (date 2004 -1 -1))) 15 | (rule $EntityNP2 (2010) (ConstantFn (date 2010 -1 -1))) 16 | 17 | (rule $RelNP (gender) (ConstantFn (string gender))) 18 | (rule $TypeNP (gender) (ConstantFn en.gender)) 19 | (rule $EntityNP1 (male) (ConstantFn en.gender.male)) 20 | (rule $EntityNP2 (female) (ConstantFn en.gender.female)) 21 | 22 | (rule $RelNP (relationship status) (ConstantFn (string relationship_status))) 23 | (rule $TypeNP (relationship status) (ConstantFn en.relationship_status)) 24 | (rule $EntityNP1 (single) (ConstantFn en.relationship_status.single)) 25 | (rule $EntityNP2 (married) (ConstantFn en.relationship_status.married)) 26 | 27 | (rule $RelNP (birthplace) (ConstantFn (string birthplace))) 28 | (rule $TypeNP (city) (ConstantFn en.city)) 29 | (rule $EntityNP1 (new york) (ConstantFn en.city.new_york)) 30 | (rule $EntityNP2 (beijing) (ConstantFn en.city.bejing)) 31 | 32 | (rule $RelNP (height) (ConstantFn (string height))) 33 | (rule $EntityNP1 (180 cm) (ConstantFn (number 180 en.cm))) 34 | (rule $EntityNP2 (200 cm) (ConstantFn (number 200 en.cm))) 35 | 36 | # Education 37 | #(rule $EventNP (education) (ConstantFn (call @getProperty (call @singleton en.education) (string !type)))) # for debugging 38 | 39 | (rule $Rel0NP (student) (ConstantFn (string student))) 40 | 41 | (rule $RelNP (university) (ConstantFn (string university))) 42 | (rule $TypeNP (university) (ConstantFn en.university)) 43 | (rule $EntityNP1 (brown university) (ConstantFn en.university.brown)) 44 | (rule $EntityNP2 (ucla) (ConstantFn en.university.ucla)) 45 | 46 | (rule $RelNP (field of study) (ConstantFn (string field_of_study))) 47 | (rule $TypeNP (field) (ConstantFn en.field)) 48 | (rule $EntityNP1 (computer science) (ConstantFn en.field.computer_science)) 49 | (rule $EntityNP2 (history) (ConstantFn en.field.history)) 50 | 51 | (rule $RelNP (start date) (ConstantFn (string education_start_date))) 52 | (rule $RelNP (end date) (ConstantFn (string education_end_date))) 53 | 54 | # Employment 55 | 56 | (rule $Rel0NP (employee) (ConstantFn (string employee))) 57 | 58 | (rule $RelNP (employer) (ConstantFn (string employer))) 59 | (rule $TypeNP (company) (ConstantFn en.company)) 60 | (rule $EntityNP1 (mckinsey) (ConstantFn en.company.mckinsey)) 61 | (rule $EntityNP2 (google) (ConstantFn en.company.google)) 62 | 63 | (rule $RelNP (job title) (ConstantFn (string job_title))) 64 | (rule $TypeNP (job title) (ConstantFn en.job_title)) 65 | (rule $EntityNP1 (software engineer) (ConstantFn en.job_title.software_engineer)) 66 | (rule $EntityNP2 (program manager) (ConstantFn en.job_title.program_manager)) 67 | 68 | (rule $RelNP (start date) (ConstantFn (string employment_start_date))) 69 | (rule $RelNP (end date) (ConstantFn (string employment_end_date))) 70 | 71 | # Unaries 72 | (rule $VP (is logged in) (ConstantFn (string logged_in))) 73 | -------------------------------------------------------------------------------- /ir/IRLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar IRLexer; 2 | 3 | WS 4 | : ( '\t' | '\n' | '\r' )+ ->skip 5 | ; 6 | 7 | What 8 | : 'what is the attribute' 9 | | 'what is the relation' 10 | | 'what is the qualifier' 11 | | 'what is' 12 | | 'what' 13 | ; 14 | 15 | Select 16 | : 'which one has the' 17 | ; 18 | 19 | Count 20 | : 'how many' 21 | ; 22 | 23 | Verify 24 | : 'whether' 25 | ; 26 | 27 | Of 28 | : 'of' 29 | ; 30 | 31 | From 32 | : 'from' 33 | ; 34 | 35 | To 36 | : 'to' 37 | ; 38 | 39 | Among 40 | : 'among' 41 | ; 42 | 43 | Top 44 | : 'top' 45 | ; 46 | 47 | Ones 48 | : 'ones' | 'entities' 49 | ; 50 | 51 | The 52 | : 'the' 53 | ; 54 | 55 | Whose 56 | : 'whose' 57 | ; 58 | 59 | That 60 | : 'that' 61 | ; 62 | 63 | Has 64 | : 'has' 65 | ; 66 | 67 | Not 68 | : 'not' 69 | ; 70 | 71 | LB 72 | : '(' 73 | ; 74 | 75 | RB 76 | : ')' 77 | ; 78 | 79 | Forward 80 | : 'forward' 81 | ; 82 | 83 | Backward 84 | : 'backward' 85 | ; 86 | 87 | And 88 | : 'and' 89 | ; 90 | 91 | Or 92 | : 'or' 93 | ; 94 | 95 | Sum 96 | : 'sum' 97 | ; 98 | 99 | Average 100 | : 'average' 101 | ; 102 | 103 | Is 104 | : 'is' | 'equal to' 105 | ; 106 | 107 | IsNot 108 | : 'not is' | 'is not' | 'not equal to' 109 | ; 110 | 111 | LargerThan 112 | : 'larger than' | 'more than' 113 | ; 114 | 115 | SmallerThan 116 | : 'smaller than' | 'less than' 117 | ; 118 | 119 | AtLeast 120 | : 'at least' 121 | ; 122 | 123 | AtMost 124 | : 'at most' 125 | ; 126 | 127 | Largest 128 | : 'largest' | 'most' 129 | ; 130 | 131 | Smallest 132 | : 'smallest' | 'least' 133 | ; 134 | 135 | Text 136 | : 'text' 137 | ; 138 | 139 | Quantity 140 | : 'number' 141 | ; 142 | 143 | Date 144 | : 'date' 145 | ; 146 | 147 | Month 148 | : 'month' 149 | ; 150 | 151 | Year 152 | : 'year' 153 | ; 154 | 155 | Time 156 | : 'time' 157 | ; 158 | 159 | SPACE 160 | : ' ' ->skip 161 | ; 162 | 163 | ES_START 164 | : '' 165 | ; 166 | 167 | ES_END 168 | : '' 169 | ; 170 | 171 | ENTI_START 172 | : '' -> mode(VAR) 173 | ; 174 | 175 | ATTR_START 176 | : '' -> mode(VAR) 177 | ; 178 | 179 | PRED_START 180 | : '' -> mode(VAR) 181 | ; 182 | 183 | CONC_START 184 | : '' -> mode(VAR) 185 | ; 186 | 187 | QUAL_START 188 | : '' -> mode(VAR) 189 | ; 190 | 191 | VALU_START 192 | : '' -> mode(VAR) 193 | ; 194 | 195 | INTEGER 196 | : DIGIT+ 197 | ; 198 | 199 | DECIMAL 200 | : DIGIT+ '.' DIGIT* 201 | | '.' DIGIT+ 202 | ; 203 | 204 | DIGIT 205 | : DIGIT_BASE 206 | ; 207 | 208 | STRING_LITERAL 209 | : ( CHARS_BASE | DIGIT | UNICODE )+ 210 | ; 211 | 212 | fragment 213 | DIGIT_BASE 214 | : '0'..'9' 215 | ; 216 | 217 | fragment 218 | CHARS_BASE 219 | : 'A'..'Z' 220 | | 'a'..'z' 221 | | '?' | '!' | '.' | ',' | '/' | ':' | '_' | '-' 222 | ; 223 | 224 | fragment 225 | UNICODE 226 | : ~( '(' | ')' | '<' | '>' | ' ' ) 227 | ; 228 | 229 | mode VAR; 230 | 231 | ENTI_END 232 | : '' -> mode(DEFAULT_MODE) 233 | ; 234 | 235 | ATTR_END 236 | : '' -> mode(DEFAULT_MODE) 237 | ; 238 | 239 | PRED_END 240 | : '' -> mode(DEFAULT_MODE) 241 | ; 242 | 243 | CONC_END 244 | : '' -> mode(DEFAULT_MODE) 245 | ; 246 | 247 | QUAL_END 248 | : '' -> mode(DEFAULT_MODE) 249 | ; 250 | 251 | VALU_END 252 | : '' -> mode(DEFAULT_MODE) 253 | ; 254 | 255 | LITERAL 256 | : ANY_CHAR+ 257 | ; 258 | 259 | fragment 260 | ANY_CHAR 261 | : ~( '<' | '>' ) 262 | ; -------------------------------------------------------------------------------- /cypher/utils.py: -------------------------------------------------------------------------------- 1 | from graphq_trans.utils import * 2 | 3 | 4 | class EntitySet: 5 | def __init__(self, var=None, label=None, concept=None): 6 | self._var = var 7 | self._label = label 8 | self._concept = concept 9 | self.__atom = "" 10 | self.init_atom() 11 | 12 | self.related_es = {} 13 | self.related_attr = {} 14 | 15 | def init_atom(self): 16 | if not self._label and not self._concept: 17 | self.__atom = "ones" 18 | elif not self._concept: 19 | self.__atom = " {} ".format(self._label) 20 | elif not self._label: 21 | self.__atom = " {} ".format(self._concept) 22 | else: 23 | self.__atom = " {} {} ".format(self._concept, self._label) 24 | 25 | def add_related_es(self, predicate, edge_var, direction, es, qualifier_constraints: list): 26 | assert isinstance(es, EntitySet) 27 | if es not in self.related_es.keys(): 28 | self.related_es[es] = {"predicate": predicate, "edge_var": edge_var, "direction": direction, 29 | "entitySet": es, "qualifier": qualifier_constraints} 30 | else: 31 | raise Exception("this entitySet has already been added!") 32 | 33 | def add_related_attr(self, attr, symOP, v_type, val): 34 | if attr == "name": 35 | self.set_label(val) 36 | else: 37 | if attr not in self.related_attr.keys(): 38 | self.related_attr[attr] = [] 39 | self.related_attr[attr].append([attr, symOP, v_type, val]) 40 | 41 | def get_ir(self, forbidden=[]): 42 | atom = self.__atom 43 | filtersByAttr = sorted(list(self.related_attr.values()), key=lambda x: len(x), reverse=True) 44 | for filt in filtersByAttr: 45 | while len(filt) != 0: 46 | atom = " " + atom + " whose {} {} {} {} ".format(*filt.pop()) 47 | 48 | ir = "" 49 | 50 | for key in self.related_es.keys(): 51 | if key not in forbidden: 52 | if self.related_es[key]["direction"] in ["forward", "backward"]: 53 | new_ir = "" 54 | ir_atom = atom + " that {} {} to {}".format( 55 | self.related_es[key]["predicate"], 56 | self.related_es[key]["direction"], 57 | self.related_es[key]["entitySet"].get_ir([self]) 58 | ) 59 | ir_atoms = [] 60 | for attr, sym, v_type, val in self.related_es[key]["qualifier"]: 61 | ir_atoms.append(" " + ir_atom + " ( {} {} {} {} )".format( 62 | attr, sym, v_type, val 63 | )) 64 | 65 | if len(ir_atoms) == 0: 66 | new_ir = " {} ".format(ir_atom) 67 | else: 68 | new_ir = ir_atoms.pop() 69 | while len(ir_atoms): 70 | new_ir = " {} and {} ".format(new_ir, ir_atoms.pop()) 71 | 72 | if ir == "": 73 | ir = new_ir 74 | else: 75 | ir = " {} and {} ".format(ir, new_ir) 76 | else: 77 | raise Exception("Current GraphQ IR does not support undirected edge!") 78 | 79 | if not ir: 80 | ir = atom 81 | 82 | return ir 83 | 84 | def set_label(self, label): 85 | self._label = label 86 | self.init_atom() 87 | 88 | def set_concept(self, concept): 89 | self._concept = concept 90 | self.init_atom() 91 | 92 | @property 93 | def label(self): 94 | return self._label 95 | 96 | @property 97 | def concept(self): 98 | return self._concept 99 | 100 | @property 101 | def var(self): 102 | return self._var 103 | 104 | -------------------------------------------------------------------------------- /ir/IRParser.g4: -------------------------------------------------------------------------------- 1 | parser grammar IRParser; 2 | 3 | options { tokenVocab = IRLexer; } 4 | 5 | root 6 | : ( entityQuery 7 | | attributeQuery 8 | | predicateQuery 9 | | qualifierQuery 10 | | countQuery 11 | | verifyQuery 12 | | selectQuery 13 | | valueQuery ) EOF 14 | ; 15 | 16 | entityQuery 17 | : What entitySet 18 | ; 19 | 20 | attributeQuery 21 | : What attribute Of entitySet 22 | ; 23 | 24 | predicateQuery 25 | : What From entitySet To entitySet 26 | ; 27 | 28 | qualifierQuery 29 | : What qualifier Of verify 30 | ; 31 | 32 | countQuery 33 | : Count entitySet 34 | ; 35 | 36 | verifyQuery 37 | : Verify verify 38 | ; 39 | 40 | selectQuery 41 | : Select filterByRank Among entitySet 42 | ; 43 | 44 | valueQuery 45 | : What valueSet 46 | ; 47 | 48 | verify 49 | : entitySet filterByAttribute filterByQualifier? #verifyByAttribute 50 | | entitySet filterByPredicate entitySet filterByQualifier? #verifyByPredicate 51 | ; 52 | 53 | // entitySet 54 | // : ES_START entitySet setOP entitySet ES_END #entitySetGroup 55 | // | ES_START filterFromAll ES_END #entitySetFromAll 56 | // | ES_START filterFromEntitySet ES_END #entitySetNested 57 | // | entity #entitySetAtom 58 | // ; 59 | 60 | // filterFromEntitySet 61 | // : The concept filterByPredicate entitySet filterByQualifier? 62 | // | The One filterByPredicate entitySet filterByQualifier? 63 | // | concept? entitySet filterByAttribute filterByQualifier? 64 | // // | entitySet filterByPredicate entitySet 65 | // ; 66 | 67 | // filterFromAll 68 | // : concept? filterByAttribute filterByQualifier? 69 | // | concept 70 | // ; 71 | 72 | entitySet 73 | : ES_START entitySet setOP entitySet ES_END #entitySetGroup 74 | | ES_START entitySet LB entitySet RB ES_END #entitySetIntersect 75 | | ES_START filterFromEntitySet ES_END #entitySetFilter 76 | | entity #entitySetAtom 77 | | Ones #entitySetPlaceholder 78 | ; 79 | 80 | filterFromEntitySet 81 | : ( concept entitySet? | concept? entitySet ) filterByAttribute filterByQualifier? #entitySetByAttribute 82 | | ( concept entitySet? | concept? entitySet ) filterByPredicate entitySet filterByQualifier? #entitySetByPredicate 83 | | concept entitySet? #entitySetByConcept 84 | | entitySet filterByRank #entitySetByRank 85 | ; 86 | 87 | filterByRank 88 | : ( That Has )? ( Top number )? stringOP attribute 89 | ; 90 | 91 | filterByAttribute 92 | : Whose? attribute symbolOP valueSet 93 | ; 94 | 95 | filterByPredicate 96 | : That? logicGate? predicate direction? To 97 | | That? logicGate? predicate direction? To symbolOP? valueSet 98 | | That? logicGate? predicate direction? To stringOP 99 | ; 100 | 101 | filterByQualifier 102 | : LB qualifier symbolOP valueSet RB 103 | ; 104 | 105 | direction 106 | : Forward #forward 107 | | Backward #backward 108 | ; 109 | 110 | setOP 111 | : And #and 112 | | Or #or 113 | ; 114 | 115 | logicGate 116 | : Not #not 117 | ; 118 | 119 | symbolOP 120 | : IsNot #notEqual 121 | | Not #notEqual 122 | | Is #equal 123 | | LargerThan #larger 124 | | SmallerThan #smaller 125 | | AtLeast #largerEqual 126 | | AtMost #smallerEqual 127 | ; 128 | 129 | stringOP 130 | : Largest #largest 131 | | Smallest #smallest 132 | ; 133 | 134 | aggregateOP 135 | : Sum #sum 136 | | Average #average 137 | ; 138 | 139 | valueSet 140 | : valueType valueSet Or valueSet #valueByUnion 141 | | aggregateOP Of valueSet #valueByAggregate 142 | | attribute Of entitySet #valueByAttribute 143 | | valueType? value #valueAtom 144 | ; 145 | 146 | valueType 147 | : Text #text 148 | | Quantity #quantity 149 | | Date #date 150 | | Month #Month 151 | | Year #year 152 | | Time #time 153 | ; 154 | 155 | entity 156 | : ENTI_START string ENTI_END 157 | ; 158 | 159 | attribute 160 | : ATTR_START string ATTR_END 161 | ; 162 | 163 | concept 164 | : CONC_START string CONC_END 165 | ; 166 | 167 | predicate 168 | : PRED_START string PRED_END 169 | ; 170 | 171 | qualifier 172 | : QUAL_START string QUAL_END 173 | ; 174 | 175 | value 176 | : VALU_START string VALU_END 177 | ; 178 | 179 | number 180 | : INTEGER 181 | ; 182 | 183 | string 184 | : ( ' ' | STRING_LITERAL | LB string RB | LITERAL )+ 185 | ; 186 | 187 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Icon](./docs/imgs/icon.png) 2 | 3 | [![Downloads](https://static.pepy.tech/badge/graphq_trans)](https://pepy.tech/project/graphq_trans) 4 | [![Downloads](https://static.pepy.tech/badge/graphq_trans/month)](https://pepy.tech/project/graphq_trans) 5 | [![Contributions Welcome](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg?style=flat)](https://github.com/flitternie/graphq_trans/issues) 6 | [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 7 | 8 | 9 | GraphQ Trans is a source-to-source compiler that supports the transpilation among multiple graph query languages via a unified intermediate representation. You may install this package via pip: 10 | 11 | ```bash 12 | pip install graphq-trans 13 | ``` 14 | 15 | For our demonstration website, please visit https://graphqtrans.xlore.cn/ 16 | 17 | ## Setup Environment 18 | 19 | This package has the following dependencies: 20 | 21 | * Python >= 3.6.2 22 | 23 | * ANTLR >= 4.9.2 24 | 25 | * antlr4-python3-runtime >= 4.9.2 26 | 27 | This toolkit relies on [ANTLR4](https://github.com/antlr/antlr4) for front-end analysis, please refer to their [tutorial](https://github.com/antlr/antlr4/blob/master/doc/getting-started.md) for setup. 28 | 29 | ## Quick Start 30 | 31 | GraphQ Trans provides a set of easy-to-use APIs for transpiling graph query languages. Here's a simple example of how to use the toolkit to convert between two graph query languages: 32 | 33 | ```python 34 | from graphq_trans.sparql.translator import Translator as SparqlTranslator 35 | from graphq_trans.ir.translator import Translator as IRTranslator 36 | 37 | sparql_translator = SparqlTranslator() # Create a SparqlTranslator that translates SPARQL to graphqIR 38 | ir_translator = IRTranslator() # Create a IRTranslator that translates graphqIR to Cypher 39 | 40 | # the SPARQL query for "Get all entities that are human" 41 | sparql_query = 'SELECT DISTINCT ?e WHERE { ?e ?c . ?c "human" } ' 42 | 43 | ir = sparql_translator.to_ir(sparql_query) # translates sparql to ir 44 | cypher_query = ir_translator.to_cypher(ir) # translates ir to cypher 45 | print(cypher_query) 46 | ``` 47 | 48 | The returned Cypher query will be: 49 | 50 | ```cypher 51 | MATCH (n1:human) 52 | RETURN n1.name 53 | ``` 54 | 55 | 56 | ## Style Requirement 57 | ### SPARQL 58 | 59 | Our SPARQL naming rules are adopted from KBQA dataset [KQA Pro](http://thukeg.gitee.io/kqa-pro/). For variables, we have 60 | 61 | | Schema | Naming Style | Example | 62 | |-----------|---------------------|---------------------------------| 63 | | Entity | ?e, ?e_1, ?e_2, ... | ?e_1 \ "British" . | 64 | | Concept | ?c, ?c_1, ?c_2, ... | ?c \ "human" . | 65 | | Predicate | ?r, ?r_1, ?r_2, ... | ?e ?r ?e_1 . | 66 | | Attribute | ?pv, ?pv_1, ... | ?e_2 \ ?pv_3 . | 67 | | Value | ?v, ?v_1, ?v_2, ... | ?pv \ ?v_1 . | 68 | 69 | For common predicates, we have 70 | 71 | | Predicate | Format | Example | 72 | |-------------|---------------------|-------------------------------------| 73 | | Label | \ | ?e_1 \ "British" . | 74 | | Instance of | \ | ?c \ "human" . | 75 | | Value is | \ | ?pv \ "42"^^xsd:double. | 76 | | Unit | \ | ?pv \ "month" . | 77 | 78 | ### Cypher 79 | For convenience of KBQA, we design the transpiler based on the need of getting the labels directly. Therefore, to query variable _**x**_, please use 80 | 81 | ```cypher 82 | ... 83 | RETURN x.name 84 | ... 85 | ``` 86 | ### KoPL 87 | For KoPL, we support all styles that satisfy the language grammar. Please refer to their repository for detailed documentation: https://github.com/THU-KEG/KoPL 88 | 89 | ### Lambda-DCS 90 | For lambda-DCS, please refers to the original paper [(Liang, 2013)](https://arxiv.org/abs/1309.4408) for more specific instructions 91 | 92 | ## Citation 93 | 94 | If you find our work helpful, please cite it as follows: 95 | 96 | ``` 97 | @inproceedings{nie2022graphq, 98 | title={GraphQ IR: Unifying the Semantic Parsing of Graph Query Languages with One Intermediate Representation}, 99 | author={Nie, Lunyiu and Cao, Shulin and Shi, Jiaxin and Sun, Jiuding and Tian, Qi and Hou, Lei and Li, Juanzi and Zhai, Jidong}, 100 | booktitle={Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing}, 101 | pages={5848--5865}, 102 | year={2022} 103 | } 104 | ``` 105 | 106 | -------------------------------------------------------------------------------- /overnight/Overnight.g4: -------------------------------------------------------------------------------- 1 | grammar Overnight; 2 | 3 | root 4 | : LB listValue np RB 5 | ; 6 | 7 | np 8 | : cp #CPNP 9 | | entity #entityNP 10 | | LB getProperty np relNP RB #getPropertyNP 11 | | value #numericNP 12 | | LB concat np np RB #concatNP 13 | | LB aggregate aggregateType np #aggregateNP 14 | | LB size np RB #sizeNP 15 | | LB getProperty LB cp LB domain relNP RB RB relNP RB #domainCPNP 16 | | constraintNP #filterNP 17 | ; 18 | 19 | // type + CP (through typeConstraintNP) 20 | // relNP + CP (through domainCPNP) 21 | // reversePredicate + CP (through eventConstraintNP) 22 | 23 | entity 24 | : LB? 'en.' string '.' string RB? 25 | ; 26 | 27 | concept 28 | : LB? 'en.' string RB? 29 | ; 30 | 31 | predicate 32 | : LB 'string' string RB // we merge VP and VPNP here 33 | ; 34 | 35 | relNP 36 | : LB 'string' string RB #stringRelNP 37 | | LB ensureNumericProperty relNP RB #numberRelNP 38 | ; 39 | 40 | reversePredicate 41 | : LB reverse predicate RB 42 | | LB reverse relNP RB 43 | ; 44 | 45 | value 46 | : LB concat value value RB #concatValueNP 47 | | LB getProperty np relNP RB #attributeNP 48 | | LB ensureNumericEntity np RB #numericEntityNP 49 | | LB 'number' quantity ( 'en.'? string )? RB #numberNP 50 | | LB date RB #dateNP 51 | | LB year RB #yearNP 52 | | LB time RB #timeNP 53 | ; 54 | 55 | constraintNP 56 | : LB getProperty LB singleton concept RB LB 'string' '!' 'type' RB RB #typeConstraintNP 57 | | filterCP #filterConstraintNP 58 | | LB getProperty np reversePredicate RB #eventConstraintNP 59 | | LB 'var' string RB #voidConstraintNP 60 | ; 61 | 62 | cp 63 | : LB 'lambda' string cp RB #nestedCP 64 | | filterCP #CP 65 | | superlativeCP #CP 66 | | comparativeCP #CP 67 | ; 68 | 69 | filterCP 70 | : LB filterFunc constraintNP predicate RB #filterByPredicate 71 | | LB filterFunc constraintNP relNP op value RB #filterByAttribute 72 | | LB filterFunc constraintNP predicate op np RB #filterByPredicate 73 | | LB filterFunc constraintNP reversePredicate op np RB #filterByReversePredicate 74 | ; 75 | 76 | superlativeCP 77 | : LB superlative constraintNP op relNP RB #superlativeByAttribute 78 | | LB countSuperlative constraintNP op relNP RB #superlativeByPredicate // predicate? 79 | | LB countSuperlative constraintNP op predicate np RB #superlativeByPredicate 80 | | LB countSuperlative constraintNP op reversePredicate np RB #superlativeByReversePredicate 81 | ; 82 | 83 | comparativeCP 84 | : LB countComparative constraintNP relNP op value RB #comparativeByPredicate // predicate? 85 | | LB countComparative constraintNP predicate op value np RB #comparativeByPredicate 86 | | LB countComparative constraintNP reversePredicate op value np RB #comparativeByReversePredicate 87 | ; 88 | 89 | op 90 | : LB 'string' '=' RB #equal 91 | | LB 'string' '!' '=' RB #notEqual 92 | | LB 'string' '<' RB #lessThan 93 | | LB 'string' '>' RB #greaterThan 94 | | LB 'string' '<' '=' RB #lessThanOrEqual 95 | | LB 'string' '>' '=' RB #greaterThanOrEqual 96 | | LB 'string' 'min' RB #min 97 | | LB 'string' 'max' RB #max 98 | ; 99 | 100 | aggregateType 101 | : LB 'string' 'sum' RB #sumAggregate 102 | | LB 'string' 'avg' RB #avgAggregate 103 | ; 104 | 105 | PREFIX 106 | : 'call edu.stanford.nlp.sempre.overnight.SimpleWorld.' 107 | | 'call SW.' 108 | | 'call .' 109 | ; 110 | 111 | listValue 112 | : PREFIX 'listValue' 113 | ; 114 | 115 | size 116 | : PREFIX 'size' 117 | ; 118 | 119 | domain 120 | : PREFIX 'domain' 121 | ; 122 | 123 | singleton 124 | : PREFIX 'singleton' 125 | ; 126 | 127 | filterFunc 128 | : PREFIX 'filter' 129 | ; 130 | 131 | getProperty 132 | : PREFIX 'getProperty' 133 | ; 134 | 135 | superlative 136 | : PREFIX 'superlative' 137 | ; 138 | 139 | countSuperlative 140 | : PREFIX 'countSuperlative' 141 | ; 142 | 143 | countComparative 144 | : PREFIX 'countComparative' 145 | ; 146 | 147 | aggregate 148 | : PREFIX 'aggregate' 149 | ; 150 | 151 | concat 152 | : PREFIX 'concat' 153 | ; 154 | 155 | reverse 156 | : PREFIX 'reverse' 157 | ; 158 | 159 | ensureNumericProperty 160 | : PREFIX 'ensureNumericProperty' 161 | ; 162 | 163 | ensureNumericEntity 164 | : PREFIX 'ensureNumericEntity' 165 | ; 166 | 167 | LB 168 | : '(' 169 | ; 170 | 171 | RB 172 | : ')' 173 | ; 174 | 175 | string 176 | : ( STRING_LITERAL | INTEGER | 'date' | 'year' | 'time' | 'size' )+ 177 | ; 178 | 179 | date 180 | : DATE 181 | ; 182 | 183 | year 184 | : YEAR 185 | ; 186 | 187 | time 188 | : TIME 189 | ; 190 | 191 | quantity 192 | : INTEGER 193 | ; 194 | 195 | DATE 196 | : 'date ' INTEGER ' ' INTEGER ' ' INTEGER 197 | ; 198 | 199 | YEAR 200 | : 'year ' INTEGER 201 | ; 202 | 203 | TIME 204 | : 'time ' INTEGER ' ' INTEGER 205 | ; 206 | 207 | INTEGER 208 | : '-'? DIGIT+ 209 | ; 210 | 211 | STRING_LITERAL 212 | : CHAR+ 213 | ; 214 | 215 | fragment 216 | DIGIT 217 | : '0'..'9' 218 | ; 219 | 220 | fragment 221 | CHAR 222 | : 'A'..'Z' 223 | | 'a'..'z' 224 | | '_' | '-' 225 | ; 226 | 227 | WS 228 | : ( '\t' 229 | | '\n' 230 | | '\r' 231 | | ' ' )+ ->skip 232 | ; -------------------------------------------------------------------------------- /kopl/Kopl.g4: -------------------------------------------------------------------------------- 1 | grammar Kopl; 2 | 3 | WS 4 | : ( FUNC_SEP 5 | | '\t' 6 | | '\n' 7 | | '\r' )+ ->skip 8 | ; 9 | 10 | root 11 | : ( whatEntityQuery 12 | | howManyEntityQuery 13 | | whatAttributeQuery 14 | | whatRelationQuery 15 | | attributeSatisfyQuery 16 | | whatAttributeQualifierQuery 17 | | whatRelationQualifierQuery ) EOF 18 | ; 19 | 20 | whatEntityQuery 21 | : entitySet queryName 22 | ; 23 | 24 | howManyEntityQuery 25 | : entitySet count 26 | ; 27 | 28 | whatAttributeQuery 29 | : entitySet queryAttribute 30 | ; 31 | 32 | whatRelationQuery 33 | : entitySetGroup queryRelation 34 | ; 35 | 36 | attributeSatisfyQuery 37 | : entitySet ( queryAttributeUnderCondition | queryAttribute ) verify 38 | ; 39 | 40 | whatAttributeQualifierQuery 41 | : entitySet queryAttrQualifier 42 | ; 43 | 44 | whatRelationQualifierQuery 45 | : entitySetGroup queryRelationQualifier 46 | ; 47 | 48 | 49 | entitySetGroup 50 | : entitySet entitySet 51 | ; 52 | 53 | // entitySet 54 | // : entitySet entitySet setOP # entitySetByOP 55 | // | entitySet select # entitySetByRank 56 | // | entitySet ( entityFilterByRelation | entityFilterByAttribute ) # entitySetNested 57 | // | findAll ( entityFilterByAttribute | entityFilterByConcept ) # entitySetByFilter 58 | // | entity # entitySetAtom 59 | // ; 60 | 61 | entitySet 62 | : entitySet entitySet setOP # entitySetByOP 63 | | entitySet select # entitySetByRank 64 | | entitySet entityFilterByRelation # entitySetByRelation 65 | | entitySet entityFilterByAttribute # entitySetByAttribute 66 | | entitySet entityFilterByConcept # entitySetByConcept 67 | | findAll # entitySetPopulation 68 | | entity # entitySetAtom 69 | ; 70 | 71 | entityFilterByRelation 72 | : relate filterQualifier? filterConcept? 73 | ; 74 | 75 | entityFilterByAttribute 76 | : filterAttr filterQualifier? filterConcept? 77 | ; 78 | 79 | entityFilterByConcept 80 | : filterConcept 81 | ; 82 | 83 | queryName 84 | : 'What()' 85 | ; 86 | 87 | count 88 | : 'Count()' 89 | ; 90 | 91 | findAll 92 | : 'FindAll()' 93 | ; 94 | 95 | setOP 96 | : intersect 97 | | union 98 | ; 99 | 100 | intersect 101 | : 'And()' # and 102 | ; 103 | 104 | union 105 | : 'Or()' # or 106 | ; 107 | 108 | filterAttr 109 | : filterStr 110 | | filterNum 111 | | filterYear 112 | | filterDate 113 | ; 114 | 115 | filterStr 116 | : 'FilterStr(' key IN_FUNC_SEP value ')' 117 | ; 118 | 119 | filterNum 120 | : 'FilterNum(' key IN_FUNC_SEP value IN_FUNC_SEP op ')' 121 | ; 122 | 123 | filterYear 124 | : 'FilterYear(' key IN_FUNC_SEP value IN_FUNC_SEP op ')' 125 | ; 126 | 127 | filterDate 128 | : 'FilterDate(' key IN_FUNC_SEP value IN_FUNC_SEP op ')' 129 | ; 130 | 131 | queryRelation 132 | : 'QueryRelation()' 133 | ; 134 | 135 | select 136 | : 'Select(' key IN_FUNC_SEP op IN_FUNC_SEP topk IN_FUNC_SEP start ')' 137 | ; 138 | 139 | 140 | queryAttributeUnderCondition 141 | : 'QueryAttrUnderCondition(' key IN_FUNC_SEP qkey IN_FUNC_SEP qvalue ')' 142 | ; 143 | 144 | queryAttribute 145 | : 'QueryAttr(' key ')' 146 | ; 147 | 148 | verify 149 | : verifyStr 150 | | verifyNum 151 | | verifyYear 152 | | verifyDate 153 | ; 154 | 155 | verifyStr 156 | : 'VerifyStr(' value ')' 157 | ; 158 | 159 | verifyNum 160 | : 'VerifyNum(' value IN_FUNC_SEP op ')' 161 | ; 162 | 163 | verifyYear 164 | : 'VerifyYear(' value IN_FUNC_SEP op ')' 165 | ; 166 | 167 | verifyDate 168 | : 'VerifyDate(' value IN_FUNC_SEP op ')' 169 | ; 170 | 171 | queryAttrQualifier 172 | : 'QueryAttrQualifier(' key IN_FUNC_SEP value IN_FUNC_SEP qkey ')' 173 | ; 174 | 175 | queryRelationQualifier 176 | : 'QueryRelationQualifier(' predicate IN_FUNC_SEP qkey ')' 177 | ; 178 | 179 | 180 | relate 181 | : 'Relate(' predicate IN_FUNC_SEP direction ')' 182 | ; 183 | 184 | filterQualifier 185 | : filterStrQualifier 186 | | filterNumQualifier 187 | | filterYearQualifier 188 | | filterDateQualifier 189 | ; 190 | 191 | filterStrQualifier 192 | : 'QFilterStr(' qkey IN_FUNC_SEP qvalue ')' 193 | ; 194 | 195 | filterNumQualifier 196 | : 'QFilterNum(' qkey IN_FUNC_SEP qvalue IN_FUNC_SEP op ')' 197 | ; 198 | 199 | filterYearQualifier 200 | : 'QFilterYear(' qkey IN_FUNC_SEP qvalue IN_FUNC_SEP op ')' 201 | ; 202 | 203 | filterDateQualifier 204 | : 'QFilterDate(' qkey IN_FUNC_SEP qvalue IN_FUNC_SEP op ')' 205 | ; 206 | 207 | filterConcept 208 | : 'FilterConcept(' concept ')' 209 | ; 210 | 211 | entity 212 | : 'Find(' string ')' 213 | ; 214 | 215 | concept 216 | : string 217 | ; 218 | 219 | predicate 220 | : string 221 | ; 222 | 223 | key 224 | : string 225 | ; 226 | 227 | value 228 | : date 229 | | year 230 | | number 231 | | string 232 | ; 233 | 234 | qkey 235 | : string 236 | ; 237 | 238 | qvalue 239 | : date 240 | | year 241 | | number 242 | | string 243 | ; 244 | 245 | topk 246 | : string 247 | ; 248 | 249 | start 250 | : string 251 | ; 252 | 253 | op 254 | : symbolOP 255 | | stringOP 256 | ; 257 | 258 | symbolOP 259 | : '=' | '<' | '>' | '!=' 260 | ; 261 | 262 | stringOP 263 | : 'largest' | 'smallest' 264 | ; 265 | 266 | 267 | direction 268 | : 'forward' 269 | | 'backward' 270 | ; 271 | 272 | string 273 | : ( STRING_LITERAL | '(' string ')' | direction )+ 274 | ; 275 | 276 | STRING_LITERAL 277 | : ( CHARS_BASE | DIGIT | UNICODE )+ 278 | ; 279 | 280 | date 281 | : DIGIT+? '-' DIGIT+? '-' DIGIT+? 282 | ; 283 | 284 | year 285 | : DIGIT DIGIT DIGIT DIGIT 286 | ; 287 | 288 | number 289 | : INTEGER 290 | | DECIMAL 291 | | DOUBLE 292 | ; 293 | 294 | INTEGER 295 | : DIGIT+ 296 | ; 297 | 298 | DECIMAL 299 | : DIGIT+ '.' DIGIT* 300 | | '.' DIGIT+ 301 | ; 302 | 303 | DOUBLE 304 | : DIGIT+ '.' DIGIT* EXPONENT 305 | | '.' DIGIT+ EXPONENT 306 | | DIGIT+ EXPONENT 307 | ; 308 | 309 | EXPONENT 310 | : ('e'|'E') ('+'|'-')? DIGIT+ 311 | ; 312 | 313 | DIGIT 314 | : DIGIT_BASE 315 | ; 316 | 317 | fragment 318 | DIGIT_BASE 319 | : '0'..'9' 320 | ; 321 | 322 | fragment 323 | CHARS_BASE 324 | : 'A'..'Z' 325 | | 'a'..'z' 326 | | '?' | '!' | '.' | ',' | '/' | ':' | '_' | '-' | ' ' 327 | ; 328 | 329 | fragment 330 | UNICODE 331 | : ~( '(' | ')' | '<' | '>' ) 332 | ; 333 | 334 | FUNC_SEP 335 | : '' 336 | ; 337 | 338 | IN_FUNC_SEP 339 | : '' 340 | ; -------------------------------------------------------------------------------- /cypher/CypherParserListener.py: -------------------------------------------------------------------------------- 1 | # Generated from CypherParser.g4 by ANTLR 4.9.2 2 | from antlr4 import * 3 | if __name__ is not None and "." in __name__: 4 | from .CypherParser import CypherParser 5 | else: 6 | from CypherParser import CypherParser 7 | 8 | # This class defines a complete listener for a parse tree produced by CypherParser. 9 | class CypherParserListener(ParseTreeListener): 10 | 11 | # Enter a parse tree produced by CypherParser#root. 12 | def enterRoot(self, ctx:CypherParser.RootContext): 13 | pass 14 | 15 | # Exit a parse tree produced by CypherParser#root. 16 | def exitRoot(self, ctx:CypherParser.RootContext): 17 | pass 18 | 19 | 20 | # Enter a parse tree produced by CypherParser#queryBlock. 21 | def enterQueryBlock(self, ctx:CypherParser.QueryBlockContext): 22 | pass 23 | 24 | # Exit a parse tree produced by CypherParser#queryBlock. 25 | def exitQueryBlock(self, ctx:CypherParser.QueryBlockContext): 26 | pass 27 | 28 | 29 | # Enter a parse tree produced by CypherParser#matchClause. 30 | def enterMatchClause(self, ctx:CypherParser.MatchClauseContext): 31 | pass 32 | 33 | # Exit a parse tree produced by CypherParser#matchClause. 34 | def exitMatchClause(self, ctx:CypherParser.MatchClauseContext): 35 | pass 36 | 37 | 38 | # Enter a parse tree produced by CypherParser#returnClause. 39 | def enterReturnClause(self, ctx:CypherParser.ReturnClauseContext): 40 | pass 41 | 42 | # Exit a parse tree produced by CypherParser#returnClause. 43 | def exitReturnClause(self, ctx:CypherParser.ReturnClauseContext): 44 | pass 45 | 46 | 47 | # Enter a parse tree produced by CypherParser#specialQuery. 48 | def enterSpecialQuery(self, ctx:CypherParser.SpecialQueryContext): 49 | pass 50 | 51 | # Exit a parse tree produced by CypherParser#specialQuery. 52 | def exitSpecialQuery(self, ctx:CypherParser.SpecialQueryContext): 53 | pass 54 | 55 | 56 | # Enter a parse tree produced by CypherParser#queryFunction. 57 | def enterQueryFunction(self, ctx:CypherParser.QueryFunctionContext): 58 | pass 59 | 60 | # Exit a parse tree produced by CypherParser#queryFunction. 61 | def exitQueryFunction(self, ctx:CypherParser.QueryFunctionContext): 62 | pass 63 | 64 | 65 | # Enter a parse tree produced by CypherParser#orderByClause. 66 | def enterOrderByClause(self, ctx:CypherParser.OrderByClauseContext): 67 | pass 68 | 69 | # Exit a parse tree produced by CypherParser#orderByClause. 70 | def exitOrderByClause(self, ctx:CypherParser.OrderByClauseContext): 71 | pass 72 | 73 | 74 | # Enter a parse tree produced by CypherParser#limitClause. 75 | def enterLimitClause(self, ctx:CypherParser.LimitClauseContext): 76 | pass 77 | 78 | # Exit a parse tree produced by CypherParser#limitClause. 79 | def exitLimitClause(self, ctx:CypherParser.LimitClauseContext): 80 | pass 81 | 82 | 83 | # Enter a parse tree produced by CypherParser#path. 84 | def enterPath(self, ctx:CypherParser.PathContext): 85 | pass 86 | 87 | # Exit a parse tree produced by CypherParser#path. 88 | def exitPath(self, ctx:CypherParser.PathContext): 89 | pass 90 | 91 | 92 | # Enter a parse tree produced by CypherParser#node. 93 | def enterNode(self, ctx:CypherParser.NodeContext): 94 | pass 95 | 96 | # Exit a parse tree produced by CypherParser#node. 97 | def exitNode(self, ctx:CypherParser.NodeContext): 98 | pass 99 | 100 | 101 | # Enter a parse tree produced by CypherParser#nodeLabel. 102 | def enterNodeLabel(self, ctx:CypherParser.NodeLabelContext): 103 | pass 104 | 105 | # Exit a parse tree produced by CypherParser#nodeLabel. 106 | def exitNodeLabel(self, ctx:CypherParser.NodeLabelContext): 107 | pass 108 | 109 | 110 | # Enter a parse tree produced by CypherParser#propertyConstraint. 111 | def enterPropertyConstraint(self, ctx:CypherParser.PropertyConstraintContext): 112 | pass 113 | 114 | # Exit a parse tree produced by CypherParser#propertyConstraint. 115 | def exitPropertyConstraint(self, ctx:CypherParser.PropertyConstraintContext): 116 | pass 117 | 118 | 119 | # Enter a parse tree produced by CypherParser#relationship. 120 | def enterRelationship(self, ctx:CypherParser.RelationshipContext): 121 | pass 122 | 123 | # Exit a parse tree produced by CypherParser#relationship. 124 | def exitRelationship(self, ctx:CypherParser.RelationshipContext): 125 | pass 126 | 127 | 128 | # Enter a parse tree produced by CypherParser#relationshipLabel. 129 | def enterRelationshipLabel(self, ctx:CypherParser.RelationshipLabelContext): 130 | pass 131 | 132 | # Exit a parse tree produced by CypherParser#relationshipLabel. 133 | def exitRelationshipLabel(self, ctx:CypherParser.RelationshipLabelContext): 134 | pass 135 | 136 | 137 | # Enter a parse tree produced by CypherParser#constraint. 138 | def enterConstraint(self, ctx:CypherParser.ConstraintContext): 139 | pass 140 | 141 | # Exit a parse tree produced by CypherParser#constraint. 142 | def exitConstraint(self, ctx:CypherParser.ConstraintContext): 143 | pass 144 | 145 | 146 | # Enter a parse tree produced by CypherParser#alias. 147 | def enterAlias(self, ctx:CypherParser.AliasContext): 148 | pass 149 | 150 | # Exit a parse tree produced by CypherParser#alias. 151 | def exitAlias(self, ctx:CypherParser.AliasContext): 152 | pass 153 | 154 | 155 | # Enter a parse tree produced by CypherParser#symbolOP. 156 | def enterSymbolOP(self, ctx:CypherParser.SymbolOPContext): 157 | pass 158 | 159 | # Exit a parse tree produced by CypherParser#symbolOP. 160 | def exitSymbolOP(self, ctx:CypherParser.SymbolOPContext): 161 | pass 162 | 163 | 164 | # Enter a parse tree produced by CypherParser#logicOP. 165 | def enterLogicOP(self, ctx:CypherParser.LogicOPContext): 166 | pass 167 | 168 | # Exit a parse tree produced by CypherParser#logicOP. 169 | def exitLogicOP(self, ctx:CypherParser.LogicOPContext): 170 | pass 171 | 172 | 173 | # Enter a parse tree produced by CypherParser#variable. 174 | def enterVariable(self, ctx:CypherParser.VariableContext): 175 | pass 176 | 177 | # Exit a parse tree produced by CypherParser#variable. 178 | def exitVariable(self, ctx:CypherParser.VariableContext): 179 | pass 180 | 181 | 182 | # Enter a parse tree produced by CypherParser#variableAttribute. 183 | def enterVariableAttribute(self, ctx:CypherParser.VariableAttributeContext): 184 | pass 185 | 186 | # Exit a parse tree produced by CypherParser#variableAttribute. 187 | def exitVariableAttribute(self, ctx:CypherParser.VariableAttributeContext): 188 | pass 189 | 190 | 191 | # Enter a parse tree produced by CypherParser#nodeOrRelationshipProperty. 192 | def enterNodeOrRelationshipProperty(self, ctx:CypherParser.NodeOrRelationshipPropertyContext): 193 | pass 194 | 195 | # Exit a parse tree produced by CypherParser#nodeOrRelationshipProperty. 196 | def exitNodeOrRelationshipProperty(self, ctx:CypherParser.NodeOrRelationshipPropertyContext): 197 | pass 198 | 199 | 200 | # Enter a parse tree produced by CypherParser#value. 201 | def enterValue(self, ctx:CypherParser.ValueContext): 202 | pass 203 | 204 | # Exit a parse tree produced by CypherParser#value. 205 | def exitValue(self, ctx:CypherParser.ValueContext): 206 | pass 207 | 208 | 209 | # Enter a parse tree produced by CypherParser#varString. 210 | def enterVarString(self, ctx:CypherParser.VarStringContext): 211 | pass 212 | 213 | # Exit a parse tree produced by CypherParser#varString. 214 | def exitVarString(self, ctx:CypherParser.VarStringContext): 215 | pass 216 | 217 | 218 | # Enter a parse tree produced by CypherParser#string. 219 | def enterString(self, ctx:CypherParser.StringContext): 220 | pass 221 | 222 | # Exit a parse tree produced by CypherParser#string. 223 | def exitString(self, ctx:CypherParser.StringContext): 224 | pass 225 | 226 | 227 | 228 | del CypherParser -------------------------------------------------------------------------------- /cypher/CypherParser.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'CALL' 4 | 'MATCH' 5 | 'WHERE' 6 | 'RETURN' 7 | 'UNION' 8 | 'WITH' 9 | 'AS' 10 | 'AND' 11 | 'OR' 12 | 'ORDER BY' 13 | 'LIMIT' 14 | 'DISTINCT' 15 | 'count' 16 | 'isEmpty' 17 | 'DESC' 18 | null 19 | '(' 20 | ')' 21 | '{' 22 | ':' 23 | '->' 24 | '<-' 25 | '-' 26 | '}' 27 | '[' 28 | ']' 29 | '=' 30 | '<>' 31 | '>=' 32 | '>' 33 | '<=' 34 | '<' 35 | '.' 36 | null 37 | null 38 | null 39 | '|' 40 | ',' 41 | null 42 | 43 | token symbolic names: 44 | null 45 | Call 46 | Match 47 | Where 48 | Return 49 | Union 50 | With 51 | As 52 | And 53 | Or 54 | OrderBy 55 | Limit 56 | Distinct 57 | CountFunction 58 | IsEmptyFunction 59 | Desc 60 | SEP 61 | LP 62 | RP 63 | LB 64 | COL 65 | TORIGHT 66 | TOLEFT 67 | UND 68 | RB 69 | LSB 70 | RSB 71 | EQ 72 | NEQ 73 | GTE 74 | GT 75 | LTE 76 | LT 77 | DOT 78 | INTEGER 79 | STRING_SYMBOL 80 | STRING_LITERAL 81 | OR 82 | COMMA 83 | WS 84 | 85 | rule names: 86 | root 87 | queryBlock 88 | matchClause 89 | returnClause 90 | specialQuery 91 | queryFunction 92 | orderByClause 93 | limitClause 94 | path 95 | node 96 | nodeLabel 97 | propertyConstraint 98 | relationship 99 | relationshipLabel 100 | constraint 101 | alias 102 | symbolOP 103 | logicOP 104 | variable 105 | variableAttribute 106 | nodeOrRelationshipProperty 107 | value 108 | varString 109 | string 110 | 111 | 112 | atn: 113 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 41, 273, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 3, 2, 3, 2, 3, 2, 7, 2, 54, 10, 2, 12, 2, 14, 2, 57, 11, 2, 3, 2, 5, 2, 60, 10, 2, 3, 2, 3, 2, 3, 3, 6, 3, 65, 10, 3, 13, 3, 14, 3, 66, 3, 3, 3, 3, 5, 3, 71, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 77, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 6, 4, 87, 10, 4, 13, 4, 14, 4, 88, 3, 4, 3, 4, 5, 4, 93, 10, 4, 3, 5, 3, 5, 5, 5, 97, 10, 5, 3, 5, 3, 5, 3, 5, 5, 5, 102, 10, 5, 3, 5, 3, 5, 5, 5, 106, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 112, 10, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 5, 8, 121, 10, 8, 3, 8, 5, 8, 124, 10, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 5, 10, 132, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 137, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 142, 10, 10, 3, 10, 5, 10, 145, 10, 10, 3, 10, 7, 10, 148, 10, 10, 12, 10, 14, 10, 151, 11, 10, 3, 11, 3, 11, 5, 11, 155, 10, 11, 3, 11, 3, 11, 6, 11, 159, 10, 11, 13, 11, 14, 11, 160, 3, 11, 5, 11, 164, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 172, 10, 11, 12, 11, 14, 11, 175, 11, 11, 3, 11, 5, 11, 178, 10, 11, 3, 11, 3, 11, 5, 11, 182, 10, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 190, 10, 13, 12, 13, 14, 13, 193, 11, 13, 3, 13, 3, 13, 3, 14, 3, 14, 5, 14, 199, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 206, 10, 14, 3, 14, 5, 14, 209, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 220, 10, 14, 3, 14, 5, 14, 223, 10, 14, 5, 14, 225, 10, 14, 3, 14, 3, 14, 5, 14, 229, 10, 14, 3, 15, 3, 15, 3, 16, 3, 16, 5, 16, 235, 10, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 261, 10, 23, 3, 24, 6, 24, 264, 10, 24, 13, 24, 14, 24, 265, 3, 25, 6, 25, 269, 10, 25, 13, 25, 14, 25, 270, 3, 25, 2, 2, 26, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 2, 7, 3, 2, 15, 16, 3, 2, 29, 34, 3, 2, 10, 11, 4, 2, 36, 36, 38, 38, 3, 2, 35, 38, 2, 286, 2, 50, 3, 2, 2, 2, 4, 64, 3, 2, 2, 2, 6, 92, 3, 2, 2, 2, 8, 94, 3, 2, 2, 2, 10, 107, 3, 2, 2, 2, 12, 115, 3, 2, 2, 2, 14, 117, 3, 2, 2, 2, 16, 125, 3, 2, 2, 2, 18, 128, 3, 2, 2, 2, 20, 181, 3, 2, 2, 2, 22, 183, 3, 2, 2, 2, 24, 185, 3, 2, 2, 2, 26, 228, 3, 2, 2, 2, 28, 230, 3, 2, 2, 2, 30, 234, 3, 2, 2, 2, 32, 239, 3, 2, 2, 2, 34, 241, 3, 2, 2, 2, 36, 243, 3, 2, 2, 2, 38, 245, 3, 2, 2, 2, 40, 247, 3, 2, 2, 2, 42, 251, 3, 2, 2, 2, 44, 260, 3, 2, 2, 2, 46, 263, 3, 2, 2, 2, 48, 268, 3, 2, 2, 2, 50, 55, 5, 4, 3, 2, 51, 52, 7, 7, 2, 2, 52, 54, 5, 4, 3, 2, 53, 51, 3, 2, 2, 2, 54, 57, 3, 2, 2, 2, 55, 53, 3, 2, 2, 2, 55, 56, 3, 2, 2, 2, 56, 59, 3, 2, 2, 2, 57, 55, 3, 2, 2, 2, 58, 60, 5, 16, 9, 2, 59, 58, 3, 2, 2, 2, 59, 60, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 62, 7, 2, 2, 3, 62, 3, 3, 2, 2, 2, 63, 65, 5, 6, 4, 2, 64, 63, 3, 2, 2, 2, 65, 66, 3, 2, 2, 2, 66, 64, 3, 2, 2, 2, 66, 67, 3, 2, 2, 2, 67, 68, 3, 2, 2, 2, 68, 70, 5, 8, 5, 2, 69, 71, 5, 14, 8, 2, 70, 69, 3, 2, 2, 2, 70, 71, 3, 2, 2, 2, 71, 5, 3, 2, 2, 2, 72, 73, 7, 4, 2, 2, 73, 76, 5, 18, 10, 2, 74, 75, 7, 5, 2, 2, 75, 77, 5, 30, 16, 2, 76, 74, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 93, 3, 2, 2, 2, 78, 79, 7, 4, 2, 2, 79, 80, 5, 18, 10, 2, 80, 81, 7, 5, 2, 2, 81, 82, 7, 19, 2, 2, 82, 86, 5, 30, 16, 2, 83, 84, 5, 36, 19, 2, 84, 85, 5, 30, 16, 2, 85, 87, 3, 2, 2, 2, 86, 83, 3, 2, 2, 2, 87, 88, 3, 2, 2, 2, 88, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 90, 3, 2, 2, 2, 90, 91, 7, 20, 2, 2, 91, 93, 3, 2, 2, 2, 92, 72, 3, 2, 2, 2, 92, 78, 3, 2, 2, 2, 93, 7, 3, 2, 2, 2, 94, 96, 7, 6, 2, 2, 95, 97, 7, 14, 2, 2, 96, 95, 3, 2, 2, 2, 96, 97, 3, 2, 2, 2, 97, 101, 3, 2, 2, 2, 98, 102, 5, 10, 6, 2, 99, 102, 5, 40, 21, 2, 100, 102, 5, 38, 20, 2, 101, 98, 3, 2, 2, 2, 101, 99, 3, 2, 2, 2, 101, 100, 3, 2, 2, 2, 102, 105, 3, 2, 2, 2, 103, 104, 7, 9, 2, 2, 104, 106, 5, 32, 17, 2, 105, 103, 3, 2, 2, 2, 105, 106, 3, 2, 2, 2, 106, 9, 3, 2, 2, 2, 107, 108, 5, 12, 7, 2, 108, 111, 7, 19, 2, 2, 109, 112, 5, 40, 21, 2, 110, 112, 5, 38, 20, 2, 111, 109, 3, 2, 2, 2, 111, 110, 3, 2, 2, 2, 112, 113, 3, 2, 2, 2, 113, 114, 7, 20, 2, 2, 114, 11, 3, 2, 2, 2, 115, 116, 9, 2, 2, 2, 116, 13, 3, 2, 2, 2, 117, 120, 7, 12, 2, 2, 118, 121, 5, 40, 21, 2, 119, 121, 5, 38, 20, 2, 120, 118, 3, 2, 2, 2, 120, 119, 3, 2, 2, 2, 121, 123, 3, 2, 2, 2, 122, 124, 7, 17, 2, 2, 123, 122, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124, 15, 3, 2, 2, 2, 125, 126, 7, 13, 2, 2, 126, 127, 7, 36, 2, 2, 127, 17, 3, 2, 2, 2, 128, 149, 5, 20, 11, 2, 129, 131, 7, 24, 2, 2, 130, 132, 5, 26, 14, 2, 131, 130, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 133, 3, 2, 2, 2, 133, 145, 7, 25, 2, 2, 134, 136, 7, 25, 2, 2, 135, 137, 5, 26, 14, 2, 136, 135, 3, 2, 2, 2, 136, 137, 3, 2, 2, 2, 137, 138, 3, 2, 2, 2, 138, 145, 7, 25, 2, 2, 139, 141, 7, 25, 2, 2, 140, 142, 5, 26, 14, 2, 141, 140, 3, 2, 2, 2, 141, 142, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 7, 23, 2, 2, 144, 129, 3, 2, 2, 2, 144, 134, 3, 2, 2, 2, 144, 139, 3, 2, 2, 2, 145, 146, 3, 2, 2, 2, 146, 148, 5, 20, 11, 2, 147, 144, 3, 2, 2, 2, 148, 151, 3, 2, 2, 2, 149, 147, 3, 2, 2, 2, 149, 150, 3, 2, 2, 2, 150, 19, 3, 2, 2, 2, 151, 149, 3, 2, 2, 2, 152, 154, 7, 19, 2, 2, 153, 155, 5, 38, 20, 2, 154, 153, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 155, 158, 3, 2, 2, 2, 156, 157, 7, 22, 2, 2, 157, 159, 5, 22, 12, 2, 158, 156, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 158, 3, 2, 2, 2, 160, 161, 3, 2, 2, 2, 161, 163, 3, 2, 2, 2, 162, 164, 5, 24, 13, 2, 163, 162, 3, 2, 2, 2, 163, 164, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 166, 7, 20, 2, 2, 166, 182, 3, 2, 2, 2, 167, 168, 7, 19, 2, 2, 168, 173, 5, 38, 20, 2, 169, 170, 7, 22, 2, 2, 170, 172, 5, 22, 12, 2, 171, 169, 3, 2, 2, 2, 172, 175, 3, 2, 2, 2, 173, 171, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 177, 3, 2, 2, 2, 175, 173, 3, 2, 2, 2, 176, 178, 5, 24, 13, 2, 177, 176, 3, 2, 2, 2, 177, 178, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 180, 7, 20, 2, 2, 180, 182, 3, 2, 2, 2, 181, 152, 3, 2, 2, 2, 181, 167, 3, 2, 2, 2, 182, 21, 3, 2, 2, 2, 183, 184, 5, 46, 24, 2, 184, 23, 3, 2, 2, 2, 185, 186, 7, 21, 2, 2, 186, 191, 5, 42, 22, 2, 187, 188, 7, 40, 2, 2, 188, 190, 5, 42, 22, 2, 189, 187, 3, 2, 2, 2, 190, 193, 3, 2, 2, 2, 191, 189, 3, 2, 2, 2, 191, 192, 3, 2, 2, 2, 192, 194, 3, 2, 2, 2, 193, 191, 3, 2, 2, 2, 194, 195, 7, 26, 2, 2, 195, 25, 3, 2, 2, 2, 196, 198, 7, 27, 2, 2, 197, 199, 5, 38, 20, 2, 198, 197, 3, 2, 2, 2, 198, 199, 3, 2, 2, 2, 199, 200, 3, 2, 2, 2, 200, 201, 7, 22, 2, 2, 201, 205, 5, 28, 15, 2, 202, 203, 7, 39, 2, 2, 203, 204, 7, 22, 2, 2, 204, 206, 5, 28, 15, 2, 205, 202, 3, 2, 2, 2, 205, 206, 3, 2, 2, 2, 206, 208, 3, 2, 2, 2, 207, 209, 5, 24, 13, 2, 208, 207, 3, 2, 2, 2, 208, 209, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 7, 28, 2, 2, 211, 229, 3, 2, 2, 2, 212, 213, 7, 27, 2, 2, 213, 224, 5, 38, 20, 2, 214, 215, 7, 22, 2, 2, 215, 219, 5, 28, 15, 2, 216, 217, 7, 39, 2, 2, 217, 218, 7, 22, 2, 2, 218, 220, 5, 28, 15, 2, 219, 216, 3, 2, 2, 2, 219, 220, 3, 2, 2, 2, 220, 222, 3, 2, 2, 2, 221, 223, 5, 24, 13, 2, 222, 221, 3, 2, 2, 2, 222, 223, 3, 2, 2, 2, 223, 225, 3, 2, 2, 2, 224, 214, 3, 2, 2, 2, 224, 225, 3, 2, 2, 2, 225, 226, 3, 2, 2, 2, 226, 227, 7, 28, 2, 2, 227, 229, 3, 2, 2, 2, 228, 196, 3, 2, 2, 2, 228, 212, 3, 2, 2, 2, 229, 27, 3, 2, 2, 2, 230, 231, 5, 46, 24, 2, 231, 29, 3, 2, 2, 2, 232, 235, 5, 40, 21, 2, 233, 235, 5, 38, 20, 2, 234, 232, 3, 2, 2, 2, 234, 233, 3, 2, 2, 2, 235, 236, 3, 2, 2, 2, 236, 237, 5, 34, 18, 2, 237, 238, 5, 44, 23, 2, 238, 31, 3, 2, 2, 2, 239, 240, 5, 38, 20, 2, 240, 33, 3, 2, 2, 2, 241, 242, 9, 3, 2, 2, 242, 35, 3, 2, 2, 2, 243, 244, 9, 4, 2, 2, 244, 37, 3, 2, 2, 2, 245, 246, 5, 46, 24, 2, 246, 39, 3, 2, 2, 2, 247, 248, 5, 38, 20, 2, 248, 249, 7, 35, 2, 2, 249, 250, 5, 38, 20, 2, 250, 41, 3, 2, 2, 2, 251, 252, 5, 38, 20, 2, 252, 253, 7, 22, 2, 2, 253, 254, 5, 44, 23, 2, 254, 43, 3, 2, 2, 2, 255, 261, 5, 48, 25, 2, 256, 257, 7, 18, 2, 2, 257, 258, 5, 48, 25, 2, 258, 259, 7, 18, 2, 2, 259, 261, 3, 2, 2, 2, 260, 255, 3, 2, 2, 2, 260, 256, 3, 2, 2, 2, 261, 45, 3, 2, 2, 2, 262, 264, 9, 5, 2, 2, 263, 262, 3, 2, 2, 2, 264, 265, 3, 2, 2, 2, 265, 263, 3, 2, 2, 2, 265, 266, 3, 2, 2, 2, 266, 47, 3, 2, 2, 2, 267, 269, 9, 6, 2, 2, 268, 267, 3, 2, 2, 2, 269, 270, 3, 2, 2, 2, 270, 268, 3, 2, 2, 2, 270, 271, 3, 2, 2, 2, 271, 49, 3, 2, 2, 2, 38, 55, 59, 66, 70, 76, 88, 92, 96, 101, 105, 111, 120, 123, 131, 136, 141, 144, 149, 154, 160, 163, 173, 177, 181, 191, 198, 205, 208, 219, 222, 224, 228, 234, 260, 265, 270] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /sparql/Sparql.g4: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007 the original author or authors. 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following 7 | * conditions are met: 8 | * 9 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following 10 | * disclaimer. 11 | * 12 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 13 | * disclaimer in the documentation and/or other materials provided with the distribution. 14 | * 15 | * Neither the name of the author or authors nor the names of its contributors may be used to endorse or promote 16 | * products derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 22 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * @author Simone Tripodi (simone) 31 | * @author Michele Mostarda (michele) 32 | * @version $Id: Sparql.g 5 2007-10-30 17:20:36Z simone $ 33 | */ 34 | /* 35 | * Ported to Antlr4 by Tom Everett 36 | */ 37 | 38 | grammar Sparql; 39 | 40 | query 41 | : prologue ( selectQuery | constructQuery | describeQuery | askQuery ) EOF 42 | ; 43 | 44 | prologue 45 | : baseDecl? prefixDecl* 46 | ; 47 | 48 | baseDecl 49 | : 'BASE' IRI_REF 50 | ; 51 | 52 | prefixDecl 53 | : 'PREFIX' PNAME_NS IRI_REF 54 | ; 55 | 56 | selectQuery 57 | : 'SELECT' ( entityQueryCondition | countQueryCondition ) datasetClause* whereClause solutionModifier 58 | ; 59 | 60 | entityQueryCondition 61 | : ( 'DISTINCT' | 'REDUCED' )? ( var_+ | '*' ) 62 | ; 63 | 64 | countQueryCondition 65 | : ( '(' 'COUNT' '(' entityQueryCondition ')' 'AS' var_+ ')' ) 66 | ; 67 | 68 | constructQuery 69 | : 'CONSTRUCT' constructTemplate datasetClause* whereClause solutionModifier 70 | ; 71 | 72 | describeQuery 73 | : 'DESCRIBE' ( varOrIRIref+ | '*' ) datasetClause* whereClause? solutionModifier 74 | ; 75 | 76 | askQuery 77 | : 'ASK' datasetClause* whereClause 78 | ; 79 | 80 | datasetClause 81 | : 'FROM' ( defaultGraphClause | namedGraphClause ) 82 | ; 83 | 84 | defaultGraphClause 85 | : sourceSelector 86 | ; 87 | 88 | namedGraphClause 89 | : 'NAMED' sourceSelector 90 | ; 91 | 92 | sourceSelector 93 | : iriRef 94 | ; 95 | 96 | whereClause 97 | : 'WHERE'? groupGraphPattern 98 | ; 99 | 100 | solutionModifier 101 | : orderClause? limitOffsetClauses? 102 | ; 103 | 104 | limitOffsetClauses 105 | : ( limitClause offsetClause? | offsetClause limitClause? ) 106 | ; 107 | 108 | orderClause 109 | : 'ORDER' 'BY' orderCondition+ 110 | ; 111 | 112 | orderCondition 113 | : ( ( 'ASC' | 'DESC' ) brackettedExpression ) 114 | | ( constraint | var_ ) 115 | ; 116 | 117 | limitClause 118 | : 'LIMIT' INTEGER 119 | ; 120 | 121 | offsetClause 122 | : 'OFFSET' INTEGER 123 | ; 124 | 125 | groupGraphPattern 126 | : '{' triplesBlock? ( ( graphPatternNotTriples | filter_ ) '.'? triplesBlock? )* '}' 127 | ; 128 | 129 | triplesBlock 130 | : triplesSameSubject ( '.' triplesBlock? )? 131 | ; 132 | 133 | graphPatternNotTriples 134 | : optionalGraphPattern | groupOrUnionGraphPattern | graphGraphPattern 135 | ; 136 | 137 | optionalGraphPattern 138 | : 'OPTIONAL' groupGraphPattern 139 | ; 140 | 141 | graphGraphPattern 142 | : 'GRAPH' varOrIRIref groupGraphPattern 143 | ; 144 | 145 | groupOrUnionGraphPattern 146 | : groupGraphPattern ( 'UNION' groupGraphPattern )* 147 | ; 148 | 149 | filter_ 150 | : 'FILTER' constraint 151 | ; 152 | 153 | constraint 154 | : brackettedExpression | builtInCall | functionCall 155 | ; 156 | 157 | functionCall 158 | : iriRef argList 159 | ; 160 | 161 | argList 162 | : ( NIL | '(' expression ( ',' expression )* ')' ) 163 | ; 164 | 165 | constructTemplate 166 | : '{' constructTriples? '}' 167 | ; 168 | 169 | constructTriples 170 | : triplesSameSubject ( '.' constructTriples? )? 171 | ; 172 | 173 | triplesSameSubject 174 | : varOrTerm propertyListNotEmpty | triplesNode propertyList 175 | ; 176 | 177 | propertyListNotEmpty 178 | : verb objectList ( ';' ( verb objectList )? )* 179 | ; 180 | 181 | propertyList 182 | : propertyListNotEmpty? 183 | ; 184 | 185 | objectList 186 | : object_ ( ',' object_ )* 187 | ; 188 | 189 | object_ 190 | : graphNode 191 | ; 192 | 193 | verb 194 | : varOrIRIref 195 | | 'a' 196 | ; 197 | 198 | triplesNode 199 | : collection 200 | | blankNodePropertyList 201 | ; 202 | 203 | blankNodePropertyList 204 | : '[' propertyListNotEmpty ']' 205 | ; 206 | 207 | collection 208 | : '(' graphNode+ ')' 209 | ; 210 | 211 | graphNode 212 | : varOrTerm | triplesNode 213 | ; 214 | 215 | varOrTerm 216 | : var_ 217 | | graphTerm 218 | ; 219 | 220 | varOrIRIref 221 | : var_ | iriRef 222 | ; 223 | 224 | var_ 225 | : VAR1 226 | | VAR2 227 | ; 228 | 229 | graphTerm 230 | : iriRef 231 | | rdfLiteral 232 | | numericLiteral 233 | | booleanLiteral 234 | | blankNode 235 | | NIL 236 | ; 237 | 238 | expression 239 | : conditionalOrExpression 240 | ; 241 | 242 | conditionalOrExpression 243 | : conditionalAndExpression ( '||' conditionalAndExpression )* 244 | ; 245 | 246 | conditionalAndExpression 247 | : valueLogical ( '&&' valueLogical )* 248 | ; 249 | 250 | valueLogical 251 | : relationalExpression 252 | ; 253 | 254 | relationalExpression 255 | : numericExpression ( '=' numericExpression | '!=' numericExpression | '<' numericExpression | '>' numericExpression | '<=' numericExpression | '>=' numericExpression )? 256 | ; 257 | 258 | numericExpression 259 | : additiveExpression 260 | ; 261 | 262 | additiveExpression 263 | : multiplicativeExpression ( '+' multiplicativeExpression | '-' multiplicativeExpression | numericLiteralPositive | numericLiteralNegative )* 264 | ; 265 | 266 | multiplicativeExpression 267 | : unaryExpression ( '*' unaryExpression | '/' unaryExpression )* 268 | ; 269 | 270 | unaryExpression 271 | : '!' primaryExpression 272 | | '+' primaryExpression 273 | | '-' primaryExpression 274 | | primaryExpression 275 | ; 276 | 277 | primaryExpression 278 | : brackettedExpression | builtInCall | iriRefOrFunction | rdfLiteral | numericLiteral | booleanLiteral | var_ 279 | ; 280 | 281 | brackettedExpression 282 | : '(' expression ')' 283 | ; 284 | 285 | builtInCall 286 | : 'STR' '(' expression ')' 287 | | 'LANG' '(' expression ')' 288 | | 'LANGMATCHES' '(' expression ',' expression ')' 289 | | 'DATATYPE' '(' expression ')' 290 | | 'BOUND' '(' var_ ')' 291 | | 'sameTerm' '(' expression ',' expression ')' 292 | | 'isIRI' '(' expression ')' 293 | | 'isURI' '(' expression ')' 294 | | 'isBLANK' '(' expression ')' 295 | | 'isLITERAL' '(' expression ')' 296 | | regexExpression 297 | ; 298 | 299 | regexExpression 300 | : 'REGEX' '(' expression ',' expression ( ',' expression )? ')' 301 | ; 302 | 303 | iriRefOrFunction 304 | : iriRef argList? 305 | ; 306 | 307 | rdfLiteral 308 | : string ( LANGTAG | ( '^^' iriRef ) )? 309 | ; 310 | 311 | numericLiteral 312 | : numericLiteralUnsigned | numericLiteralPositive | numericLiteralNegative 313 | ; 314 | 315 | numericLiteralUnsigned 316 | : INTEGER 317 | | DECIMAL 318 | | DOUBLE 319 | ; 320 | 321 | numericLiteralPositive 322 | : INTEGER_POSITIVE 323 | | DECIMAL_POSITIVE 324 | | DOUBLE_POSITIVE 325 | ; 326 | 327 | numericLiteralNegative 328 | : INTEGER_NEGATIVE 329 | | DECIMAL_NEGATIVE 330 | | DOUBLE_NEGATIVE 331 | ; 332 | 333 | booleanLiteral 334 | : 'true' 335 | | 'false' 336 | ; 337 | 338 | string 339 | : STRING_LITERAL1 340 | | STRING_LITERAL2 341 | /* | STRING_LITERAL_LONG('0'..'9') | STRING_LITERAL_LONG('0'..'9')*/ 342 | ; 343 | 344 | iriRef 345 | : IRI_REF 346 | | prefixedName 347 | ; 348 | 349 | prefixedName 350 | : PNAME_LN 351 | | PNAME_NS 352 | ; 353 | 354 | blankNode 355 | : BLANK_NODE_LABEL 356 | | ANON 357 | ; 358 | 359 | // LEXER RULES 360 | 361 | IRI_REF 362 | : '<' ( ~('<' | '>' | '"' | '{' | '}' | '|' | '^' | '\\' | '`') | (PN_CHARS))* '>' 363 | ; 364 | 365 | PNAME_NS 366 | : PN_PREFIX? ':' 367 | ; 368 | 369 | PNAME_LN 370 | : PNAME_NS PN_LOCAL 371 | ; 372 | 373 | BLANK_NODE_LABEL 374 | : '_:' PN_LOCAL 375 | ; 376 | 377 | VAR1 378 | : '?' VARNAME 379 | ; 380 | 381 | VAR2 382 | : '$' VARNAME 383 | ; 384 | 385 | LANGTAG 386 | : '@' PN_CHARS_BASE+ ('-' (PN_CHARS_BASE DIGIT)+)* 387 | ; 388 | 389 | INTEGER 390 | : DIGIT+ 391 | ; 392 | 393 | DECIMAL 394 | : DIGIT+ '.' DIGIT* 395 | | '.' DIGIT+ 396 | ; 397 | 398 | DOUBLE 399 | : DIGIT+ '.' DIGIT* EXPONENT 400 | | '.' DIGIT+ EXPONENT 401 | | DIGIT+ EXPONENT 402 | ; 403 | 404 | INTEGER_POSITIVE 405 | : '+' INTEGER 406 | ; 407 | 408 | DECIMAL_POSITIVE 409 | : '+' DECIMAL 410 | ; 411 | 412 | DOUBLE_POSITIVE 413 | : '+' DOUBLE 414 | ; 415 | 416 | INTEGER_NEGATIVE 417 | : '-' INTEGER 418 | ; 419 | 420 | DECIMAL_NEGATIVE 421 | : '-' DECIMAL 422 | ; 423 | 424 | DOUBLE_NEGATIVE 425 | : '-' DOUBLE 426 | ; 427 | 428 | EXPONENT 429 | : ('e'|'E') ('+'|'-')? DIGIT+ 430 | ; 431 | 432 | STRING_LITERAL1 433 | : '\'' ( ~('\u0027' | '\u005C' | '\u000A' | '\u000D') | ECHAR )* '\'' 434 | ; 435 | 436 | STRING_LITERAL2 437 | : '"' ( ~('\u0022' | '\u005C' | '\u000A' | '\u000D') | ECHAR )* '"' 438 | ; 439 | 440 | STRING_LITERAL_LONG1 441 | : '\'\'\'' ( ( '\'' | '\'\'' )? (~('\'' | '\\') | ECHAR ) )* '\'\'\'' 442 | ; 443 | 444 | STRING_LITERAL_LONG2 445 | : '"""' ( ( '"' | '""' )? ( ~('\'' | '\\') | ECHAR ) )* '"""' 446 | ; 447 | 448 | ECHAR 449 | : '\\' ('t' | 'b' | 'n' | 'r' | 'f' | '"' | '\'') 450 | ; 451 | 452 | NIL 453 | : '(' WS* ')' 454 | ; 455 | 456 | ANON 457 | : '[' WS* ']' 458 | ; 459 | 460 | PN_CHARS_U 461 | : PN_CHARS_BASE | '_' 462 | ; 463 | 464 | VARNAME 465 | : ( PN_CHARS_U | DIGIT ) ( PN_CHARS_U | DIGIT | '\u00B7' | ('\u0300'..'\u036F') | ('\u203F'..'\u2040') )* 466 | ; 467 | 468 | fragment 469 | PN_CHARS 470 | : PN_CHARS_U 471 | | '-' 472 | | DIGIT 473 | /*| '\u00B7' 474 | | '\u0300'..'\u036F' 475 | | '\u203F'..'\u2040'*/ 476 | ; 477 | 478 | PN_PREFIX 479 | : PN_CHARS_BASE ((PN_CHARS|'.')* PN_CHARS)? 480 | ; 481 | 482 | PN_LOCAL 483 | : ( PN_CHARS_U | DIGIT ) ((PN_CHARS|'.')* PN_CHARS)? 484 | ; 485 | 486 | fragment 487 | PN_CHARS_BASE 488 | : 'A'..'Z' 489 | | 'a'..'z' 490 | | '\u00C0'..'\u00D6' 491 | | '\u00D8'..'\u00F6' 492 | | '\u00F8'..'\u02FF' 493 | | '\u0370'..'\u037D' 494 | | '\u037F'..'\u1FFF' 495 | | '\u200C'..'\u200D' 496 | | '\u2070'..'\u218F' 497 | | '\u2C00'..'\u2FEF' 498 | | '\u3001'..'\uD7FF' 499 | | '\uF900'..'\uFDCF' 500 | | '\uFDF0'..'\uFFFD' 501 | ; 502 | 503 | fragment 504 | DIGIT 505 | : '0'..'9' 506 | ; 507 | 508 | WS 509 | : (' ' 510 | | '\t' 511 | | '\n' 512 | | '\r')+ ->skip 513 | ; -------------------------------------------------------------------------------- /ir/IRParser.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | null 4 | null 5 | 'which one has the' 6 | 'how many' 7 | 'whether' 8 | 'of' 9 | 'from' 10 | 'to' 11 | 'among' 12 | 'top' 13 | null 14 | 'the' 15 | 'whose' 16 | 'that' 17 | 'has' 18 | 'not' 19 | '(' 20 | ')' 21 | 'forward' 22 | 'backward' 23 | 'and' 24 | 'or' 25 | 'sum' 26 | 'average' 27 | null 28 | null 29 | null 30 | null 31 | 'at least' 32 | 'at most' 33 | null 34 | null 35 | 'text' 36 | 'number' 37 | 'date' 38 | 'month' 39 | 'year' 40 | 'time' 41 | ' ' 42 | '' 43 | '' 44 | '' 45 | '' 46 | '' 47 | '' 48 | '' 49 | '' 50 | null 51 | null 52 | null 53 | null 54 | '' 55 | '' 56 | '' 57 | '' 58 | '' 59 | '' 60 | null 61 | 62 | token symbolic names: 63 | null 64 | WS 65 | What 66 | Select 67 | Count 68 | Verify 69 | Of 70 | From 71 | To 72 | Among 73 | Top 74 | Ones 75 | The 76 | Whose 77 | That 78 | Has 79 | Not 80 | LB 81 | RB 82 | Forward 83 | Backward 84 | And 85 | Or 86 | Sum 87 | Average 88 | Is 89 | IsNot 90 | LargerThan 91 | SmallerThan 92 | AtLeast 93 | AtMost 94 | Largest 95 | Smallest 96 | Text 97 | Quantity 98 | Date 99 | Month 100 | Year 101 | Time 102 | SPACE 103 | ES_START 104 | ES_END 105 | ENTI_START 106 | ATTR_START 107 | PRED_START 108 | CONC_START 109 | QUAL_START 110 | VALU_START 111 | INTEGER 112 | DECIMAL 113 | DIGIT 114 | STRING_LITERAL 115 | ENTI_END 116 | ATTR_END 117 | PRED_END 118 | CONC_END 119 | QUAL_END 120 | VALU_END 121 | LITERAL 122 | 123 | rule names: 124 | root 125 | entityQuery 126 | attributeQuery 127 | predicateQuery 128 | qualifierQuery 129 | countQuery 130 | verifyQuery 131 | selectQuery 132 | valueQuery 133 | verify 134 | entitySet 135 | filterFromEntitySet 136 | filterByRank 137 | filterByAttribute 138 | filterByPredicate 139 | filterByQualifier 140 | direction 141 | setOP 142 | logicGate 143 | symbolOP 144 | stringOP 145 | aggregateOP 146 | valueSet 147 | valueType 148 | entity 149 | attribute 150 | concept 151 | predicate 152 | qualifier 153 | value 154 | number 155 | string 156 | 157 | 158 | atn: 159 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 60, 342, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 75, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 5, 11, 115, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 121, 10, 11, 5, 11, 123, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 144, 10, 12, 3, 13, 3, 13, 5, 13, 148, 10, 13, 3, 13, 5, 13, 151, 10, 13, 3, 13, 5, 13, 154, 10, 13, 3, 13, 3, 13, 5, 13, 158, 10, 13, 3, 13, 3, 13, 5, 13, 162, 10, 13, 3, 13, 5, 13, 165, 10, 13, 3, 13, 5, 13, 168, 10, 13, 3, 13, 3, 13, 3, 13, 5, 13, 173, 10, 13, 3, 13, 3, 13, 5, 13, 177, 10, 13, 3, 13, 3, 13, 3, 13, 5, 13, 182, 10, 13, 3, 14, 3, 14, 5, 14, 186, 10, 14, 3, 14, 3, 14, 5, 14, 190, 10, 14, 3, 14, 3, 14, 3, 14, 3, 15, 5, 15, 196, 10, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 5, 16, 203, 10, 16, 3, 16, 5, 16, 206, 10, 16, 3, 16, 3, 16, 5, 16, 210, 10, 16, 3, 16, 3, 16, 3, 16, 5, 16, 215, 10, 16, 3, 16, 5, 16, 218, 10, 16, 3, 16, 3, 16, 5, 16, 222, 10, 16, 3, 16, 3, 16, 5, 16, 226, 10, 16, 3, 16, 3, 16, 3, 16, 5, 16, 231, 10, 16, 3, 16, 5, 16, 234, 10, 16, 3, 16, 3, 16, 5, 16, 238, 10, 16, 3, 16, 3, 16, 3, 16, 5, 16, 243, 10, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 5, 18, 253, 10, 18, 3, 19, 3, 19, 5, 19, 257, 10, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 268, 10, 21, 3, 22, 3, 22, 5, 22, 272, 10, 22, 3, 23, 3, 23, 5, 23, 276, 10, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 292, 10, 24, 3, 24, 5, 24, 295, 10, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 5, 25, 303, 10, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 6, 33, 338, 10, 33, 13, 33, 14, 33, 339, 3, 33, 2, 2, 34, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 2, 2, 2, 373, 2, 74, 3, 2, 2, 2, 4, 78, 3, 2, 2, 2, 6, 81, 3, 2, 2, 2, 8, 86, 3, 2, 2, 2, 10, 92, 3, 2, 2, 2, 12, 97, 3, 2, 2, 2, 14, 100, 3, 2, 2, 2, 16, 103, 3, 2, 2, 2, 18, 108, 3, 2, 2, 2, 20, 122, 3, 2, 2, 2, 22, 143, 3, 2, 2, 2, 24, 181, 3, 2, 2, 2, 26, 185, 3, 2, 2, 2, 28, 195, 3, 2, 2, 2, 30, 242, 3, 2, 2, 2, 32, 244, 3, 2, 2, 2, 34, 252, 3, 2, 2, 2, 36, 256, 3, 2, 2, 2, 38, 258, 3, 2, 2, 2, 40, 267, 3, 2, 2, 2, 42, 271, 3, 2, 2, 2, 44, 275, 3, 2, 2, 2, 46, 294, 3, 2, 2, 2, 48, 302, 3, 2, 2, 2, 50, 304, 3, 2, 2, 2, 52, 308, 3, 2, 2, 2, 54, 312, 3, 2, 2, 2, 56, 316, 3, 2, 2, 2, 58, 320, 3, 2, 2, 2, 60, 324, 3, 2, 2, 2, 62, 328, 3, 2, 2, 2, 64, 337, 3, 2, 2, 2, 66, 75, 5, 4, 3, 2, 67, 75, 5, 6, 4, 2, 68, 75, 5, 8, 5, 2, 69, 75, 5, 10, 6, 2, 70, 75, 5, 12, 7, 2, 71, 75, 5, 14, 8, 2, 72, 75, 5, 16, 9, 2, 73, 75, 5, 18, 10, 2, 74, 66, 3, 2, 2, 2, 74, 67, 3, 2, 2, 2, 74, 68, 3, 2, 2, 2, 74, 69, 3, 2, 2, 2, 74, 70, 3, 2, 2, 2, 74, 71, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 74, 73, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 77, 7, 2, 2, 3, 77, 3, 3, 2, 2, 2, 78, 79, 7, 4, 2, 2, 79, 80, 5, 22, 12, 2, 80, 5, 3, 2, 2, 2, 81, 82, 7, 4, 2, 2, 82, 83, 5, 52, 27, 2, 83, 84, 7, 8, 2, 2, 84, 85, 5, 22, 12, 2, 85, 7, 3, 2, 2, 2, 86, 87, 7, 4, 2, 2, 87, 88, 7, 9, 2, 2, 88, 89, 5, 22, 12, 2, 89, 90, 7, 10, 2, 2, 90, 91, 5, 22, 12, 2, 91, 9, 3, 2, 2, 2, 92, 93, 7, 4, 2, 2, 93, 94, 5, 58, 30, 2, 94, 95, 7, 8, 2, 2, 95, 96, 5, 20, 11, 2, 96, 11, 3, 2, 2, 2, 97, 98, 7, 6, 2, 2, 98, 99, 5, 22, 12, 2, 99, 13, 3, 2, 2, 2, 100, 101, 7, 7, 2, 2, 101, 102, 5, 20, 11, 2, 102, 15, 3, 2, 2, 2, 103, 104, 7, 5, 2, 2, 104, 105, 5, 26, 14, 2, 105, 106, 7, 11, 2, 2, 106, 107, 5, 22, 12, 2, 107, 17, 3, 2, 2, 2, 108, 109, 7, 4, 2, 2, 109, 110, 5, 46, 24, 2, 110, 19, 3, 2, 2, 2, 111, 112, 5, 22, 12, 2, 112, 114, 5, 28, 15, 2, 113, 115, 5, 32, 17, 2, 114, 113, 3, 2, 2, 2, 114, 115, 3, 2, 2, 2, 115, 123, 3, 2, 2, 2, 116, 117, 5, 22, 12, 2, 117, 118, 5, 30, 16, 2, 118, 120, 5, 22, 12, 2, 119, 121, 5, 32, 17, 2, 120, 119, 3, 2, 2, 2, 120, 121, 3, 2, 2, 2, 121, 123, 3, 2, 2, 2, 122, 111, 3, 2, 2, 2, 122, 116, 3, 2, 2, 2, 123, 21, 3, 2, 2, 2, 124, 125, 7, 42, 2, 2, 125, 126, 5, 22, 12, 2, 126, 127, 5, 36, 19, 2, 127, 128, 5, 22, 12, 2, 128, 129, 7, 43, 2, 2, 129, 144, 3, 2, 2, 2, 130, 131, 7, 42, 2, 2, 131, 132, 5, 22, 12, 2, 132, 133, 7, 19, 2, 2, 133, 134, 5, 22, 12, 2, 134, 135, 7, 20, 2, 2, 135, 136, 7, 43, 2, 2, 136, 144, 3, 2, 2, 2, 137, 138, 7, 42, 2, 2, 138, 139, 5, 24, 13, 2, 139, 140, 7, 43, 2, 2, 140, 144, 3, 2, 2, 2, 141, 144, 5, 50, 26, 2, 142, 144, 7, 13, 2, 2, 143, 124, 3, 2, 2, 2, 143, 130, 3, 2, 2, 2, 143, 137, 3, 2, 2, 2, 143, 141, 3, 2, 2, 2, 143, 142, 3, 2, 2, 2, 144, 23, 3, 2, 2, 2, 145, 147, 5, 54, 28, 2, 146, 148, 5, 22, 12, 2, 147, 146, 3, 2, 2, 2, 147, 148, 3, 2, 2, 2, 148, 154, 3, 2, 2, 2, 149, 151, 5, 54, 28, 2, 150, 149, 3, 2, 2, 2, 150, 151, 3, 2, 2, 2, 151, 152, 3, 2, 2, 2, 152, 154, 5, 22, 12, 2, 153, 145, 3, 2, 2, 2, 153, 150, 3, 2, 2, 2, 154, 155, 3, 2, 2, 2, 155, 157, 5, 28, 15, 2, 156, 158, 5, 32, 17, 2, 157, 156, 3, 2, 2, 2, 157, 158, 3, 2, 2, 2, 158, 182, 3, 2, 2, 2, 159, 161, 5, 54, 28, 2, 160, 162, 5, 22, 12, 2, 161, 160, 3, 2, 2, 2, 161, 162, 3, 2, 2, 2, 162, 168, 3, 2, 2, 2, 163, 165, 5, 54, 28, 2, 164, 163, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 166, 3, 2, 2, 2, 166, 168, 5, 22, 12, 2, 167, 159, 3, 2, 2, 2, 167, 164, 3, 2, 2, 2, 168, 169, 3, 2, 2, 2, 169, 170, 5, 30, 16, 2, 170, 172, 5, 22, 12, 2, 171, 173, 5, 32, 17, 2, 172, 171, 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 182, 3, 2, 2, 2, 174, 176, 5, 54, 28, 2, 175, 177, 5, 22, 12, 2, 176, 175, 3, 2, 2, 2, 176, 177, 3, 2, 2, 2, 177, 182, 3, 2, 2, 2, 178, 179, 5, 22, 12, 2, 179, 180, 5, 26, 14, 2, 180, 182, 3, 2, 2, 2, 181, 153, 3, 2, 2, 2, 181, 167, 3, 2, 2, 2, 181, 174, 3, 2, 2, 2, 181, 178, 3, 2, 2, 2, 182, 25, 3, 2, 2, 2, 183, 184, 7, 16, 2, 2, 184, 186, 7, 17, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2, 2, 2, 186, 189, 3, 2, 2, 2, 187, 188, 7, 12, 2, 2, 188, 190, 5, 62, 32, 2, 189, 187, 3, 2, 2, 2, 189, 190, 3, 2, 2, 2, 190, 191, 3, 2, 2, 2, 191, 192, 5, 42, 22, 2, 192, 193, 5, 52, 27, 2, 193, 27, 3, 2, 2, 2, 194, 196, 7, 15, 2, 2, 195, 194, 3, 2, 2, 2, 195, 196, 3, 2, 2, 2, 196, 197, 3, 2, 2, 2, 197, 198, 5, 52, 27, 2, 198, 199, 5, 40, 21, 2, 199, 200, 5, 46, 24, 2, 200, 29, 3, 2, 2, 2, 201, 203, 7, 16, 2, 2, 202, 201, 3, 2, 2, 2, 202, 203, 3, 2, 2, 2, 203, 205, 3, 2, 2, 2, 204, 206, 5, 38, 20, 2, 205, 204, 3, 2, 2, 2, 205, 206, 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 209, 5, 56, 29, 2, 208, 210, 5, 34, 18, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2, 211, 212, 7, 10, 2, 2, 212, 243, 3, 2, 2, 2, 213, 215, 7, 16, 2, 2, 214, 213, 3, 2, 2, 2, 214, 215, 3, 2, 2, 2, 215, 217, 3, 2, 2, 2, 216, 218, 5, 38, 20, 2, 217, 216, 3, 2, 2, 2, 217, 218, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 219, 221, 5, 56, 29, 2, 220, 222, 5, 34, 18, 2, 221, 220, 3, 2, 2, 2, 221, 222, 3, 2, 2, 2, 222, 223, 3, 2, 2, 2, 223, 225, 7, 10, 2, 2, 224, 226, 5, 40, 21, 2, 225, 224, 3, 2, 2, 2, 225, 226, 3, 2, 2, 2, 226, 227, 3, 2, 2, 2, 227, 228, 5, 46, 24, 2, 228, 243, 3, 2, 2, 2, 229, 231, 7, 16, 2, 2, 230, 229, 3, 2, 2, 2, 230, 231, 3, 2, 2, 2, 231, 233, 3, 2, 2, 2, 232, 234, 5, 38, 20, 2, 233, 232, 3, 2, 2, 2, 233, 234, 3, 2, 2, 2, 234, 235, 3, 2, 2, 2, 235, 237, 5, 56, 29, 2, 236, 238, 5, 34, 18, 2, 237, 236, 3, 2, 2, 2, 237, 238, 3, 2, 2, 2, 238, 239, 3, 2, 2, 2, 239, 240, 7, 10, 2, 2, 240, 241, 5, 42, 22, 2, 241, 243, 3, 2, 2, 2, 242, 202, 3, 2, 2, 2, 242, 214, 3, 2, 2, 2, 242, 230, 3, 2, 2, 2, 243, 31, 3, 2, 2, 2, 244, 245, 7, 19, 2, 2, 245, 246, 5, 58, 30, 2, 246, 247, 5, 40, 21, 2, 247, 248, 5, 46, 24, 2, 248, 249, 7, 20, 2, 2, 249, 33, 3, 2, 2, 2, 250, 253, 7, 21, 2, 2, 251, 253, 7, 22, 2, 2, 252, 250, 3, 2, 2, 2, 252, 251, 3, 2, 2, 2, 253, 35, 3, 2, 2, 2, 254, 257, 7, 23, 2, 2, 255, 257, 7, 24, 2, 2, 256, 254, 3, 2, 2, 2, 256, 255, 3, 2, 2, 2, 257, 37, 3, 2, 2, 2, 258, 259, 7, 18, 2, 2, 259, 39, 3, 2, 2, 2, 260, 268, 7, 28, 2, 2, 261, 268, 7, 18, 2, 2, 262, 268, 7, 27, 2, 2, 263, 268, 7, 29, 2, 2, 264, 268, 7, 30, 2, 2, 265, 268, 7, 31, 2, 2, 266, 268, 7, 32, 2, 2, 267, 260, 3, 2, 2, 2, 267, 261, 3, 2, 2, 2, 267, 262, 3, 2, 2, 2, 267, 263, 3, 2, 2, 2, 267, 264, 3, 2, 2, 2, 267, 265, 3, 2, 2, 2, 267, 266, 3, 2, 2, 2, 268, 41, 3, 2, 2, 2, 269, 272, 7, 33, 2, 2, 270, 272, 7, 34, 2, 2, 271, 269, 3, 2, 2, 2, 271, 270, 3, 2, 2, 2, 272, 43, 3, 2, 2, 2, 273, 276, 7, 25, 2, 2, 274, 276, 7, 26, 2, 2, 275, 273, 3, 2, 2, 2, 275, 274, 3, 2, 2, 2, 276, 45, 3, 2, 2, 2, 277, 278, 5, 48, 25, 2, 278, 279, 5, 46, 24, 2, 279, 280, 7, 24, 2, 2, 280, 281, 5, 46, 24, 2, 281, 295, 3, 2, 2, 2, 282, 283, 5, 44, 23, 2, 283, 284, 7, 8, 2, 2, 284, 285, 5, 46, 24, 2, 285, 295, 3, 2, 2, 2, 286, 287, 5, 52, 27, 2, 287, 288, 7, 8, 2, 2, 288, 289, 5, 22, 12, 2, 289, 295, 3, 2, 2, 2, 290, 292, 5, 48, 25, 2, 291, 290, 3, 2, 2, 2, 291, 292, 3, 2, 2, 2, 292, 293, 3, 2, 2, 2, 293, 295, 5, 60, 31, 2, 294, 277, 3, 2, 2, 2, 294, 282, 3, 2, 2, 2, 294, 286, 3, 2, 2, 2, 294, 291, 3, 2, 2, 2, 295, 47, 3, 2, 2, 2, 296, 303, 7, 35, 2, 2, 297, 303, 7, 36, 2, 2, 298, 303, 7, 37, 2, 2, 299, 303, 7, 38, 2, 2, 300, 303, 7, 39, 2, 2, 301, 303, 7, 40, 2, 2, 302, 296, 3, 2, 2, 2, 302, 297, 3, 2, 2, 2, 302, 298, 3, 2, 2, 2, 302, 299, 3, 2, 2, 2, 302, 300, 3, 2, 2, 2, 302, 301, 3, 2, 2, 2, 303, 49, 3, 2, 2, 2, 304, 305, 7, 44, 2, 2, 305, 306, 5, 64, 33, 2, 306, 307, 7, 54, 2, 2, 307, 51, 3, 2, 2, 2, 308, 309, 7, 45, 2, 2, 309, 310, 5, 64, 33, 2, 310, 311, 7, 55, 2, 2, 311, 53, 3, 2, 2, 2, 312, 313, 7, 47, 2, 2, 313, 314, 5, 64, 33, 2, 314, 315, 7, 57, 2, 2, 315, 55, 3, 2, 2, 2, 316, 317, 7, 46, 2, 2, 317, 318, 5, 64, 33, 2, 318, 319, 7, 56, 2, 2, 319, 57, 3, 2, 2, 2, 320, 321, 7, 48, 2, 2, 321, 322, 5, 64, 33, 2, 322, 323, 7, 58, 2, 2, 323, 59, 3, 2, 2, 2, 324, 325, 7, 49, 2, 2, 325, 326, 5, 64, 33, 2, 326, 327, 7, 59, 2, 2, 327, 61, 3, 2, 2, 2, 328, 329, 7, 50, 2, 2, 329, 63, 3, 2, 2, 2, 330, 338, 7, 41, 2, 2, 331, 338, 7, 53, 2, 2, 332, 333, 7, 19, 2, 2, 333, 334, 5, 64, 33, 2, 334, 335, 7, 20, 2, 2, 335, 338, 3, 2, 2, 2, 336, 338, 7, 60, 2, 2, 337, 330, 3, 2, 2, 2, 337, 331, 3, 2, 2, 2, 337, 332, 3, 2, 2, 2, 337, 336, 3, 2, 2, 2, 338, 339, 3, 2, 2, 2, 339, 337, 3, 2, 2, 2, 339, 340, 3, 2, 2, 2, 340, 65, 3, 2, 2, 2, 41, 74, 114, 120, 122, 143, 147, 150, 153, 157, 161, 164, 167, 172, 176, 181, 185, 189, 195, 202, 205, 209, 214, 217, 221, 225, 230, 233, 237, 242, 252, 256, 267, 271, 275, 291, 294, 302, 337, 339] -------------------------------------------------------------------------------- /cypher/CypherLexer.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'CALL' 4 | 'MATCH' 5 | 'WHERE' 6 | 'RETURN' 7 | 'UNION' 8 | 'WITH' 9 | 'AS' 10 | 'AND' 11 | 'OR' 12 | 'ORDER BY' 13 | 'LIMIT' 14 | 'DISTINCT' 15 | 'count' 16 | 'isEmpty' 17 | 'DESC' 18 | null 19 | '(' 20 | ')' 21 | '{' 22 | ':' 23 | '->' 24 | '<-' 25 | '-' 26 | '}' 27 | '[' 28 | ']' 29 | '=' 30 | '<>' 31 | '>=' 32 | '>' 33 | '<=' 34 | '<' 35 | '.' 36 | null 37 | null 38 | null 39 | '|' 40 | ',' 41 | null 42 | 43 | token symbolic names: 44 | null 45 | Call 46 | Match 47 | Where 48 | Return 49 | Union 50 | With 51 | As 52 | And 53 | Or 54 | OrderBy 55 | Limit 56 | Distinct 57 | CountFunction 58 | IsEmptyFunction 59 | Desc 60 | SEP 61 | LP 62 | RP 63 | LB 64 | COL 65 | TORIGHT 66 | TOLEFT 67 | UND 68 | RB 69 | LSB 70 | RSB 71 | EQ 72 | NEQ 73 | GTE 74 | GT 75 | LTE 76 | LT 77 | DOT 78 | INTEGER 79 | STRING_SYMBOL 80 | STRING_LITERAL 81 | OR 82 | COMMA 83 | WS 84 | 85 | rule names: 86 | Call 87 | Match 88 | Where 89 | Return 90 | Union 91 | With 92 | As 93 | And 94 | Or 95 | OrderBy 96 | Limit 97 | Distinct 98 | CountFunction 99 | IsEmptyFunction 100 | Desc 101 | SEP 102 | LP 103 | RP 104 | LB 105 | COL 106 | TORIGHT 107 | TOLEFT 108 | UND 109 | RB 110 | LSB 111 | RSB 112 | EQ 113 | NEQ 114 | GTE 115 | GT 116 | LTE 117 | LT 118 | DOT 119 | INTEGER 120 | STRING_SYMBOL 121 | STRING_LITERAL 122 | OR 123 | COMMA 124 | DIGIT 125 | SYMBOL 126 | CHAR 127 | WS 128 | 129 | channel names: 130 | DEFAULT_TOKEN_CHANNEL 131 | HIDDEN 132 | 133 | mode names: 134 | DEFAULT_MODE 135 | 136 | atn: 137 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 41, 250, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 6, 35, 218, 10, 35, 13, 35, 14, 35, 219, 3, 36, 6, 36, 223, 10, 36, 13, 36, 14, 36, 224, 3, 37, 6, 37, 228, 10, 37, 13, 37, 14, 37, 229, 3, 38, 3, 38, 3, 39, 3, 39, 3, 40, 5, 40, 237, 10, 40, 3, 41, 3, 41, 3, 42, 5, 42, 242, 10, 42, 3, 43, 6, 43, 245, 10, 43, 13, 43, 14, 43, 246, 3, 43, 3, 43, 2, 2, 44, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 2, 81, 2, 83, 2, 85, 41, 3, 2, 5, 4, 2, 36, 36, 41, 41, 9, 2, 35, 35, 39, 39, 44, 44, 46, 46, 49, 49, 65, 65, 163, 163, 5, 2, 11, 12, 15, 15, 34, 34, 4, 63, 2, 50, 2, 59, 2, 180, 2, 181, 2, 187, 2, 187, 2, 190, 2, 192, 2, 2550, 2, 2555, 2, 2932, 2, 2937, 2, 3058, 2, 3060, 2, 3194, 2, 3200, 2, 3418, 2, 3424, 2, 3442, 2, 3450, 2, 3884, 2, 3893, 2, 4971, 2, 4990, 2, 6130, 2, 6139, 2, 6620, 2, 6620, 2, 8306, 2, 8306, 2, 8310, 2, 8315, 2, 8322, 2, 8331, 2, 8530, 2, 8545, 2, 8587, 2, 8587, 2, 9314, 2, 9373, 2, 9452, 2, 9473, 2, 10104, 2, 10133, 2, 11519, 2, 11519, 2, 12692, 2, 12695, 2, 12834, 2, 12843, 2, 12874, 2, 12881, 2, 12883, 2, 12897, 2, 12930, 2, 12939, 2, 12979, 2, 12993, 2, 43058, 2, 43063, 2, 265, 3, 309, 3, 375, 3, 378, 3, 396, 3, 397, 3, 739, 3, 765, 3, 802, 3, 805, 3, 2138, 3, 2145, 3, 2171, 3, 2177, 3, 2217, 3, 2225, 3, 2301, 3, 2305, 3, 2328, 3, 2333, 3, 2494, 3, 2495, 3, 2498, 3, 2513, 3, 2516, 3, 2561, 3, 2626, 3, 2633, 3, 2687, 3, 2688, 3, 2719, 3, 2721, 3, 2797, 3, 2801, 3, 2906, 3, 2913, 3, 2938, 3, 2945, 3, 2987, 3, 2993, 3, 3324, 3, 3329, 3, 3682, 3, 3712, 3, 4180, 3, 4199, 3, 4579, 3, 4598, 3, 5948, 3, 5949, 3, 6380, 3, 6388, 3, 7260, 3, 7278, 3, 27485, 3, 27491, 3, 54114, 3, 54131, 3, 59593, 3, 59601, 3, 61698, 3, 61710, 3, 187, 2, 38, 2, 38, 2, 45, 2, 45, 2, 62, 2, 64, 2, 67, 2, 92, 2, 97, 2, 97, 2, 99, 2, 124, 2, 126, 2, 126, 2, 128, 2, 128, 2, 164, 2, 167, 2, 174, 2, 174, 2, 179, 2, 179, 2, 183, 2, 183, 2, 194, 2, 444, 2, 446, 2, 449, 2, 454, 2, 454, 2, 456, 2, 457, 2, 459, 2, 460, 2, 462, 2, 499, 2, 501, 2, 661, 2, 663, 2, 689, 2, 882, 2, 885, 2, 888, 2, 889, 2, 893, 2, 895, 2, 897, 2, 897, 2, 904, 2, 904, 2, 906, 2, 908, 2, 910, 2, 910, 2, 912, 2, 931, 2, 933, 2, 1155, 2, 1164, 2, 1329, 2, 1331, 2, 1368, 2, 1379, 2, 1417, 2, 1425, 2, 1425, 2, 1544, 2, 1546, 2, 1549, 2, 1549, 2, 2548, 2, 2549, 2, 2557, 2, 2557, 2, 2803, 2, 2803, 2, 3067, 2, 3067, 2, 3649, 2, 3649, 2, 4258, 2, 4295, 2, 4297, 2, 4297, 2, 4303, 2, 4303, 2, 5026, 2, 5111, 2, 5114, 2, 5119, 2, 6109, 2, 6109, 2, 7298, 2, 7306, 2, 7426, 2, 7469, 2, 7533, 2, 7545, 2, 7547, 2, 7580, 2, 7682, 2, 7959, 2, 7962, 2, 7967, 2, 7970, 2, 8007, 2, 8010, 2, 8015, 2, 8018, 2, 8025, 2, 8027, 2, 8027, 2, 8029, 2, 8029, 2, 8031, 2, 8031, 2, 8033, 2, 8063, 2, 8066, 2, 8073, 2, 8082, 2, 8089, 2, 8098, 2, 8105, 2, 8114, 2, 8118, 2, 8120, 2, 8125, 2, 8128, 2, 8128, 2, 8132, 2, 8134, 2, 8136, 2, 8141, 2, 8146, 2, 8149, 2, 8152, 2, 8157, 2, 8162, 2, 8174, 2, 8180, 2, 8182, 2, 8184, 2, 8189, 2, 8262, 2, 8262, 2, 8276, 2, 8276, 2, 8316, 2, 8318, 2, 8332, 2, 8334, 2, 8354, 2, 8385, 2, 8452, 2, 8452, 2, 8457, 2, 8457, 2, 8460, 2, 8469, 2, 8471, 2, 8471, 2, 8474, 2, 8479, 2, 8486, 2, 8486, 2, 8488, 2, 8488, 2, 8490, 2, 8490, 2, 8492, 2, 8495, 2, 8497, 2, 8502, 2, 8507, 2, 8507, 2, 8510, 2, 8523, 2, 8525, 2, 8525, 2, 8528, 2, 8528, 2, 8581, 2, 8582, 2, 8594, 2, 8598, 2, 8604, 2, 8605, 2, 8610, 2, 8610, 2, 8613, 2, 8613, 2, 8616, 2, 8616, 2, 8624, 2, 8624, 2, 8656, 2, 8657, 2, 8660, 2, 8660, 2, 8662, 2, 8662, 2, 8694, 2, 8961, 2, 8994, 2, 8995, 2, 9086, 2, 9086, 2, 9117, 2, 9141, 2, 9182, 2, 9187, 2, 9657, 2, 9657, 2, 9667, 2, 9667, 2, 9722, 2, 9729, 2, 9841, 2, 9841, 2, 10178, 2, 10182, 2, 10185, 2, 10215, 2, 10226, 2, 10241, 2, 10498, 2, 10628, 2, 10651, 2, 10713, 2, 10718, 2, 10749, 2, 10752, 2, 11009, 2, 11058, 2, 11078, 2, 11081, 2, 11086, 2, 11266, 2, 11312, 2, 11314, 2, 11360, 2, 11362, 2, 11389, 2, 11392, 2, 11494, 2, 11501, 2, 11504, 2, 11508, 2, 11509, 2, 11522, 2, 11559, 2, 11561, 2, 11561, 2, 11567, 2, 11567, 2, 42562, 2, 42607, 2, 42626, 2, 42653, 2, 42788, 2, 42865, 2, 42867, 2, 42889, 2, 42893, 2, 42896, 2, 42898, 2, 42928, 2, 42930, 2, 42937, 2, 43004, 2, 43004, 2, 43066, 2, 43066, 2, 43826, 2, 43868, 2, 43874, 2, 43879, 2, 43890, 2, 43969, 2, 64258, 2, 64264, 2, 64277, 2, 64281, 2, 64299, 2, 64299, 2, 65022, 2, 65022, 2, 65124, 2, 65124, 2, 65126, 2, 65128, 2, 65131, 2, 65131, 2, 65286, 2, 65286, 2, 65293, 2, 65293, 2, 65310, 2, 65312, 2, 65315, 2, 65340, 2, 65347, 2, 65372, 2, 65374, 2, 65374, 2, 65376, 2, 65376, 2, 65506, 2, 65508, 2, 65511, 2, 65512, 2, 65515, 2, 65518, 2, 1026, 3, 1105, 3, 1202, 3, 1237, 3, 1242, 3, 1277, 3, 3202, 3, 3252, 3, 3266, 3, 3316, 3, 6306, 3, 6369, 3, 54274, 3, 54358, 3, 54360, 3, 54430, 3, 54432, 3, 54433, 3, 54436, 3, 54436, 3, 54439, 3, 54440, 3, 54443, 3, 54446, 3, 54448, 3, 54459, 3, 54461, 3, 54461, 3, 54463, 3, 54469, 3, 54471, 3, 54535, 3, 54537, 3, 54540, 3, 54543, 3, 54550, 3, 54552, 3, 54558, 3, 54560, 3, 54587, 3, 54589, 3, 54592, 3, 54594, 3, 54598, 3, 54600, 3, 54600, 3, 54604, 3, 54610, 3, 54612, 3, 54951, 3, 54954, 3, 55245, 3, 59650, 3, 59717, 3, 61170, 3, 61171, 3, 250, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 3, 87, 3, 2, 2, 2, 5, 92, 3, 2, 2, 2, 7, 98, 3, 2, 2, 2, 9, 104, 3, 2, 2, 2, 11, 111, 3, 2, 2, 2, 13, 117, 3, 2, 2, 2, 15, 122, 3, 2, 2, 2, 17, 125, 3, 2, 2, 2, 19, 129, 3, 2, 2, 2, 21, 132, 3, 2, 2, 2, 23, 141, 3, 2, 2, 2, 25, 147, 3, 2, 2, 2, 27, 156, 3, 2, 2, 2, 29, 162, 3, 2, 2, 2, 31, 170, 3, 2, 2, 2, 33, 175, 3, 2, 2, 2, 35, 177, 3, 2, 2, 2, 37, 179, 3, 2, 2, 2, 39, 181, 3, 2, 2, 2, 41, 183, 3, 2, 2, 2, 43, 185, 3, 2, 2, 2, 45, 188, 3, 2, 2, 2, 47, 191, 3, 2, 2, 2, 49, 193, 3, 2, 2, 2, 51, 195, 3, 2, 2, 2, 53, 197, 3, 2, 2, 2, 55, 199, 3, 2, 2, 2, 57, 201, 3, 2, 2, 2, 59, 204, 3, 2, 2, 2, 61, 207, 3, 2, 2, 2, 63, 209, 3, 2, 2, 2, 65, 212, 3, 2, 2, 2, 67, 214, 3, 2, 2, 2, 69, 217, 3, 2, 2, 2, 71, 222, 3, 2, 2, 2, 73, 227, 3, 2, 2, 2, 75, 231, 3, 2, 2, 2, 77, 233, 3, 2, 2, 2, 79, 236, 3, 2, 2, 2, 81, 238, 3, 2, 2, 2, 83, 241, 3, 2, 2, 2, 85, 244, 3, 2, 2, 2, 87, 88, 7, 69, 2, 2, 88, 89, 7, 67, 2, 2, 89, 90, 7, 78, 2, 2, 90, 91, 7, 78, 2, 2, 91, 4, 3, 2, 2, 2, 92, 93, 7, 79, 2, 2, 93, 94, 7, 67, 2, 2, 94, 95, 7, 86, 2, 2, 95, 96, 7, 69, 2, 2, 96, 97, 7, 74, 2, 2, 97, 6, 3, 2, 2, 2, 98, 99, 7, 89, 2, 2, 99, 100, 7, 74, 2, 2, 100, 101, 7, 71, 2, 2, 101, 102, 7, 84, 2, 2, 102, 103, 7, 71, 2, 2, 103, 8, 3, 2, 2, 2, 104, 105, 7, 84, 2, 2, 105, 106, 7, 71, 2, 2, 106, 107, 7, 86, 2, 2, 107, 108, 7, 87, 2, 2, 108, 109, 7, 84, 2, 2, 109, 110, 7, 80, 2, 2, 110, 10, 3, 2, 2, 2, 111, 112, 7, 87, 2, 2, 112, 113, 7, 80, 2, 2, 113, 114, 7, 75, 2, 2, 114, 115, 7, 81, 2, 2, 115, 116, 7, 80, 2, 2, 116, 12, 3, 2, 2, 2, 117, 118, 7, 89, 2, 2, 118, 119, 7, 75, 2, 2, 119, 120, 7, 86, 2, 2, 120, 121, 7, 74, 2, 2, 121, 14, 3, 2, 2, 2, 122, 123, 7, 67, 2, 2, 123, 124, 7, 85, 2, 2, 124, 16, 3, 2, 2, 2, 125, 126, 7, 67, 2, 2, 126, 127, 7, 80, 2, 2, 127, 128, 7, 70, 2, 2, 128, 18, 3, 2, 2, 2, 129, 130, 7, 81, 2, 2, 130, 131, 7, 84, 2, 2, 131, 20, 3, 2, 2, 2, 132, 133, 7, 81, 2, 2, 133, 134, 7, 84, 2, 2, 134, 135, 7, 70, 2, 2, 135, 136, 7, 71, 2, 2, 136, 137, 7, 84, 2, 2, 137, 138, 7, 34, 2, 2, 138, 139, 7, 68, 2, 2, 139, 140, 7, 91, 2, 2, 140, 22, 3, 2, 2, 2, 141, 142, 7, 78, 2, 2, 142, 143, 7, 75, 2, 2, 143, 144, 7, 79, 2, 2, 144, 145, 7, 75, 2, 2, 145, 146, 7, 86, 2, 2, 146, 24, 3, 2, 2, 2, 147, 148, 7, 70, 2, 2, 148, 149, 7, 75, 2, 2, 149, 150, 7, 85, 2, 2, 150, 151, 7, 86, 2, 2, 151, 152, 7, 75, 2, 2, 152, 153, 7, 80, 2, 2, 153, 154, 7, 69, 2, 2, 154, 155, 7, 86, 2, 2, 155, 26, 3, 2, 2, 2, 156, 157, 7, 101, 2, 2, 157, 158, 7, 113, 2, 2, 158, 159, 7, 119, 2, 2, 159, 160, 7, 112, 2, 2, 160, 161, 7, 118, 2, 2, 161, 28, 3, 2, 2, 2, 162, 163, 7, 107, 2, 2, 163, 164, 7, 117, 2, 2, 164, 165, 7, 71, 2, 2, 165, 166, 7, 111, 2, 2, 166, 167, 7, 114, 2, 2, 167, 168, 7, 118, 2, 2, 168, 169, 7, 123, 2, 2, 169, 30, 3, 2, 2, 2, 170, 171, 7, 70, 2, 2, 171, 172, 7, 71, 2, 2, 172, 173, 7, 85, 2, 2, 173, 174, 7, 69, 2, 2, 174, 32, 3, 2, 2, 2, 175, 176, 9, 2, 2, 2, 176, 34, 3, 2, 2, 2, 177, 178, 7, 42, 2, 2, 178, 36, 3, 2, 2, 2, 179, 180, 7, 43, 2, 2, 180, 38, 3, 2, 2, 2, 181, 182, 7, 125, 2, 2, 182, 40, 3, 2, 2, 2, 183, 184, 7, 60, 2, 2, 184, 42, 3, 2, 2, 2, 185, 186, 7, 47, 2, 2, 186, 187, 7, 64, 2, 2, 187, 44, 3, 2, 2, 2, 188, 189, 7, 62, 2, 2, 189, 190, 7, 47, 2, 2, 190, 46, 3, 2, 2, 2, 191, 192, 7, 47, 2, 2, 192, 48, 3, 2, 2, 2, 193, 194, 7, 127, 2, 2, 194, 50, 3, 2, 2, 2, 195, 196, 7, 93, 2, 2, 196, 52, 3, 2, 2, 2, 197, 198, 7, 95, 2, 2, 198, 54, 3, 2, 2, 2, 199, 200, 7, 63, 2, 2, 200, 56, 3, 2, 2, 2, 201, 202, 7, 62, 2, 2, 202, 203, 7, 64, 2, 2, 203, 58, 3, 2, 2, 2, 204, 205, 7, 64, 2, 2, 205, 206, 7, 63, 2, 2, 206, 60, 3, 2, 2, 2, 207, 208, 7, 64, 2, 2, 208, 62, 3, 2, 2, 2, 209, 210, 7, 62, 2, 2, 210, 211, 7, 63, 2, 2, 211, 64, 3, 2, 2, 2, 212, 213, 7, 62, 2, 2, 213, 66, 3, 2, 2, 2, 214, 215, 7, 48, 2, 2, 215, 68, 3, 2, 2, 2, 216, 218, 5, 79, 40, 2, 217, 216, 3, 2, 2, 2, 218, 219, 3, 2, 2, 2, 219, 217, 3, 2, 2, 2, 219, 220, 3, 2, 2, 2, 220, 70, 3, 2, 2, 2, 221, 223, 5, 81, 41, 2, 222, 221, 3, 2, 2, 2, 223, 224, 3, 2, 2, 2, 224, 222, 3, 2, 2, 2, 224, 225, 3, 2, 2, 2, 225, 72, 3, 2, 2, 2, 226, 228, 5, 83, 42, 2, 227, 226, 3, 2, 2, 2, 228, 229, 3, 2, 2, 2, 229, 227, 3, 2, 2, 2, 229, 230, 3, 2, 2, 2, 230, 74, 3, 2, 2, 2, 231, 232, 7, 126, 2, 2, 232, 76, 3, 2, 2, 2, 233, 234, 7, 46, 2, 2, 234, 78, 3, 2, 2, 2, 235, 237, 9, 5, 2, 2, 236, 235, 3, 2, 2, 2, 237, 80, 3, 2, 2, 2, 238, 239, 9, 3, 2, 2, 239, 82, 3, 2, 2, 2, 240, 242, 9, 6, 2, 2, 241, 240, 3, 2, 2, 2, 242, 84, 3, 2, 2, 2, 243, 245, 9, 4, 2, 2, 244, 243, 3, 2, 2, 2, 245, 246, 3, 2, 2, 2, 246, 244, 3, 2, 2, 2, 246, 247, 3, 2, 2, 2, 247, 248, 3, 2, 2, 2, 248, 249, 8, 43, 2, 2, 249, 86, 3, 2, 2, 2, 9, 2, 219, 224, 229, 236, 241, 246, 3, 8, 2, 2] -------------------------------------------------------------------------------- /overnight/Overnight.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'en.' 4 | '.' 5 | 'string' 6 | 'number' 7 | '!' 8 | 'type' 9 | 'var' 10 | 'lambda' 11 | '=' 12 | '<' 13 | '>' 14 | 'min' 15 | 'max' 16 | 'sum' 17 | 'avg' 18 | 'listValue' 19 | 'size' 20 | 'domain' 21 | 'singleton' 22 | 'filter' 23 | 'getProperty' 24 | 'superlative' 25 | 'countSuperlative' 26 | 'countComparative' 27 | 'aggregate' 28 | 'concat' 29 | 'reverse' 30 | 'ensureNumericProperty' 31 | 'ensureNumericEntity' 32 | 'date' 33 | 'year' 34 | 'time' 35 | null 36 | '(' 37 | ')' 38 | null 39 | null 40 | null 41 | null 42 | null 43 | null 44 | 45 | token symbolic names: 46 | null 47 | null 48 | null 49 | null 50 | null 51 | null 52 | null 53 | null 54 | null 55 | null 56 | null 57 | null 58 | null 59 | null 60 | null 61 | null 62 | null 63 | null 64 | null 65 | null 66 | null 67 | null 68 | null 69 | null 70 | null 71 | null 72 | null 73 | null 74 | null 75 | null 76 | null 77 | null 78 | null 79 | PREFIX 80 | LB 81 | RB 82 | DATE 83 | YEAR 84 | TIME 85 | INTEGER 86 | STRING_LITERAL 87 | WS 88 | 89 | rule names: 90 | root 91 | np 92 | entity 93 | concept 94 | predicate 95 | relNP 96 | reversePredicate 97 | value 98 | constraintNP 99 | cp 100 | filterCP 101 | superlativeCP 102 | comparativeCP 103 | op 104 | aggregateType 105 | listValue 106 | size 107 | domain 108 | singleton 109 | filterFunc 110 | getProperty 111 | superlative 112 | countSuperlative 113 | countComparative 114 | aggregate 115 | concat 116 | reverse 117 | ensureNumericProperty 118 | ensureNumericEntity 119 | string 120 | date 121 | year 122 | time 123 | quantity 124 | 125 | 126 | atn: 127 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 43, 437, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3, 114, 10, 3, 3, 4, 5, 4, 117, 10, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 124, 10, 4, 3, 5, 5, 5, 127, 10, 5, 3, 5, 3, 5, 3, 5, 5, 5, 132, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 149, 10, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 5, 8, 161, 10, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 184, 10, 9, 3, 9, 5, 9, 187, 10, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 203, 10, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 230, 10, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 5, 11, 241, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 273, 10, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 305, 10, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 333, 10, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 5, 15, 370, 10, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 5, 16, 380, 10, 16, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 31, 6, 31, 425, 10, 31, 13, 31, 14, 31, 426, 3, 32, 3, 32, 3, 33, 3, 33, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 2, 2, 36, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 2, 3, 5, 2, 19, 19, 32, 34, 41, 42, 2, 447, 2, 70, 3, 2, 2, 2, 4, 113, 3, 2, 2, 2, 6, 116, 3, 2, 2, 2, 8, 126, 3, 2, 2, 2, 10, 133, 3, 2, 2, 2, 12, 148, 3, 2, 2, 2, 14, 160, 3, 2, 2, 2, 16, 202, 3, 2, 2, 2, 18, 229, 3, 2, 2, 2, 20, 240, 3, 2, 2, 2, 22, 272, 3, 2, 2, 2, 24, 304, 3, 2, 2, 2, 26, 332, 3, 2, 2, 2, 28, 369, 3, 2, 2, 2, 30, 379, 3, 2, 2, 2, 32, 381, 3, 2, 2, 2, 34, 384, 3, 2, 2, 2, 36, 387, 3, 2, 2, 2, 38, 390, 3, 2, 2, 2, 40, 393, 3, 2, 2, 2, 42, 396, 3, 2, 2, 2, 44, 399, 3, 2, 2, 2, 46, 402, 3, 2, 2, 2, 48, 405, 3, 2, 2, 2, 50, 408, 3, 2, 2, 2, 52, 411, 3, 2, 2, 2, 54, 414, 3, 2, 2, 2, 56, 417, 3, 2, 2, 2, 58, 420, 3, 2, 2, 2, 60, 424, 3, 2, 2, 2, 62, 428, 3, 2, 2, 2, 64, 430, 3, 2, 2, 2, 66, 432, 3, 2, 2, 2, 68, 434, 3, 2, 2, 2, 70, 71, 7, 36, 2, 2, 71, 72, 5, 32, 17, 2, 72, 73, 5, 4, 3, 2, 73, 74, 7, 37, 2, 2, 74, 3, 3, 2, 2, 2, 75, 114, 5, 20, 11, 2, 76, 114, 5, 6, 4, 2, 77, 78, 7, 36, 2, 2, 78, 79, 5, 42, 22, 2, 79, 80, 5, 4, 3, 2, 80, 81, 5, 12, 7, 2, 81, 82, 7, 37, 2, 2, 82, 114, 3, 2, 2, 2, 83, 114, 5, 16, 9, 2, 84, 85, 7, 36, 2, 2, 85, 86, 5, 52, 27, 2, 86, 87, 5, 4, 3, 2, 87, 88, 5, 4, 3, 2, 88, 89, 7, 37, 2, 2, 89, 114, 3, 2, 2, 2, 90, 91, 7, 36, 2, 2, 91, 92, 5, 50, 26, 2, 92, 93, 5, 30, 16, 2, 93, 94, 5, 4, 3, 2, 94, 114, 3, 2, 2, 2, 95, 96, 7, 36, 2, 2, 96, 97, 5, 34, 18, 2, 97, 98, 5, 4, 3, 2, 98, 99, 7, 37, 2, 2, 99, 114, 3, 2, 2, 2, 100, 101, 7, 36, 2, 2, 101, 102, 5, 42, 22, 2, 102, 103, 7, 36, 2, 2, 103, 104, 5, 20, 11, 2, 104, 105, 7, 36, 2, 2, 105, 106, 5, 36, 19, 2, 106, 107, 5, 12, 7, 2, 107, 108, 7, 37, 2, 2, 108, 109, 7, 37, 2, 2, 109, 110, 5, 12, 7, 2, 110, 111, 7, 37, 2, 2, 111, 114, 3, 2, 2, 2, 112, 114, 5, 18, 10, 2, 113, 75, 3, 2, 2, 2, 113, 76, 3, 2, 2, 2, 113, 77, 3, 2, 2, 2, 113, 83, 3, 2, 2, 2, 113, 84, 3, 2, 2, 2, 113, 90, 3, 2, 2, 2, 113, 95, 3, 2, 2, 2, 113, 100, 3, 2, 2, 2, 113, 112, 3, 2, 2, 2, 114, 5, 3, 2, 2, 2, 115, 117, 7, 36, 2, 2, 116, 115, 3, 2, 2, 2, 116, 117, 3, 2, 2, 2, 117, 118, 3, 2, 2, 2, 118, 119, 7, 3, 2, 2, 119, 120, 5, 60, 31, 2, 120, 121, 7, 4, 2, 2, 121, 123, 5, 60, 31, 2, 122, 124, 7, 37, 2, 2, 123, 122, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124, 7, 3, 2, 2, 2, 125, 127, 7, 36, 2, 2, 126, 125, 3, 2, 2, 2, 126, 127, 3, 2, 2, 2, 127, 128, 3, 2, 2, 2, 128, 129, 7, 3, 2, 2, 129, 131, 5, 60, 31, 2, 130, 132, 7, 37, 2, 2, 131, 130, 3, 2, 2, 2, 131, 132, 3, 2, 2, 2, 132, 9, 3, 2, 2, 2, 133, 134, 7, 36, 2, 2, 134, 135, 7, 5, 2, 2, 135, 136, 5, 60, 31, 2, 136, 137, 7, 37, 2, 2, 137, 11, 3, 2, 2, 2, 138, 139, 7, 36, 2, 2, 139, 140, 7, 5, 2, 2, 140, 141, 5, 60, 31, 2, 141, 142, 7, 37, 2, 2, 142, 149, 3, 2, 2, 2, 143, 144, 7, 36, 2, 2, 144, 145, 5, 56, 29, 2, 145, 146, 5, 12, 7, 2, 146, 147, 7, 37, 2, 2, 147, 149, 3, 2, 2, 2, 148, 138, 3, 2, 2, 2, 148, 143, 3, 2, 2, 2, 149, 13, 3, 2, 2, 2, 150, 151, 7, 36, 2, 2, 151, 152, 5, 54, 28, 2, 152, 153, 5, 10, 6, 2, 153, 154, 7, 37, 2, 2, 154, 161, 3, 2, 2, 2, 155, 156, 7, 36, 2, 2, 156, 157, 5, 54, 28, 2, 157, 158, 5, 12, 7, 2, 158, 159, 7, 37, 2, 2, 159, 161, 3, 2, 2, 2, 160, 150, 3, 2, 2, 2, 160, 155, 3, 2, 2, 2, 161, 15, 3, 2, 2, 2, 162, 163, 7, 36, 2, 2, 163, 164, 5, 52, 27, 2, 164, 165, 5, 16, 9, 2, 165, 166, 5, 16, 9, 2, 166, 167, 7, 37, 2, 2, 167, 203, 3, 2, 2, 2, 168, 169, 7, 36, 2, 2, 169, 170, 5, 42, 22, 2, 170, 171, 5, 4, 3, 2, 171, 172, 5, 12, 7, 2, 172, 173, 7, 37, 2, 2, 173, 203, 3, 2, 2, 2, 174, 175, 7, 36, 2, 2, 175, 176, 5, 58, 30, 2, 176, 177, 5, 4, 3, 2, 177, 178, 7, 37, 2, 2, 178, 203, 3, 2, 2, 2, 179, 180, 7, 36, 2, 2, 180, 181, 7, 6, 2, 2, 181, 186, 5, 68, 35, 2, 182, 184, 7, 3, 2, 2, 183, 182, 3, 2, 2, 2, 183, 184, 3, 2, 2, 2, 184, 185, 3, 2, 2, 2, 185, 187, 5, 60, 31, 2, 186, 183, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 188, 3, 2, 2, 2, 188, 189, 7, 37, 2, 2, 189, 203, 3, 2, 2, 2, 190, 191, 7, 36, 2, 2, 191, 192, 5, 62, 32, 2, 192, 193, 7, 37, 2, 2, 193, 203, 3, 2, 2, 2, 194, 195, 7, 36, 2, 2, 195, 196, 5, 64, 33, 2, 196, 197, 7, 37, 2, 2, 197, 203, 3, 2, 2, 2, 198, 199, 7, 36, 2, 2, 199, 200, 5, 66, 34, 2, 200, 201, 7, 37, 2, 2, 201, 203, 3, 2, 2, 2, 202, 162, 3, 2, 2, 2, 202, 168, 3, 2, 2, 2, 202, 174, 3, 2, 2, 2, 202, 179, 3, 2, 2, 2, 202, 190, 3, 2, 2, 2, 202, 194, 3, 2, 2, 2, 202, 198, 3, 2, 2, 2, 203, 17, 3, 2, 2, 2, 204, 205, 7, 36, 2, 2, 205, 206, 5, 42, 22, 2, 206, 207, 7, 36, 2, 2, 207, 208, 5, 38, 20, 2, 208, 209, 5, 8, 5, 2, 209, 210, 7, 37, 2, 2, 210, 211, 7, 36, 2, 2, 211, 212, 7, 5, 2, 2, 212, 213, 7, 7, 2, 2, 213, 214, 7, 8, 2, 2, 214, 215, 7, 37, 2, 2, 215, 216, 7, 37, 2, 2, 216, 230, 3, 2, 2, 2, 217, 230, 5, 22, 12, 2, 218, 219, 7, 36, 2, 2, 219, 220, 5, 42, 22, 2, 220, 221, 5, 4, 3, 2, 221, 222, 5, 14, 8, 2, 222, 223, 7, 37, 2, 2, 223, 230, 3, 2, 2, 2, 224, 225, 7, 36, 2, 2, 225, 226, 7, 9, 2, 2, 226, 227, 5, 60, 31, 2, 227, 228, 7, 37, 2, 2, 228, 230, 3, 2, 2, 2, 229, 204, 3, 2, 2, 2, 229, 217, 3, 2, 2, 2, 229, 218, 3, 2, 2, 2, 229, 224, 3, 2, 2, 2, 230, 19, 3, 2, 2, 2, 231, 232, 7, 36, 2, 2, 232, 233, 7, 10, 2, 2, 233, 234, 5, 60, 31, 2, 234, 235, 5, 20, 11, 2, 235, 236, 7, 37, 2, 2, 236, 241, 3, 2, 2, 2, 237, 241, 5, 22, 12, 2, 238, 241, 5, 24, 13, 2, 239, 241, 5, 26, 14, 2, 240, 231, 3, 2, 2, 2, 240, 237, 3, 2, 2, 2, 240, 238, 3, 2, 2, 2, 240, 239, 3, 2, 2, 2, 241, 21, 3, 2, 2, 2, 242, 243, 7, 36, 2, 2, 243, 244, 5, 40, 21, 2, 244, 245, 5, 18, 10, 2, 245, 246, 5, 10, 6, 2, 246, 247, 7, 37, 2, 2, 247, 273, 3, 2, 2, 2, 248, 249, 7, 36, 2, 2, 249, 250, 5, 40, 21, 2, 250, 251, 5, 18, 10, 2, 251, 252, 5, 12, 7, 2, 252, 253, 5, 28, 15, 2, 253, 254, 5, 16, 9, 2, 254, 255, 7, 37, 2, 2, 255, 273, 3, 2, 2, 2, 256, 257, 7, 36, 2, 2, 257, 258, 5, 40, 21, 2, 258, 259, 5, 18, 10, 2, 259, 260, 5, 10, 6, 2, 260, 261, 5, 28, 15, 2, 261, 262, 5, 4, 3, 2, 262, 263, 7, 37, 2, 2, 263, 273, 3, 2, 2, 2, 264, 265, 7, 36, 2, 2, 265, 266, 5, 40, 21, 2, 266, 267, 5, 18, 10, 2, 267, 268, 5, 14, 8, 2, 268, 269, 5, 28, 15, 2, 269, 270, 5, 4, 3, 2, 270, 271, 7, 37, 2, 2, 271, 273, 3, 2, 2, 2, 272, 242, 3, 2, 2, 2, 272, 248, 3, 2, 2, 2, 272, 256, 3, 2, 2, 2, 272, 264, 3, 2, 2, 2, 273, 23, 3, 2, 2, 2, 274, 275, 7, 36, 2, 2, 275, 276, 5, 44, 23, 2, 276, 277, 5, 18, 10, 2, 277, 278, 5, 28, 15, 2, 278, 279, 5, 12, 7, 2, 279, 280, 7, 37, 2, 2, 280, 305, 3, 2, 2, 2, 281, 282, 7, 36, 2, 2, 282, 283, 5, 46, 24, 2, 283, 284, 5, 18, 10, 2, 284, 285, 5, 28, 15, 2, 285, 286, 5, 12, 7, 2, 286, 287, 7, 37, 2, 2, 287, 305, 3, 2, 2, 2, 288, 289, 7, 36, 2, 2, 289, 290, 5, 46, 24, 2, 290, 291, 5, 18, 10, 2, 291, 292, 5, 28, 15, 2, 292, 293, 5, 10, 6, 2, 293, 294, 5, 4, 3, 2, 294, 295, 7, 37, 2, 2, 295, 305, 3, 2, 2, 2, 296, 297, 7, 36, 2, 2, 297, 298, 5, 46, 24, 2, 298, 299, 5, 18, 10, 2, 299, 300, 5, 28, 15, 2, 300, 301, 5, 14, 8, 2, 301, 302, 5, 4, 3, 2, 302, 303, 7, 37, 2, 2, 303, 305, 3, 2, 2, 2, 304, 274, 3, 2, 2, 2, 304, 281, 3, 2, 2, 2, 304, 288, 3, 2, 2, 2, 304, 296, 3, 2, 2, 2, 305, 25, 3, 2, 2, 2, 306, 307, 7, 36, 2, 2, 307, 308, 5, 48, 25, 2, 308, 309, 5, 18, 10, 2, 309, 310, 5, 12, 7, 2, 310, 311, 5, 28, 15, 2, 311, 312, 5, 16, 9, 2, 312, 313, 7, 37, 2, 2, 313, 333, 3, 2, 2, 2, 314, 315, 7, 36, 2, 2, 315, 316, 5, 48, 25, 2, 316, 317, 5, 18, 10, 2, 317, 318, 5, 10, 6, 2, 318, 319, 5, 28, 15, 2, 319, 320, 5, 16, 9, 2, 320, 321, 5, 4, 3, 2, 321, 322, 7, 37, 2, 2, 322, 333, 3, 2, 2, 2, 323, 324, 7, 36, 2, 2, 324, 325, 5, 48, 25, 2, 325, 326, 5, 18, 10, 2, 326, 327, 5, 14, 8, 2, 327, 328, 5, 28, 15, 2, 328, 329, 5, 16, 9, 2, 329, 330, 5, 4, 3, 2, 330, 331, 7, 37, 2, 2, 331, 333, 3, 2, 2, 2, 332, 306, 3, 2, 2, 2, 332, 314, 3, 2, 2, 2, 332, 323, 3, 2, 2, 2, 333, 27, 3, 2, 2, 2, 334, 335, 7, 36, 2, 2, 335, 336, 7, 5, 2, 2, 336, 337, 7, 11, 2, 2, 337, 370, 7, 37, 2, 2, 338, 339, 7, 36, 2, 2, 339, 340, 7, 5, 2, 2, 340, 341, 7, 7, 2, 2, 341, 342, 7, 11, 2, 2, 342, 370, 7, 37, 2, 2, 343, 344, 7, 36, 2, 2, 344, 345, 7, 5, 2, 2, 345, 346, 7, 12, 2, 2, 346, 370, 7, 37, 2, 2, 347, 348, 7, 36, 2, 2, 348, 349, 7, 5, 2, 2, 349, 350, 7, 13, 2, 2, 350, 370, 7, 37, 2, 2, 351, 352, 7, 36, 2, 2, 352, 353, 7, 5, 2, 2, 353, 354, 7, 12, 2, 2, 354, 355, 7, 11, 2, 2, 355, 370, 7, 37, 2, 2, 356, 357, 7, 36, 2, 2, 357, 358, 7, 5, 2, 2, 358, 359, 7, 13, 2, 2, 359, 360, 7, 11, 2, 2, 360, 370, 7, 37, 2, 2, 361, 362, 7, 36, 2, 2, 362, 363, 7, 5, 2, 2, 363, 364, 7, 14, 2, 2, 364, 370, 7, 37, 2, 2, 365, 366, 7, 36, 2, 2, 366, 367, 7, 5, 2, 2, 367, 368, 7, 15, 2, 2, 368, 370, 7, 37, 2, 2, 369, 334, 3, 2, 2, 2, 369, 338, 3, 2, 2, 2, 369, 343, 3, 2, 2, 2, 369, 347, 3, 2, 2, 2, 369, 351, 3, 2, 2, 2, 369, 356, 3, 2, 2, 2, 369, 361, 3, 2, 2, 2, 369, 365, 3, 2, 2, 2, 370, 29, 3, 2, 2, 2, 371, 372, 7, 36, 2, 2, 372, 373, 7, 5, 2, 2, 373, 374, 7, 16, 2, 2, 374, 380, 7, 37, 2, 2, 375, 376, 7, 36, 2, 2, 376, 377, 7, 5, 2, 2, 377, 378, 7, 17, 2, 2, 378, 380, 7, 37, 2, 2, 379, 371, 3, 2, 2, 2, 379, 375, 3, 2, 2, 2, 380, 31, 3, 2, 2, 2, 381, 382, 7, 35, 2, 2, 382, 383, 7, 18, 2, 2, 383, 33, 3, 2, 2, 2, 384, 385, 7, 35, 2, 2, 385, 386, 7, 19, 2, 2, 386, 35, 3, 2, 2, 2, 387, 388, 7, 35, 2, 2, 388, 389, 7, 20, 2, 2, 389, 37, 3, 2, 2, 2, 390, 391, 7, 35, 2, 2, 391, 392, 7, 21, 2, 2, 392, 39, 3, 2, 2, 2, 393, 394, 7, 35, 2, 2, 394, 395, 7, 22, 2, 2, 395, 41, 3, 2, 2, 2, 396, 397, 7, 35, 2, 2, 397, 398, 7, 23, 2, 2, 398, 43, 3, 2, 2, 2, 399, 400, 7, 35, 2, 2, 400, 401, 7, 24, 2, 2, 401, 45, 3, 2, 2, 2, 402, 403, 7, 35, 2, 2, 403, 404, 7, 25, 2, 2, 404, 47, 3, 2, 2, 2, 405, 406, 7, 35, 2, 2, 406, 407, 7, 26, 2, 2, 407, 49, 3, 2, 2, 2, 408, 409, 7, 35, 2, 2, 409, 410, 7, 27, 2, 2, 410, 51, 3, 2, 2, 2, 411, 412, 7, 35, 2, 2, 412, 413, 7, 28, 2, 2, 413, 53, 3, 2, 2, 2, 414, 415, 7, 35, 2, 2, 415, 416, 7, 29, 2, 2, 416, 55, 3, 2, 2, 2, 417, 418, 7, 35, 2, 2, 418, 419, 7, 30, 2, 2, 419, 57, 3, 2, 2, 2, 420, 421, 7, 35, 2, 2, 421, 422, 7, 31, 2, 2, 422, 59, 3, 2, 2, 2, 423, 425, 9, 2, 2, 2, 424, 423, 3, 2, 2, 2, 425, 426, 3, 2, 2, 2, 426, 424, 3, 2, 2, 2, 426, 427, 3, 2, 2, 2, 427, 61, 3, 2, 2, 2, 428, 429, 7, 38, 2, 2, 429, 63, 3, 2, 2, 2, 430, 431, 7, 39, 2, 2, 431, 65, 3, 2, 2, 2, 432, 433, 7, 40, 2, 2, 433, 67, 3, 2, 2, 2, 434, 435, 7, 41, 2, 2, 435, 69, 3, 2, 2, 2, 20, 113, 116, 123, 126, 131, 148, 160, 183, 186, 202, 229, 240, 272, 304, 332, 369, 379, 426] -------------------------------------------------------------------------------- /kopl/Kopl.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'What()' 4 | 'Count()' 5 | 'FindAll()' 6 | 'And()' 7 | 'Or()' 8 | 'FilterStr(' 9 | ')' 10 | 'FilterNum(' 11 | 'FilterYear(' 12 | 'FilterDate(' 13 | 'QueryRelation()' 14 | 'Select(' 15 | 'QueryAttrUnderCondition(' 16 | 'QueryAttr(' 17 | 'VerifyStr(' 18 | 'VerifyNum(' 19 | 'VerifyYear(' 20 | 'VerifyDate(' 21 | 'QueryAttrQualifier(' 22 | 'QueryRelationQualifier(' 23 | 'Relate(' 24 | 'QFilterStr(' 25 | 'QFilterNum(' 26 | 'QFilterYear(' 27 | 'QFilterDate(' 28 | 'FilterConcept(' 29 | 'Find(' 30 | '=' 31 | '<' 32 | '>' 33 | '!=' 34 | 'largest' 35 | 'smallest' 36 | 'forward' 37 | 'backward' 38 | '(' 39 | '-' 40 | null 41 | null 42 | null 43 | null 44 | null 45 | null 46 | null 47 | '' 48 | '' 49 | 50 | token symbolic names: 51 | null 52 | null 53 | null 54 | null 55 | null 56 | null 57 | null 58 | null 59 | null 60 | null 61 | null 62 | null 63 | null 64 | null 65 | null 66 | null 67 | null 68 | null 69 | null 70 | null 71 | null 72 | null 73 | null 74 | null 75 | null 76 | null 77 | null 78 | null 79 | null 80 | null 81 | null 82 | null 83 | null 84 | null 85 | null 86 | null 87 | null 88 | null 89 | WS 90 | STRING_LITERAL 91 | INTEGER 92 | DECIMAL 93 | DOUBLE 94 | EXPONENT 95 | DIGIT 96 | FUNC_SEP 97 | IN_FUNC_SEP 98 | 99 | rule names: 100 | root 101 | whatEntityQuery 102 | howManyEntityQuery 103 | whatAttributeQuery 104 | whatRelationQuery 105 | attributeSatisfyQuery 106 | whatAttributeQualifierQuery 107 | whatRelationQualifierQuery 108 | entitySetGroup 109 | entitySet 110 | entityFilterByRelation 111 | entityFilterByAttribute 112 | entityFilterByConcept 113 | queryName 114 | count 115 | findAll 116 | setOP 117 | intersect 118 | union 119 | filterAttr 120 | filterStr 121 | filterNum 122 | filterYear 123 | filterDate 124 | queryRelation 125 | select 126 | queryAttributeUnderCondition 127 | queryAttribute 128 | verify 129 | verifyStr 130 | verifyNum 131 | verifyYear 132 | verifyDate 133 | queryAttrQualifier 134 | queryRelationQualifier 135 | relate 136 | filterQualifier 137 | filterStrQualifier 138 | filterNumQualifier 139 | filterYearQualifier 140 | filterDateQualifier 141 | filterConcept 142 | entity 143 | concept 144 | predicate 145 | key 146 | value 147 | qkey 148 | qvalue 149 | topk 150 | start 151 | op 152 | symbolOP 153 | stringOP 154 | direction 155 | string 156 | date 157 | year 158 | number 159 | 160 | 161 | atn: 162 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 48, 432, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 5, 2, 128, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 5, 7, 147, 10, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 5, 11, 163, 10, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 7, 11, 177, 10, 11, 12, 11, 14, 11, 180, 11, 11, 3, 12, 3, 12, 5, 12, 184, 10, 12, 3, 12, 5, 12, 187, 10, 12, 3, 13, 3, 13, 5, 13, 191, 10, 13, 3, 13, 5, 13, 194, 10, 13, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 5, 18, 206, 10, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 216, 10, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 5, 30, 276, 10, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 324, 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 46, 3, 46, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 48, 5, 48, 374, 10, 48, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 5, 50, 382, 10, 50, 3, 51, 3, 51, 3, 52, 3, 52, 3, 53, 3, 53, 5, 53, 390, 10, 53, 3, 54, 3, 54, 3, 55, 3, 55, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 6, 57, 404, 10, 57, 13, 57, 14, 57, 405, 3, 58, 6, 58, 409, 10, 58, 13, 58, 14, 58, 410, 3, 58, 3, 58, 6, 58, 415, 10, 58, 13, 58, 14, 58, 416, 3, 58, 3, 58, 6, 58, 421, 10, 58, 13, 58, 14, 58, 422, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 5, 410, 416, 422, 3, 20, 61, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 2, 6, 3, 2, 30, 33, 3, 2, 34, 35, 3, 2, 36, 37, 3, 2, 42, 44, 2, 412, 2, 127, 3, 2, 2, 2, 4, 131, 3, 2, 2, 2, 6, 134, 3, 2, 2, 2, 8, 137, 3, 2, 2, 2, 10, 140, 3, 2, 2, 2, 12, 143, 3, 2, 2, 2, 14, 150, 3, 2, 2, 2, 16, 153, 3, 2, 2, 2, 18, 156, 3, 2, 2, 2, 20, 162, 3, 2, 2, 2, 22, 181, 3, 2, 2, 2, 24, 188, 3, 2, 2, 2, 26, 195, 3, 2, 2, 2, 28, 197, 3, 2, 2, 2, 30, 199, 3, 2, 2, 2, 32, 201, 3, 2, 2, 2, 34, 205, 3, 2, 2, 2, 36, 207, 3, 2, 2, 2, 38, 209, 3, 2, 2, 2, 40, 215, 3, 2, 2, 2, 42, 217, 3, 2, 2, 2, 44, 223, 3, 2, 2, 2, 46, 231, 3, 2, 2, 2, 48, 239, 3, 2, 2, 2, 50, 247, 3, 2, 2, 2, 52, 249, 3, 2, 2, 2, 54, 259, 3, 2, 2, 2, 56, 267, 3, 2, 2, 2, 58, 275, 3, 2, 2, 2, 60, 277, 3, 2, 2, 2, 62, 281, 3, 2, 2, 2, 64, 287, 3, 2, 2, 2, 66, 293, 3, 2, 2, 2, 68, 299, 3, 2, 2, 2, 70, 307, 3, 2, 2, 2, 72, 313, 3, 2, 2, 2, 74, 323, 3, 2, 2, 2, 76, 325, 3, 2, 2, 2, 78, 331, 3, 2, 2, 2, 80, 339, 3, 2, 2, 2, 82, 347, 3, 2, 2, 2, 84, 355, 3, 2, 2, 2, 86, 359, 3, 2, 2, 2, 88, 363, 3, 2, 2, 2, 90, 365, 3, 2, 2, 2, 92, 367, 3, 2, 2, 2, 94, 373, 3, 2, 2, 2, 96, 375, 3, 2, 2, 2, 98, 381, 3, 2, 2, 2, 100, 383, 3, 2, 2, 2, 102, 385, 3, 2, 2, 2, 104, 389, 3, 2, 2, 2, 106, 391, 3, 2, 2, 2, 108, 393, 3, 2, 2, 2, 110, 395, 3, 2, 2, 2, 112, 403, 3, 2, 2, 2, 114, 408, 3, 2, 2, 2, 116, 424, 3, 2, 2, 2, 118, 429, 3, 2, 2, 2, 120, 128, 5, 4, 3, 2, 121, 128, 5, 6, 4, 2, 122, 128, 5, 8, 5, 2, 123, 128, 5, 10, 6, 2, 124, 128, 5, 12, 7, 2, 125, 128, 5, 14, 8, 2, 126, 128, 5, 16, 9, 2, 127, 120, 3, 2, 2, 2, 127, 121, 3, 2, 2, 2, 127, 122, 3, 2, 2, 2, 127, 123, 3, 2, 2, 2, 127, 124, 3, 2, 2, 2, 127, 125, 3, 2, 2, 2, 127, 126, 3, 2, 2, 2, 128, 129, 3, 2, 2, 2, 129, 130, 7, 2, 2, 3, 130, 3, 3, 2, 2, 2, 131, 132, 5, 20, 11, 2, 132, 133, 5, 28, 15, 2, 133, 5, 3, 2, 2, 2, 134, 135, 5, 20, 11, 2, 135, 136, 5, 30, 16, 2, 136, 7, 3, 2, 2, 2, 137, 138, 5, 20, 11, 2, 138, 139, 5, 56, 29, 2, 139, 9, 3, 2, 2, 2, 140, 141, 5, 18, 10, 2, 141, 142, 5, 50, 26, 2, 142, 11, 3, 2, 2, 2, 143, 146, 5, 20, 11, 2, 144, 147, 5, 54, 28, 2, 145, 147, 5, 56, 29, 2, 146, 144, 3, 2, 2, 2, 146, 145, 3, 2, 2, 2, 147, 148, 3, 2, 2, 2, 148, 149, 5, 58, 30, 2, 149, 13, 3, 2, 2, 2, 150, 151, 5, 20, 11, 2, 151, 152, 5, 68, 35, 2, 152, 15, 3, 2, 2, 2, 153, 154, 5, 18, 10, 2, 154, 155, 5, 70, 36, 2, 155, 17, 3, 2, 2, 2, 156, 157, 5, 20, 11, 2, 157, 158, 5, 20, 11, 2, 158, 19, 3, 2, 2, 2, 159, 160, 8, 11, 1, 2, 160, 163, 5, 32, 17, 2, 161, 163, 5, 86, 44, 2, 162, 159, 3, 2, 2, 2, 162, 161, 3, 2, 2, 2, 163, 178, 3, 2, 2, 2, 164, 165, 12, 9, 2, 2, 165, 166, 5, 20, 11, 2, 166, 167, 5, 34, 18, 2, 167, 177, 3, 2, 2, 2, 168, 169, 12, 8, 2, 2, 169, 177, 5, 52, 27, 2, 170, 171, 12, 7, 2, 2, 171, 177, 5, 22, 12, 2, 172, 173, 12, 6, 2, 2, 173, 177, 5, 24, 13, 2, 174, 175, 12, 5, 2, 2, 175, 177, 5, 26, 14, 2, 176, 164, 3, 2, 2, 2, 176, 168, 3, 2, 2, 2, 176, 170, 3, 2, 2, 2, 176, 172, 3, 2, 2, 2, 176, 174, 3, 2, 2, 2, 177, 180, 3, 2, 2, 2, 178, 176, 3, 2, 2, 2, 178, 179, 3, 2, 2, 2, 179, 21, 3, 2, 2, 2, 180, 178, 3, 2, 2, 2, 181, 183, 5, 72, 37, 2, 182, 184, 5, 74, 38, 2, 183, 182, 3, 2, 2, 2, 183, 184, 3, 2, 2, 2, 184, 186, 3, 2, 2, 2, 185, 187, 5, 84, 43, 2, 186, 185, 3, 2, 2, 2, 186, 187, 3, 2, 2, 2, 187, 23, 3, 2, 2, 2, 188, 190, 5, 40, 21, 2, 189, 191, 5, 74, 38, 2, 190, 189, 3, 2, 2, 2, 190, 191, 3, 2, 2, 2, 191, 193, 3, 2, 2, 2, 192, 194, 5, 84, 43, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 25, 3, 2, 2, 2, 195, 196, 5, 84, 43, 2, 196, 27, 3, 2, 2, 2, 197, 198, 7, 3, 2, 2, 198, 29, 3, 2, 2, 2, 199, 200, 7, 4, 2, 2, 200, 31, 3, 2, 2, 2, 201, 202, 7, 5, 2, 2, 202, 33, 3, 2, 2, 2, 203, 206, 5, 36, 19, 2, 204, 206, 5, 38, 20, 2, 205, 203, 3, 2, 2, 2, 205, 204, 3, 2, 2, 2, 206, 35, 3, 2, 2, 2, 207, 208, 7, 6, 2, 2, 208, 37, 3, 2, 2, 2, 209, 210, 7, 7, 2, 2, 210, 39, 3, 2, 2, 2, 211, 216, 5, 42, 22, 2, 212, 216, 5, 44, 23, 2, 213, 216, 5, 46, 24, 2, 214, 216, 5, 48, 25, 2, 215, 211, 3, 2, 2, 2, 215, 212, 3, 2, 2, 2, 215, 213, 3, 2, 2, 2, 215, 214, 3, 2, 2, 2, 216, 41, 3, 2, 2, 2, 217, 218, 7, 8, 2, 2, 218, 219, 5, 92, 47, 2, 219, 220, 7, 48, 2, 2, 220, 221, 5, 94, 48, 2, 221, 222, 7, 9, 2, 2, 222, 43, 3, 2, 2, 2, 223, 224, 7, 10, 2, 2, 224, 225, 5, 92, 47, 2, 225, 226, 7, 48, 2, 2, 226, 227, 5, 94, 48, 2, 227, 228, 7, 48, 2, 2, 228, 229, 5, 104, 53, 2, 229, 230, 7, 9, 2, 2, 230, 45, 3, 2, 2, 2, 231, 232, 7, 11, 2, 2, 232, 233, 5, 92, 47, 2, 233, 234, 7, 48, 2, 2, 234, 235, 5, 94, 48, 2, 235, 236, 7, 48, 2, 2, 236, 237, 5, 104, 53, 2, 237, 238, 7, 9, 2, 2, 238, 47, 3, 2, 2, 2, 239, 240, 7, 12, 2, 2, 240, 241, 5, 92, 47, 2, 241, 242, 7, 48, 2, 2, 242, 243, 5, 94, 48, 2, 243, 244, 7, 48, 2, 2, 244, 245, 5, 104, 53, 2, 245, 246, 7, 9, 2, 2, 246, 49, 3, 2, 2, 2, 247, 248, 7, 13, 2, 2, 248, 51, 3, 2, 2, 2, 249, 250, 7, 14, 2, 2, 250, 251, 5, 92, 47, 2, 251, 252, 7, 48, 2, 2, 252, 253, 5, 104, 53, 2, 253, 254, 7, 48, 2, 2, 254, 255, 5, 100, 51, 2, 255, 256, 7, 48, 2, 2, 256, 257, 5, 102, 52, 2, 257, 258, 7, 9, 2, 2, 258, 53, 3, 2, 2, 2, 259, 260, 7, 15, 2, 2, 260, 261, 5, 92, 47, 2, 261, 262, 7, 48, 2, 2, 262, 263, 5, 96, 49, 2, 263, 264, 7, 48, 2, 2, 264, 265, 5, 98, 50, 2, 265, 266, 7, 9, 2, 2, 266, 55, 3, 2, 2, 2, 267, 268, 7, 16, 2, 2, 268, 269, 5, 92, 47, 2, 269, 270, 7, 9, 2, 2, 270, 57, 3, 2, 2, 2, 271, 276, 5, 60, 31, 2, 272, 276, 5, 62, 32, 2, 273, 276, 5, 64, 33, 2, 274, 276, 5, 66, 34, 2, 275, 271, 3, 2, 2, 2, 275, 272, 3, 2, 2, 2, 275, 273, 3, 2, 2, 2, 275, 274, 3, 2, 2, 2, 276, 59, 3, 2, 2, 2, 277, 278, 7, 17, 2, 2, 278, 279, 5, 94, 48, 2, 279, 280, 7, 9, 2, 2, 280, 61, 3, 2, 2, 2, 281, 282, 7, 18, 2, 2, 282, 283, 5, 94, 48, 2, 283, 284, 7, 48, 2, 2, 284, 285, 5, 104, 53, 2, 285, 286, 7, 9, 2, 2, 286, 63, 3, 2, 2, 2, 287, 288, 7, 19, 2, 2, 288, 289, 5, 94, 48, 2, 289, 290, 7, 48, 2, 2, 290, 291, 5, 104, 53, 2, 291, 292, 7, 9, 2, 2, 292, 65, 3, 2, 2, 2, 293, 294, 7, 20, 2, 2, 294, 295, 5, 94, 48, 2, 295, 296, 7, 48, 2, 2, 296, 297, 5, 104, 53, 2, 297, 298, 7, 9, 2, 2, 298, 67, 3, 2, 2, 2, 299, 300, 7, 21, 2, 2, 300, 301, 5, 92, 47, 2, 301, 302, 7, 48, 2, 2, 302, 303, 5, 94, 48, 2, 303, 304, 7, 48, 2, 2, 304, 305, 5, 96, 49, 2, 305, 306, 7, 9, 2, 2, 306, 69, 3, 2, 2, 2, 307, 308, 7, 22, 2, 2, 308, 309, 5, 90, 46, 2, 309, 310, 7, 48, 2, 2, 310, 311, 5, 96, 49, 2, 311, 312, 7, 9, 2, 2, 312, 71, 3, 2, 2, 2, 313, 314, 7, 23, 2, 2, 314, 315, 5, 90, 46, 2, 315, 316, 7, 48, 2, 2, 316, 317, 5, 110, 56, 2, 317, 318, 7, 9, 2, 2, 318, 73, 3, 2, 2, 2, 319, 324, 5, 76, 39, 2, 320, 324, 5, 78, 40, 2, 321, 324, 5, 80, 41, 2, 322, 324, 5, 82, 42, 2, 323, 319, 3, 2, 2, 2, 323, 320, 3, 2, 2, 2, 323, 321, 3, 2, 2, 2, 323, 322, 3, 2, 2, 2, 324, 75, 3, 2, 2, 2, 325, 326, 7, 24, 2, 2, 326, 327, 5, 96, 49, 2, 327, 328, 7, 48, 2, 2, 328, 329, 5, 98, 50, 2, 329, 330, 7, 9, 2, 2, 330, 77, 3, 2, 2, 2, 331, 332, 7, 25, 2, 2, 332, 333, 5, 96, 49, 2, 333, 334, 7, 48, 2, 2, 334, 335, 5, 98, 50, 2, 335, 336, 7, 48, 2, 2, 336, 337, 5, 104, 53, 2, 337, 338, 7, 9, 2, 2, 338, 79, 3, 2, 2, 2, 339, 340, 7, 26, 2, 2, 340, 341, 5, 96, 49, 2, 341, 342, 7, 48, 2, 2, 342, 343, 5, 98, 50, 2, 343, 344, 7, 48, 2, 2, 344, 345, 5, 104, 53, 2, 345, 346, 7, 9, 2, 2, 346, 81, 3, 2, 2, 2, 347, 348, 7, 27, 2, 2, 348, 349, 5, 96, 49, 2, 349, 350, 7, 48, 2, 2, 350, 351, 5, 98, 50, 2, 351, 352, 7, 48, 2, 2, 352, 353, 5, 104, 53, 2, 353, 354, 7, 9, 2, 2, 354, 83, 3, 2, 2, 2, 355, 356, 7, 28, 2, 2, 356, 357, 5, 88, 45, 2, 357, 358, 7, 9, 2, 2, 358, 85, 3, 2, 2, 2, 359, 360, 7, 29, 2, 2, 360, 361, 5, 112, 57, 2, 361, 362, 7, 9, 2, 2, 362, 87, 3, 2, 2, 2, 363, 364, 5, 112, 57, 2, 364, 89, 3, 2, 2, 2, 365, 366, 5, 112, 57, 2, 366, 91, 3, 2, 2, 2, 367, 368, 5, 112, 57, 2, 368, 93, 3, 2, 2, 2, 369, 374, 5, 114, 58, 2, 370, 374, 5, 116, 59, 2, 371, 374, 5, 118, 60, 2, 372, 374, 5, 112, 57, 2, 373, 369, 3, 2, 2, 2, 373, 370, 3, 2, 2, 2, 373, 371, 3, 2, 2, 2, 373, 372, 3, 2, 2, 2, 374, 95, 3, 2, 2, 2, 375, 376, 5, 112, 57, 2, 376, 97, 3, 2, 2, 2, 377, 382, 5, 114, 58, 2, 378, 382, 5, 116, 59, 2, 379, 382, 5, 118, 60, 2, 380, 382, 5, 112, 57, 2, 381, 377, 3, 2, 2, 2, 381, 378, 3, 2, 2, 2, 381, 379, 3, 2, 2, 2, 381, 380, 3, 2, 2, 2, 382, 99, 3, 2, 2, 2, 383, 384, 5, 112, 57, 2, 384, 101, 3, 2, 2, 2, 385, 386, 5, 112, 57, 2, 386, 103, 3, 2, 2, 2, 387, 390, 5, 106, 54, 2, 388, 390, 5, 108, 55, 2, 389, 387, 3, 2, 2, 2, 389, 388, 3, 2, 2, 2, 390, 105, 3, 2, 2, 2, 391, 392, 9, 2, 2, 2, 392, 107, 3, 2, 2, 2, 393, 394, 9, 3, 2, 2, 394, 109, 3, 2, 2, 2, 395, 396, 9, 4, 2, 2, 396, 111, 3, 2, 2, 2, 397, 404, 7, 41, 2, 2, 398, 399, 7, 38, 2, 2, 399, 400, 5, 112, 57, 2, 400, 401, 7, 9, 2, 2, 401, 404, 3, 2, 2, 2, 402, 404, 5, 110, 56, 2, 403, 397, 3, 2, 2, 2, 403, 398, 3, 2, 2, 2, 403, 402, 3, 2, 2, 2, 404, 405, 3, 2, 2, 2, 405, 403, 3, 2, 2, 2, 405, 406, 3, 2, 2, 2, 406, 113, 3, 2, 2, 2, 407, 409, 7, 46, 2, 2, 408, 407, 3, 2, 2, 2, 409, 410, 3, 2, 2, 2, 410, 411, 3, 2, 2, 2, 410, 408, 3, 2, 2, 2, 411, 412, 3, 2, 2, 2, 412, 414, 7, 39, 2, 2, 413, 415, 7, 46, 2, 2, 414, 413, 3, 2, 2, 2, 415, 416, 3, 2, 2, 2, 416, 417, 3, 2, 2, 2, 416, 414, 3, 2, 2, 2, 417, 418, 3, 2, 2, 2, 418, 420, 7, 39, 2, 2, 419, 421, 7, 46, 2, 2, 420, 419, 3, 2, 2, 2, 421, 422, 3, 2, 2, 2, 422, 423, 3, 2, 2, 2, 422, 420, 3, 2, 2, 2, 423, 115, 3, 2, 2, 2, 424, 425, 7, 46, 2, 2, 425, 426, 7, 46, 2, 2, 426, 427, 7, 46, 2, 2, 427, 428, 7, 46, 2, 2, 428, 117, 3, 2, 2, 2, 429, 430, 9, 5, 2, 2, 430, 119, 3, 2, 2, 2, 23, 127, 146, 162, 176, 178, 183, 186, 190, 193, 205, 215, 275, 323, 373, 381, 389, 403, 405, 410, 416, 422] -------------------------------------------------------------------------------- /overnight/OvernightLexer.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'en.' 4 | '.' 5 | 'string' 6 | 'number' 7 | '!' 8 | 'type' 9 | 'var' 10 | 'lambda' 11 | '=' 12 | '<' 13 | '>' 14 | 'min' 15 | 'max' 16 | 'sum' 17 | 'avg' 18 | 'listValue' 19 | 'size' 20 | 'domain' 21 | 'singleton' 22 | 'filter' 23 | 'getProperty' 24 | 'superlative' 25 | 'countSuperlative' 26 | 'countComparative' 27 | 'aggregate' 28 | 'concat' 29 | 'reverse' 30 | 'ensureNumericProperty' 31 | 'ensureNumericEntity' 32 | 'date' 33 | 'year' 34 | 'time' 35 | null 36 | '(' 37 | ')' 38 | null 39 | null 40 | null 41 | null 42 | null 43 | null 44 | 45 | token symbolic names: 46 | null 47 | null 48 | null 49 | null 50 | null 51 | null 52 | null 53 | null 54 | null 55 | null 56 | null 57 | null 58 | null 59 | null 60 | null 61 | null 62 | null 63 | null 64 | null 65 | null 66 | null 67 | null 68 | null 69 | null 70 | null 71 | null 72 | null 73 | null 74 | null 75 | null 76 | null 77 | null 78 | null 79 | PREFIX 80 | LB 81 | RB 82 | DATE 83 | YEAR 84 | TIME 85 | INTEGER 86 | STRING_LITERAL 87 | WS 88 | 89 | rule names: 90 | T__0 91 | T__1 92 | T__2 93 | T__3 94 | T__4 95 | T__5 96 | T__6 97 | T__7 98 | T__8 99 | T__9 100 | T__10 101 | T__11 102 | T__12 103 | T__13 104 | T__14 105 | T__15 106 | T__16 107 | T__17 108 | T__18 109 | T__19 110 | T__20 111 | T__21 112 | T__22 113 | T__23 114 | T__24 115 | T__25 116 | T__26 117 | T__27 118 | T__28 119 | T__29 120 | T__30 121 | T__31 122 | PREFIX 123 | LB 124 | RB 125 | DATE 126 | YEAR 127 | TIME 128 | INTEGER 129 | STRING_LITERAL 130 | DIGIT 131 | CHAR 132 | WS 133 | 134 | channel names: 135 | DEFAULT_TOKEN_CHANNEL 136 | HIDDEN 137 | 138 | mode names: 139 | DEFAULT_MODE 140 | 141 | atn: 142 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 43, 453, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 3, 11, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 394, 10, 34, 3, 35, 3, 35, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 40, 5, 40, 431, 10, 40, 3, 40, 6, 40, 434, 10, 40, 13, 40, 14, 40, 435, 3, 41, 6, 41, 439, 10, 41, 13, 41, 14, 41, 440, 3, 42, 3, 42, 3, 43, 3, 43, 3, 44, 6, 44, 448, 10, 44, 13, 44, 14, 44, 449, 3, 44, 3, 44, 2, 2, 45, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 2, 85, 2, 87, 43, 3, 2, 4, 6, 2, 47, 47, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 15, 15, 34, 34, 2, 456, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 3, 89, 3, 2, 2, 2, 5, 93, 3, 2, 2, 2, 7, 95, 3, 2, 2, 2, 9, 102, 3, 2, 2, 2, 11, 109, 3, 2, 2, 2, 13, 111, 3, 2, 2, 2, 15, 116, 3, 2, 2, 2, 17, 120, 3, 2, 2, 2, 19, 127, 3, 2, 2, 2, 21, 129, 3, 2, 2, 2, 23, 131, 3, 2, 2, 2, 25, 133, 3, 2, 2, 2, 27, 137, 3, 2, 2, 2, 29, 141, 3, 2, 2, 2, 31, 145, 3, 2, 2, 2, 33, 149, 3, 2, 2, 2, 35, 159, 3, 2, 2, 2, 37, 164, 3, 2, 2, 2, 39, 171, 3, 2, 2, 2, 41, 181, 3, 2, 2, 2, 43, 188, 3, 2, 2, 2, 45, 200, 3, 2, 2, 2, 47, 212, 3, 2, 2, 2, 49, 229, 3, 2, 2, 2, 51, 246, 3, 2, 2, 2, 53, 256, 3, 2, 2, 2, 55, 263, 3, 2, 2, 2, 57, 271, 3, 2, 2, 2, 59, 293, 3, 2, 2, 2, 61, 313, 3, 2, 2, 2, 63, 318, 3, 2, 2, 2, 65, 323, 3, 2, 2, 2, 67, 393, 3, 2, 2, 2, 69, 395, 3, 2, 2, 2, 71, 397, 3, 2, 2, 2, 73, 399, 3, 2, 2, 2, 75, 411, 3, 2, 2, 2, 77, 419, 3, 2, 2, 2, 79, 430, 3, 2, 2, 2, 81, 438, 3, 2, 2, 2, 83, 442, 3, 2, 2, 2, 85, 444, 3, 2, 2, 2, 87, 447, 3, 2, 2, 2, 89, 90, 7, 103, 2, 2, 90, 91, 7, 112, 2, 2, 91, 92, 7, 48, 2, 2, 92, 4, 3, 2, 2, 2, 93, 94, 7, 48, 2, 2, 94, 6, 3, 2, 2, 2, 95, 96, 7, 117, 2, 2, 96, 97, 7, 118, 2, 2, 97, 98, 7, 116, 2, 2, 98, 99, 7, 107, 2, 2, 99, 100, 7, 112, 2, 2, 100, 101, 7, 105, 2, 2, 101, 8, 3, 2, 2, 2, 102, 103, 7, 112, 2, 2, 103, 104, 7, 119, 2, 2, 104, 105, 7, 111, 2, 2, 105, 106, 7, 100, 2, 2, 106, 107, 7, 103, 2, 2, 107, 108, 7, 116, 2, 2, 108, 10, 3, 2, 2, 2, 109, 110, 7, 35, 2, 2, 110, 12, 3, 2, 2, 2, 111, 112, 7, 118, 2, 2, 112, 113, 7, 123, 2, 2, 113, 114, 7, 114, 2, 2, 114, 115, 7, 103, 2, 2, 115, 14, 3, 2, 2, 2, 116, 117, 7, 120, 2, 2, 117, 118, 7, 99, 2, 2, 118, 119, 7, 116, 2, 2, 119, 16, 3, 2, 2, 2, 120, 121, 7, 110, 2, 2, 121, 122, 7, 99, 2, 2, 122, 123, 7, 111, 2, 2, 123, 124, 7, 100, 2, 2, 124, 125, 7, 102, 2, 2, 125, 126, 7, 99, 2, 2, 126, 18, 3, 2, 2, 2, 127, 128, 7, 63, 2, 2, 128, 20, 3, 2, 2, 2, 129, 130, 7, 62, 2, 2, 130, 22, 3, 2, 2, 2, 131, 132, 7, 64, 2, 2, 132, 24, 3, 2, 2, 2, 133, 134, 7, 111, 2, 2, 134, 135, 7, 107, 2, 2, 135, 136, 7, 112, 2, 2, 136, 26, 3, 2, 2, 2, 137, 138, 7, 111, 2, 2, 138, 139, 7, 99, 2, 2, 139, 140, 7, 122, 2, 2, 140, 28, 3, 2, 2, 2, 141, 142, 7, 117, 2, 2, 142, 143, 7, 119, 2, 2, 143, 144, 7, 111, 2, 2, 144, 30, 3, 2, 2, 2, 145, 146, 7, 99, 2, 2, 146, 147, 7, 120, 2, 2, 147, 148, 7, 105, 2, 2, 148, 32, 3, 2, 2, 2, 149, 150, 7, 110, 2, 2, 150, 151, 7, 107, 2, 2, 151, 152, 7, 117, 2, 2, 152, 153, 7, 118, 2, 2, 153, 154, 7, 88, 2, 2, 154, 155, 7, 99, 2, 2, 155, 156, 7, 110, 2, 2, 156, 157, 7, 119, 2, 2, 157, 158, 7, 103, 2, 2, 158, 34, 3, 2, 2, 2, 159, 160, 7, 117, 2, 2, 160, 161, 7, 107, 2, 2, 161, 162, 7, 124, 2, 2, 162, 163, 7, 103, 2, 2, 163, 36, 3, 2, 2, 2, 164, 165, 7, 102, 2, 2, 165, 166, 7, 113, 2, 2, 166, 167, 7, 111, 2, 2, 167, 168, 7, 99, 2, 2, 168, 169, 7, 107, 2, 2, 169, 170, 7, 112, 2, 2, 170, 38, 3, 2, 2, 2, 171, 172, 7, 117, 2, 2, 172, 173, 7, 107, 2, 2, 173, 174, 7, 112, 2, 2, 174, 175, 7, 105, 2, 2, 175, 176, 7, 110, 2, 2, 176, 177, 7, 103, 2, 2, 177, 178, 7, 118, 2, 2, 178, 179, 7, 113, 2, 2, 179, 180, 7, 112, 2, 2, 180, 40, 3, 2, 2, 2, 181, 182, 7, 104, 2, 2, 182, 183, 7, 107, 2, 2, 183, 184, 7, 110, 2, 2, 184, 185, 7, 118, 2, 2, 185, 186, 7, 103, 2, 2, 186, 187, 7, 116, 2, 2, 187, 42, 3, 2, 2, 2, 188, 189, 7, 105, 2, 2, 189, 190, 7, 103, 2, 2, 190, 191, 7, 118, 2, 2, 191, 192, 7, 82, 2, 2, 192, 193, 7, 116, 2, 2, 193, 194, 7, 113, 2, 2, 194, 195, 7, 114, 2, 2, 195, 196, 7, 103, 2, 2, 196, 197, 7, 116, 2, 2, 197, 198, 7, 118, 2, 2, 198, 199, 7, 123, 2, 2, 199, 44, 3, 2, 2, 2, 200, 201, 7, 117, 2, 2, 201, 202, 7, 119, 2, 2, 202, 203, 7, 114, 2, 2, 203, 204, 7, 103, 2, 2, 204, 205, 7, 116, 2, 2, 205, 206, 7, 110, 2, 2, 206, 207, 7, 99, 2, 2, 207, 208, 7, 118, 2, 2, 208, 209, 7, 107, 2, 2, 209, 210, 7, 120, 2, 2, 210, 211, 7, 103, 2, 2, 211, 46, 3, 2, 2, 2, 212, 213, 7, 101, 2, 2, 213, 214, 7, 113, 2, 2, 214, 215, 7, 119, 2, 2, 215, 216, 7, 112, 2, 2, 216, 217, 7, 118, 2, 2, 217, 218, 7, 85, 2, 2, 218, 219, 7, 119, 2, 2, 219, 220, 7, 114, 2, 2, 220, 221, 7, 103, 2, 2, 221, 222, 7, 116, 2, 2, 222, 223, 7, 110, 2, 2, 223, 224, 7, 99, 2, 2, 224, 225, 7, 118, 2, 2, 225, 226, 7, 107, 2, 2, 226, 227, 7, 120, 2, 2, 227, 228, 7, 103, 2, 2, 228, 48, 3, 2, 2, 2, 229, 230, 7, 101, 2, 2, 230, 231, 7, 113, 2, 2, 231, 232, 7, 119, 2, 2, 232, 233, 7, 112, 2, 2, 233, 234, 7, 118, 2, 2, 234, 235, 7, 69, 2, 2, 235, 236, 7, 113, 2, 2, 236, 237, 7, 111, 2, 2, 237, 238, 7, 114, 2, 2, 238, 239, 7, 99, 2, 2, 239, 240, 7, 116, 2, 2, 240, 241, 7, 99, 2, 2, 241, 242, 7, 118, 2, 2, 242, 243, 7, 107, 2, 2, 243, 244, 7, 120, 2, 2, 244, 245, 7, 103, 2, 2, 245, 50, 3, 2, 2, 2, 246, 247, 7, 99, 2, 2, 247, 248, 7, 105, 2, 2, 248, 249, 7, 105, 2, 2, 249, 250, 7, 116, 2, 2, 250, 251, 7, 103, 2, 2, 251, 252, 7, 105, 2, 2, 252, 253, 7, 99, 2, 2, 253, 254, 7, 118, 2, 2, 254, 255, 7, 103, 2, 2, 255, 52, 3, 2, 2, 2, 256, 257, 7, 101, 2, 2, 257, 258, 7, 113, 2, 2, 258, 259, 7, 112, 2, 2, 259, 260, 7, 101, 2, 2, 260, 261, 7, 99, 2, 2, 261, 262, 7, 118, 2, 2, 262, 54, 3, 2, 2, 2, 263, 264, 7, 116, 2, 2, 264, 265, 7, 103, 2, 2, 265, 266, 7, 120, 2, 2, 266, 267, 7, 103, 2, 2, 267, 268, 7, 116, 2, 2, 268, 269, 7, 117, 2, 2, 269, 270, 7, 103, 2, 2, 270, 56, 3, 2, 2, 2, 271, 272, 7, 103, 2, 2, 272, 273, 7, 112, 2, 2, 273, 274, 7, 117, 2, 2, 274, 275, 7, 119, 2, 2, 275, 276, 7, 116, 2, 2, 276, 277, 7, 103, 2, 2, 277, 278, 7, 80, 2, 2, 278, 279, 7, 119, 2, 2, 279, 280, 7, 111, 2, 2, 280, 281, 7, 103, 2, 2, 281, 282, 7, 116, 2, 2, 282, 283, 7, 107, 2, 2, 283, 284, 7, 101, 2, 2, 284, 285, 7, 82, 2, 2, 285, 286, 7, 116, 2, 2, 286, 287, 7, 113, 2, 2, 287, 288, 7, 114, 2, 2, 288, 289, 7, 103, 2, 2, 289, 290, 7, 116, 2, 2, 290, 291, 7, 118, 2, 2, 291, 292, 7, 123, 2, 2, 292, 58, 3, 2, 2, 2, 293, 294, 7, 103, 2, 2, 294, 295, 7, 112, 2, 2, 295, 296, 7, 117, 2, 2, 296, 297, 7, 119, 2, 2, 297, 298, 7, 116, 2, 2, 298, 299, 7, 103, 2, 2, 299, 300, 7, 80, 2, 2, 300, 301, 7, 119, 2, 2, 301, 302, 7, 111, 2, 2, 302, 303, 7, 103, 2, 2, 303, 304, 7, 116, 2, 2, 304, 305, 7, 107, 2, 2, 305, 306, 7, 101, 2, 2, 306, 307, 7, 71, 2, 2, 307, 308, 7, 112, 2, 2, 308, 309, 7, 118, 2, 2, 309, 310, 7, 107, 2, 2, 310, 311, 7, 118, 2, 2, 311, 312, 7, 123, 2, 2, 312, 60, 3, 2, 2, 2, 313, 314, 7, 102, 2, 2, 314, 315, 7, 99, 2, 2, 315, 316, 7, 118, 2, 2, 316, 317, 7, 103, 2, 2, 317, 62, 3, 2, 2, 2, 318, 319, 7, 123, 2, 2, 319, 320, 7, 103, 2, 2, 320, 321, 7, 99, 2, 2, 321, 322, 7, 116, 2, 2, 322, 64, 3, 2, 2, 2, 323, 324, 7, 118, 2, 2, 324, 325, 7, 107, 2, 2, 325, 326, 7, 111, 2, 2, 326, 327, 7, 103, 2, 2, 327, 66, 3, 2, 2, 2, 328, 329, 7, 101, 2, 2, 329, 330, 7, 99, 2, 2, 330, 331, 7, 110, 2, 2, 331, 332, 7, 110, 2, 2, 332, 333, 7, 34, 2, 2, 333, 334, 7, 103, 2, 2, 334, 335, 7, 102, 2, 2, 335, 336, 7, 119, 2, 2, 336, 337, 7, 48, 2, 2, 337, 338, 7, 117, 2, 2, 338, 339, 7, 118, 2, 2, 339, 340, 7, 99, 2, 2, 340, 341, 7, 112, 2, 2, 341, 342, 7, 104, 2, 2, 342, 343, 7, 113, 2, 2, 343, 344, 7, 116, 2, 2, 344, 345, 7, 102, 2, 2, 345, 346, 7, 48, 2, 2, 346, 347, 7, 112, 2, 2, 347, 348, 7, 110, 2, 2, 348, 349, 7, 114, 2, 2, 349, 350, 7, 48, 2, 2, 350, 351, 7, 117, 2, 2, 351, 352, 7, 103, 2, 2, 352, 353, 7, 111, 2, 2, 353, 354, 7, 114, 2, 2, 354, 355, 7, 116, 2, 2, 355, 356, 7, 103, 2, 2, 356, 357, 7, 48, 2, 2, 357, 358, 7, 113, 2, 2, 358, 359, 7, 120, 2, 2, 359, 360, 7, 103, 2, 2, 360, 361, 7, 116, 2, 2, 361, 362, 7, 112, 2, 2, 362, 363, 7, 107, 2, 2, 363, 364, 7, 105, 2, 2, 364, 365, 7, 106, 2, 2, 365, 366, 7, 118, 2, 2, 366, 367, 7, 48, 2, 2, 367, 368, 7, 85, 2, 2, 368, 369, 7, 107, 2, 2, 369, 370, 7, 111, 2, 2, 370, 371, 7, 114, 2, 2, 371, 372, 7, 110, 2, 2, 372, 373, 7, 103, 2, 2, 373, 374, 7, 89, 2, 2, 374, 375, 7, 113, 2, 2, 375, 376, 7, 116, 2, 2, 376, 377, 7, 110, 2, 2, 377, 378, 7, 102, 2, 2, 378, 394, 7, 48, 2, 2, 379, 380, 7, 101, 2, 2, 380, 381, 7, 99, 2, 2, 381, 382, 7, 110, 2, 2, 382, 383, 7, 110, 2, 2, 383, 384, 7, 34, 2, 2, 384, 385, 7, 85, 2, 2, 385, 386, 7, 89, 2, 2, 386, 394, 7, 48, 2, 2, 387, 388, 7, 101, 2, 2, 388, 389, 7, 99, 2, 2, 389, 390, 7, 110, 2, 2, 390, 391, 7, 110, 2, 2, 391, 392, 7, 34, 2, 2, 392, 394, 7, 48, 2, 2, 393, 328, 3, 2, 2, 2, 393, 379, 3, 2, 2, 2, 393, 387, 3, 2, 2, 2, 394, 68, 3, 2, 2, 2, 395, 396, 7, 42, 2, 2, 396, 70, 3, 2, 2, 2, 397, 398, 7, 43, 2, 2, 398, 72, 3, 2, 2, 2, 399, 400, 7, 102, 2, 2, 400, 401, 7, 99, 2, 2, 401, 402, 7, 118, 2, 2, 402, 403, 7, 103, 2, 2, 403, 404, 7, 34, 2, 2, 404, 405, 3, 2, 2, 2, 405, 406, 5, 79, 40, 2, 406, 407, 7, 34, 2, 2, 407, 408, 5, 79, 40, 2, 408, 409, 7, 34, 2, 2, 409, 410, 5, 79, 40, 2, 410, 74, 3, 2, 2, 2, 411, 412, 7, 123, 2, 2, 412, 413, 7, 103, 2, 2, 413, 414, 7, 99, 2, 2, 414, 415, 7, 116, 2, 2, 415, 416, 7, 34, 2, 2, 416, 417, 3, 2, 2, 2, 417, 418, 5, 79, 40, 2, 418, 76, 3, 2, 2, 2, 419, 420, 7, 118, 2, 2, 420, 421, 7, 107, 2, 2, 421, 422, 7, 111, 2, 2, 422, 423, 7, 103, 2, 2, 423, 424, 7, 34, 2, 2, 424, 425, 3, 2, 2, 2, 425, 426, 5, 79, 40, 2, 426, 427, 7, 34, 2, 2, 427, 428, 5, 79, 40, 2, 428, 78, 3, 2, 2, 2, 429, 431, 7, 47, 2, 2, 430, 429, 3, 2, 2, 2, 430, 431, 3, 2, 2, 2, 431, 433, 3, 2, 2, 2, 432, 434, 5, 83, 42, 2, 433, 432, 3, 2, 2, 2, 434, 435, 3, 2, 2, 2, 435, 433, 3, 2, 2, 2, 435, 436, 3, 2, 2, 2, 436, 80, 3, 2, 2, 2, 437, 439, 5, 85, 43, 2, 438, 437, 3, 2, 2, 2, 439, 440, 3, 2, 2, 2, 440, 438, 3, 2, 2, 2, 440, 441, 3, 2, 2, 2, 441, 82, 3, 2, 2, 2, 442, 443, 4, 50, 59, 2, 443, 84, 3, 2, 2, 2, 444, 445, 9, 2, 2, 2, 445, 86, 3, 2, 2, 2, 446, 448, 9, 3, 2, 2, 447, 446, 3, 2, 2, 2, 448, 449, 3, 2, 2, 2, 449, 447, 3, 2, 2, 2, 449, 450, 3, 2, 2, 2, 450, 451, 3, 2, 2, 2, 451, 452, 8, 44, 2, 2, 452, 88, 3, 2, 2, 2, 8, 2, 393, 430, 435, 440, 449, 3, 8, 2, 2] -------------------------------------------------------------------------------- /cypher/CypherLexer.py: -------------------------------------------------------------------------------- 1 | # Generated from CypherLexer.g4 by ANTLR 4.9.2 2 | from antlr4 import * 3 | from io import StringIO 4 | import sys 5 | if sys.version_info[1] > 5: 6 | from typing import TextIO 7 | else: 8 | from typing.io import TextIO 9 | 10 | 11 | 12 | def serializedATN(): 13 | with StringIO() as buf: 14 | buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2)") 15 | buf.write("\u00fa\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7") 16 | buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r") 17 | buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23") 18 | buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30") 19 | buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36") 20 | buf.write("\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%") 21 | buf.write("\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\3\2\3\2\3\2\3\2") 22 | buf.write("\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3") 23 | buf.write("\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\7") 24 | buf.write("\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\n\3\n\3") 25 | buf.write("\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3") 26 | buf.write("\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r") 27 | buf.write("\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17") 28 | buf.write("\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\22") 29 | buf.write("\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3\26\3\27") 30 | buf.write("\3\27\3\27\3\30\3\30\3\31\3\31\3\32\3\32\3\33\3\33\3\34") 31 | buf.write("\3\34\3\35\3\35\3\35\3\36\3\36\3\36\3\37\3\37\3 \3 \3") 32 | buf.write(" \3!\3!\3\"\3\"\3#\6#\u00da\n#\r#\16#\u00db\3$\6$\u00df") 33 | buf.write("\n$\r$\16$\u00e0\3%\6%\u00e4\n%\r%\16%\u00e5\3&\3&\3\'") 34 | buf.write("\3\'\3(\5(\u00ed\n(\3)\3)\3*\5*\u00f2\n*\3+\6+\u00f5\n") 35 | buf.write("+\r+\16+\u00f6\3+\3+\2\2,\3\3\5\4\7\5\t\6\13\7\r\b\17") 36 | buf.write("\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23") 37 | buf.write("%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36") 38 | buf.write(";\37= ?!A\"C#E$G%I&K\'M(O\2Q\2S\2U)\3\2\5\4\2$$))\t\2") 39 | buf.write("##\'\',,..\61\61AA\u00a3\u00a3\5\2\13\f\17\17\"\"\4?\2") 40 | buf.write("\62\2;\2\u00b4\2\u00b5\2\u00bb\2\u00bb\2\u00be\2\u00c0") 41 | buf.write("\2\u09f6\2\u09fb\2\u0b74\2\u0b79\2\u0bf2\2\u0bf4\2\u0c7a") 42 | buf.write("\2\u0c80\2\u0d5a\2\u0d60\2\u0d72\2\u0d7a\2\u0f2c\2\u0f35") 43 | buf.write("\2\u136b\2\u137e\2\u17f2\2\u17fb\2\u19dc\2\u19dc\2\u2072") 44 | buf.write("\2\u2072\2\u2076\2\u207b\2\u2082\2\u208b\2\u2152\2\u2161") 45 | buf.write("\2\u218b\2\u218b\2\u2462\2\u249d\2\u24ec\2\u2501\2\u2778") 46 | buf.write("\2\u2795\2\u2cff\2\u2cff\2\u3194\2\u3197\2\u3222\2\u322b") 47 | buf.write("\2\u324a\2\u3251\2\u3253\2\u3261\2\u3282\2\u328b\2\u32b3") 48 | buf.write("\2\u32c1\2\ua832\2\ua837\2\u0109\3\u0135\3\u0177\3\u017a") 49 | buf.write("\3\u018c\3\u018d\3\u02e3\3\u02fd\3\u0322\3\u0325\3\u085a") 50 | buf.write("\3\u0861\3\u087b\3\u0881\3\u08a9\3\u08b1\3\u08fd\3\u0901") 51 | buf.write("\3\u0918\3\u091d\3\u09be\3\u09bf\3\u09c2\3\u09d1\3\u09d4") 52 | buf.write("\3\u0a01\3\u0a42\3\u0a49\3\u0a7f\3\u0a80\3\u0a9f\3\u0aa1") 53 | buf.write("\3\u0aed\3\u0af1\3\u0b5a\3\u0b61\3\u0b7a\3\u0b81\3\u0bab") 54 | buf.write("\3\u0bb1\3\u0cfc\3\u0d01\3\u0e62\3\u0e80\3\u1054\3\u1067") 55 | buf.write("\3\u11e3\3\u11f6\3\u173c\3\u173d\3\u18ec\3\u18f4\3\u1c5c") 56 | buf.write("\3\u1c6e\3\u6b5d\3\u6b63\3\ud362\3\ud373\3\ue8c9\3\ue8d1") 57 | buf.write("\3\uf102\3\uf10e\3\u00bb\2&\2&\2-\2-\2>\2@\2C\2\\\2a\2") 58 | buf.write("a\2c\2|\2~\2~\2\u0080\2\u0080\2\u00a4\2\u00a7\2\u00ae") 59 | buf.write("\2\u00ae\2\u00b3\2\u00b3\2\u00b7\2\u00b7\2\u00c2\2\u01bc") 60 | buf.write("\2\u01be\2\u01c1\2\u01c6\2\u01c6\2\u01c8\2\u01c9\2\u01cb") 61 | buf.write("\2\u01cc\2\u01ce\2\u01f3\2\u01f5\2\u0295\2\u0297\2\u02b1") 62 | buf.write("\2\u0372\2\u0375\2\u0378\2\u0379\2\u037d\2\u037f\2\u0381") 63 | buf.write("\2\u0381\2\u0388\2\u0388\2\u038a\2\u038c\2\u038e\2\u038e") 64 | buf.write("\2\u0390\2\u03a3\2\u03a5\2\u0483\2\u048c\2\u0531\2\u0533") 65 | buf.write("\2\u0558\2\u0563\2\u0589\2\u0591\2\u0591\2\u0608\2\u060a") 66 | buf.write("\2\u060d\2\u060d\2\u09f4\2\u09f5\2\u09fd\2\u09fd\2\u0af3") 67 | buf.write("\2\u0af3\2\u0bfb\2\u0bfb\2\u0e41\2\u0e41\2\u10a2\2\u10c7") 68 | buf.write("\2\u10c9\2\u10c9\2\u10cf\2\u10cf\2\u13a2\2\u13f7\2\u13fa") 69 | buf.write("\2\u13ff\2\u17dd\2\u17dd\2\u1c82\2\u1c8a\2\u1d02\2\u1d2d") 70 | buf.write("\2\u1d6d\2\u1d79\2\u1d7b\2\u1d9c\2\u1e02\2\u1f17\2\u1f1a") 71 | buf.write("\2\u1f1f\2\u1f22\2\u1f47\2\u1f4a\2\u1f4f\2\u1f52\2\u1f59") 72 | buf.write("\2\u1f5b\2\u1f5b\2\u1f5d\2\u1f5d\2\u1f5f\2\u1f5f\2\u1f61") 73 | buf.write("\2\u1f7f\2\u1f82\2\u1f89\2\u1f92\2\u1f99\2\u1fa2\2\u1fa9") 74 | buf.write("\2\u1fb2\2\u1fb6\2\u1fb8\2\u1fbd\2\u1fc0\2\u1fc0\2\u1fc4") 75 | buf.write("\2\u1fc6\2\u1fc8\2\u1fcd\2\u1fd2\2\u1fd5\2\u1fd8\2\u1fdd") 76 | buf.write("\2\u1fe2\2\u1fee\2\u1ff4\2\u1ff6\2\u1ff8\2\u1ffd\2\u2046") 77 | buf.write("\2\u2046\2\u2054\2\u2054\2\u207c\2\u207e\2\u208c\2\u208e") 78 | buf.write("\2\u20a2\2\u20c1\2\u2104\2\u2104\2\u2109\2\u2109\2\u210c") 79 | buf.write("\2\u2115\2\u2117\2\u2117\2\u211a\2\u211f\2\u2126\2\u2126") 80 | buf.write("\2\u2128\2\u2128\2\u212a\2\u212a\2\u212c\2\u212f\2\u2131") 81 | buf.write("\2\u2136\2\u213b\2\u213b\2\u213e\2\u214b\2\u214d\2\u214d") 82 | buf.write("\2\u2150\2\u2150\2\u2185\2\u2186\2\u2192\2\u2196\2\u219c") 83 | buf.write("\2\u219d\2\u21a2\2\u21a2\2\u21a5\2\u21a5\2\u21a8\2\u21a8") 84 | buf.write("\2\u21b0\2\u21b0\2\u21d0\2\u21d1\2\u21d4\2\u21d4\2\u21d6") 85 | buf.write("\2\u21d6\2\u21f6\2\u2301\2\u2322\2\u2323\2\u237e\2\u237e") 86 | buf.write("\2\u239d\2\u23b5\2\u23de\2\u23e3\2\u25b9\2\u25b9\2\u25c3") 87 | buf.write("\2\u25c3\2\u25fa\2\u2601\2\u2671\2\u2671\2\u27c2\2\u27c6") 88 | buf.write("\2\u27c9\2\u27e7\2\u27f2\2\u2801\2\u2902\2\u2984\2\u299b") 89 | buf.write("\2\u29d9\2\u29de\2\u29fd\2\u2a00\2\u2b01\2\u2b32\2\u2b46") 90 | buf.write("\2\u2b49\2\u2b4e\2\u2c02\2\u2c30\2\u2c32\2\u2c60\2\u2c62") 91 | buf.write("\2\u2c7d\2\u2c80\2\u2ce6\2\u2ced\2\u2cf0\2\u2cf4\2\u2cf5") 92 | buf.write("\2\u2d02\2\u2d27\2\u2d29\2\u2d29\2\u2d2f\2\u2d2f\2\ua642") 93 | buf.write("\2\ua66f\2\ua682\2\ua69d\2\ua724\2\ua771\2\ua773\2\ua789") 94 | buf.write("\2\ua78d\2\ua790\2\ua792\2\ua7b0\2\ua7b2\2\ua7b9\2\ua7fc") 95 | buf.write("\2\ua7fc\2\ua83a\2\ua83a\2\uab32\2\uab5c\2\uab62\2\uab67") 96 | buf.write("\2\uab72\2\uabc1\2\ufb02\2\ufb08\2\ufb15\2\ufb19\2\ufb2b") 97 | buf.write("\2\ufb2b\2\ufdfe\2\ufdfe\2\ufe64\2\ufe64\2\ufe66\2\ufe68") 98 | buf.write("\2\ufe6b\2\ufe6b\2\uff06\2\uff06\2\uff0d\2\uff0d\2\uff1e") 99 | buf.write("\2\uff20\2\uff23\2\uff3c\2\uff43\2\uff5c\2\uff5e\2\uff5e") 100 | buf.write("\2\uff60\2\uff60\2\uffe2\2\uffe4\2\uffe7\2\uffe8\2\uffeb") 101 | buf.write("\2\uffee\2\u0402\3\u0451\3\u04b2\3\u04d5\3\u04da\3\u04fd") 102 | buf.write("\3\u0c82\3\u0cb4\3\u0cc2\3\u0cf4\3\u18a2\3\u18e1\3\ud402") 103 | buf.write("\3\ud456\3\ud458\3\ud49e\3\ud4a0\3\ud4a1\3\ud4a4\3\ud4a4") 104 | buf.write("\3\ud4a7\3\ud4a8\3\ud4ab\3\ud4ae\3\ud4b0\3\ud4bb\3\ud4bd") 105 | buf.write("\3\ud4bd\3\ud4bf\3\ud4c5\3\ud4c7\3\ud507\3\ud509\3\ud50c") 106 | buf.write("\3\ud50f\3\ud516\3\ud518\3\ud51e\3\ud520\3\ud53b\3\ud53d") 107 | buf.write("\3\ud540\3\ud542\3\ud546\3\ud548\3\ud548\3\ud54c\3\ud552") 108 | buf.write("\3\ud554\3\ud6a7\3\ud6aa\3\ud7cd\3\ue902\3\ue945\3\ueef2") 109 | buf.write("\3\ueef3\3\u00fa\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2") 110 | buf.write("\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21") 111 | buf.write("\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3") 112 | buf.write("\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2") 113 | buf.write("\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2") 114 | buf.write("\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2") 115 | buf.write("\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2") 116 | buf.write("\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3") 117 | buf.write("\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2U\3\2\2\2\3W") 118 | buf.write("\3\2\2\2\5\\\3\2\2\2\7b\3\2\2\2\th\3\2\2\2\13o\3\2\2\2") 119 | buf.write("\ru\3\2\2\2\17z\3\2\2\2\21}\3\2\2\2\23\u0081\3\2\2\2\25") 120 | buf.write("\u0084\3\2\2\2\27\u008d\3\2\2\2\31\u0093\3\2\2\2\33\u009c") 121 | buf.write("\3\2\2\2\35\u00a2\3\2\2\2\37\u00aa\3\2\2\2!\u00af\3\2") 122 | buf.write("\2\2#\u00b1\3\2\2\2%\u00b3\3\2\2\2\'\u00b5\3\2\2\2)\u00b7") 123 | buf.write("\3\2\2\2+\u00b9\3\2\2\2-\u00bc\3\2\2\2/\u00bf\3\2\2\2") 124 | buf.write("\61\u00c1\3\2\2\2\63\u00c3\3\2\2\2\65\u00c5\3\2\2\2\67") 125 | buf.write("\u00c7\3\2\2\29\u00c9\3\2\2\2;\u00cc\3\2\2\2=\u00cf\3") 126 | buf.write("\2\2\2?\u00d1\3\2\2\2A\u00d4\3\2\2\2C\u00d6\3\2\2\2E\u00d9") 127 | buf.write("\3\2\2\2G\u00de\3\2\2\2I\u00e3\3\2\2\2K\u00e7\3\2\2\2") 128 | buf.write("M\u00e9\3\2\2\2O\u00ec\3\2\2\2Q\u00ee\3\2\2\2S\u00f1\3") 129 | buf.write("\2\2\2U\u00f4\3\2\2\2WX\7E\2\2XY\7C\2\2YZ\7N\2\2Z[\7N") 130 | buf.write("\2\2[\4\3\2\2\2\\]\7O\2\2]^\7C\2\2^_\7V\2\2_`\7E\2\2`") 131 | buf.write("a\7J\2\2a\6\3\2\2\2bc\7Y\2\2cd\7J\2\2de\7G\2\2ef\7T\2") 132 | buf.write("\2fg\7G\2\2g\b\3\2\2\2hi\7T\2\2ij\7G\2\2jk\7V\2\2kl\7") 133 | buf.write("W\2\2lm\7T\2\2mn\7P\2\2n\n\3\2\2\2op\7W\2\2pq\7P\2\2q") 134 | buf.write("r\7K\2\2rs\7Q\2\2st\7P\2\2t\f\3\2\2\2uv\7Y\2\2vw\7K\2") 135 | buf.write("\2wx\7V\2\2xy\7J\2\2y\16\3\2\2\2z{\7C\2\2{|\7U\2\2|\20") 136 | buf.write("\3\2\2\2}~\7C\2\2~\177\7P\2\2\177\u0080\7F\2\2\u0080\22") 137 | buf.write("\3\2\2\2\u0081\u0082\7Q\2\2\u0082\u0083\7T\2\2\u0083\24") 138 | buf.write("\3\2\2\2\u0084\u0085\7Q\2\2\u0085\u0086\7T\2\2\u0086\u0087") 139 | buf.write("\7F\2\2\u0087\u0088\7G\2\2\u0088\u0089\7T\2\2\u0089\u008a") 140 | buf.write("\7\"\2\2\u008a\u008b\7D\2\2\u008b\u008c\7[\2\2\u008c\26") 141 | buf.write("\3\2\2\2\u008d\u008e\7N\2\2\u008e\u008f\7K\2\2\u008f\u0090") 142 | buf.write("\7O\2\2\u0090\u0091\7K\2\2\u0091\u0092\7V\2\2\u0092\30") 143 | buf.write("\3\2\2\2\u0093\u0094\7F\2\2\u0094\u0095\7K\2\2\u0095\u0096") 144 | buf.write("\7U\2\2\u0096\u0097\7V\2\2\u0097\u0098\7K\2\2\u0098\u0099") 145 | buf.write("\7P\2\2\u0099\u009a\7E\2\2\u009a\u009b\7V\2\2\u009b\32") 146 | buf.write("\3\2\2\2\u009c\u009d\7e\2\2\u009d\u009e\7q\2\2\u009e\u009f") 147 | buf.write("\7w\2\2\u009f\u00a0\7p\2\2\u00a0\u00a1\7v\2\2\u00a1\34") 148 | buf.write("\3\2\2\2\u00a2\u00a3\7k\2\2\u00a3\u00a4\7u\2\2\u00a4\u00a5") 149 | buf.write("\7G\2\2\u00a5\u00a6\7o\2\2\u00a6\u00a7\7r\2\2\u00a7\u00a8") 150 | buf.write("\7v\2\2\u00a8\u00a9\7{\2\2\u00a9\36\3\2\2\2\u00aa\u00ab") 151 | buf.write("\7F\2\2\u00ab\u00ac\7G\2\2\u00ac\u00ad\7U\2\2\u00ad\u00ae") 152 | buf.write("\7E\2\2\u00ae \3\2\2\2\u00af\u00b0\t\2\2\2\u00b0\"\3\2") 153 | buf.write("\2\2\u00b1\u00b2\7*\2\2\u00b2$\3\2\2\2\u00b3\u00b4\7+") 154 | buf.write("\2\2\u00b4&\3\2\2\2\u00b5\u00b6\7}\2\2\u00b6(\3\2\2\2") 155 | buf.write("\u00b7\u00b8\7<\2\2\u00b8*\3\2\2\2\u00b9\u00ba\7/\2\2") 156 | buf.write("\u00ba\u00bb\7@\2\2\u00bb,\3\2\2\2\u00bc\u00bd\7>\2\2") 157 | buf.write("\u00bd\u00be\7/\2\2\u00be.\3\2\2\2\u00bf\u00c0\7/\2\2") 158 | buf.write("\u00c0\60\3\2\2\2\u00c1\u00c2\7\177\2\2\u00c2\62\3\2\2") 159 | buf.write("\2\u00c3\u00c4\7]\2\2\u00c4\64\3\2\2\2\u00c5\u00c6\7_") 160 | buf.write("\2\2\u00c6\66\3\2\2\2\u00c7\u00c8\7?\2\2\u00c88\3\2\2") 161 | buf.write("\2\u00c9\u00ca\7>\2\2\u00ca\u00cb\7@\2\2\u00cb:\3\2\2") 162 | buf.write("\2\u00cc\u00cd\7@\2\2\u00cd\u00ce\7?\2\2\u00ce<\3\2\2") 163 | buf.write("\2\u00cf\u00d0\7@\2\2\u00d0>\3\2\2\2\u00d1\u00d2\7>\2") 164 | buf.write("\2\u00d2\u00d3\7?\2\2\u00d3@\3\2\2\2\u00d4\u00d5\7>\2") 165 | buf.write("\2\u00d5B\3\2\2\2\u00d6\u00d7\7\60\2\2\u00d7D\3\2\2\2") 166 | buf.write("\u00d8\u00da\5O(\2\u00d9\u00d8\3\2\2\2\u00da\u00db\3\2") 167 | buf.write("\2\2\u00db\u00d9\3\2\2\2\u00db\u00dc\3\2\2\2\u00dcF\3") 168 | buf.write("\2\2\2\u00dd\u00df\5Q)\2\u00de\u00dd\3\2\2\2\u00df\u00e0") 169 | buf.write("\3\2\2\2\u00e0\u00de\3\2\2\2\u00e0\u00e1\3\2\2\2\u00e1") 170 | buf.write("H\3\2\2\2\u00e2\u00e4\5S*\2\u00e3\u00e2\3\2\2\2\u00e4") 171 | buf.write("\u00e5\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e5\u00e6\3\2\2\2") 172 | buf.write("\u00e6J\3\2\2\2\u00e7\u00e8\7~\2\2\u00e8L\3\2\2\2\u00e9") 173 | buf.write("\u00ea\7.\2\2\u00eaN\3\2\2\2\u00eb\u00ed\t\5\2\2\u00ec") 174 | buf.write("\u00eb\3\2\2\2\u00edP\3\2\2\2\u00ee\u00ef\t\3\2\2\u00ef") 175 | buf.write("R\3\2\2\2\u00f0\u00f2\t\6\2\2\u00f1\u00f0\3\2\2\2\u00f2") 176 | buf.write("T\3\2\2\2\u00f3\u00f5\t\4\2\2\u00f4\u00f3\3\2\2\2\u00f5") 177 | buf.write("\u00f6\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f6\u00f7\3\2\2\2") 178 | buf.write("\u00f7\u00f8\3\2\2\2\u00f8\u00f9\b+\2\2\u00f9V\3\2\2\2") 179 | buf.write("\t\2\u00db\u00e0\u00e5\u00ec\u00f1\u00f6\3\b\2\2") 180 | return buf.getvalue() 181 | 182 | 183 | class CypherLexer(Lexer): 184 | 185 | atn = ATNDeserializer().deserialize(serializedATN()) 186 | 187 | decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] 188 | 189 | Call = 1 190 | Match = 2 191 | Where = 3 192 | Return = 4 193 | Union = 5 194 | With = 6 195 | As = 7 196 | And = 8 197 | Or = 9 198 | OrderBy = 10 199 | Limit = 11 200 | Distinct = 12 201 | CountFunction = 13 202 | IsEmptyFunction = 14 203 | Desc = 15 204 | SEP = 16 205 | LP = 17 206 | RP = 18 207 | LB = 19 208 | COL = 20 209 | TORIGHT = 21 210 | TOLEFT = 22 211 | UND = 23 212 | RB = 24 213 | LSB = 25 214 | RSB = 26 215 | EQ = 27 216 | NEQ = 28 217 | GTE = 29 218 | GT = 30 219 | LTE = 31 220 | LT = 32 221 | DOT = 33 222 | INTEGER = 34 223 | STRING_SYMBOL = 35 224 | STRING_LITERAL = 36 225 | OR = 37 226 | COMMA = 38 227 | WS = 39 228 | 229 | channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] 230 | 231 | modeNames = [ "DEFAULT_MODE" ] 232 | 233 | literalNames = [ "", 234 | "'CALL'", "'MATCH'", "'WHERE'", "'RETURN'", "'UNION'", "'WITH'", 235 | "'AS'", "'AND'", "'OR'", "'ORDER BY'", "'LIMIT'", "'DISTINCT'", 236 | "'count'", "'isEmpty'", "'DESC'", "'('", "')'", "'{'", "':'", 237 | "'->'", "'<-'", "'-'", "'}'", "'['", "']'", "'='", "'<>'", "'>='", 238 | "'>'", "'<='", "'<'", "'.'", "'|'", "','" ] 239 | 240 | symbolicNames = [ "", 241 | "Call", "Match", "Where", "Return", "Union", "With", "As", "And", 242 | "Or", "OrderBy", "Limit", "Distinct", "CountFunction", "IsEmptyFunction", 243 | "Desc", "SEP", "LP", "RP", "LB", "COL", "TORIGHT", "TOLEFT", 244 | "UND", "RB", "LSB", "RSB", "EQ", "NEQ", "GTE", "GT", "LTE", 245 | "LT", "DOT", "INTEGER", "STRING_SYMBOL", "STRING_LITERAL", "OR", 246 | "COMMA", "WS" ] 247 | 248 | ruleNames = [ "Call", "Match", "Where", "Return", "Union", "With", "As", 249 | "And", "Or", "OrderBy", "Limit", "Distinct", "CountFunction", 250 | "IsEmptyFunction", "Desc", "SEP", "LP", "RP", "LB", "COL", 251 | "TORIGHT", "TOLEFT", "UND", "RB", "LSB", "RSB", "EQ", 252 | "NEQ", "GTE", "GT", "LTE", "LT", "DOT", "INTEGER", "STRING_SYMBOL", 253 | "STRING_LITERAL", "OR", "COMMA", "DIGIT", "SYMBOL", "CHAR", 254 | "WS" ] 255 | 256 | grammarFileName = "CypherLexer.g4" 257 | 258 | def __init__(self, input=None, output:TextIO = sys.stdout): 259 | super().__init__(input, output) 260 | self.checkVersion("4.9.2") 261 | self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) 262 | self._actions = None 263 | self._predicates = None 264 | 265 | 266 | -------------------------------------------------------------------------------- /overnight/OvernightLexer.py: -------------------------------------------------------------------------------- 1 | # Generated from ./graphq_ir/overnight/Overnight.g4 by ANTLR 4.9.2 2 | from antlr4 import * 3 | from io import StringIO 4 | import sys 5 | if sys.version_info[1] > 5: 6 | from typing import TextIO 7 | else: 8 | from typing.io import TextIO 9 | 10 | 11 | 12 | def serializedATN(): 13 | with StringIO() as buf: 14 | buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2+") 15 | buf.write("\u01c5\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7") 16 | buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r") 17 | buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23") 18 | buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30") 19 | buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36") 20 | buf.write("\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%") 21 | buf.write("\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\3\2\3\2\3") 22 | buf.write("\2\3\2\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3\5\3\5") 23 | buf.write("\3\5\3\5\3\5\3\5\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3") 24 | buf.write("\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\13\3\13\3") 25 | buf.write("\f\3\f\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\16\3\17\3\17\3") 26 | buf.write("\17\3\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21") 27 | buf.write("\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23") 28 | buf.write("\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24") 29 | buf.write("\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\25") 30 | buf.write("\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26") 31 | buf.write("\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27") 32 | buf.write("\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30") 33 | buf.write("\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31") 34 | buf.write("\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31") 35 | buf.write("\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32") 36 | buf.write("\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\34") 37 | buf.write("\3\34\3\34\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35") 38 | buf.write("\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\35") 39 | buf.write("\3\35\3\35\3\35\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36") 40 | buf.write("\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36") 41 | buf.write("\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3\37\3\37\3 ") 42 | buf.write("\3 \3 \3 \3 \3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3\"\3") 43 | buf.write("\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"") 44 | buf.write("\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3") 45 | buf.write("\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"") 46 | buf.write("\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3\"\3") 47 | buf.write("\"\3\"\3\"\3\"\3\"\5\"\u018a\n\"\3#\3#\3$\3$\3%\3%\3%") 48 | buf.write("\3%\3%\3%\3%\3%\3%\3%\3%\3%\3&\3&\3&\3&\3&\3&\3&\3&\3") 49 | buf.write("\'\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3(\5(\u01af\n(") 50 | buf.write("\3(\6(\u01b2\n(\r(\16(\u01b3\3)\6)\u01b7\n)\r)\16)\u01b8") 51 | buf.write("\3*\3*\3+\3+\3,\6,\u01c0\n,\r,\16,\u01c1\3,\3,\2\2-\3") 52 | buf.write("\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16") 53 | buf.write("\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61") 54 | buf.write("\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O)Q*") 55 | buf.write("S\2U\2W+\3\2\4\6\2//C\\aac|\5\2\13\f\17\17\"\"\2\u01c8") 56 | buf.write("\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13") 57 | buf.write("\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3") 58 | buf.write("\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2") 59 | buf.write("\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2") 60 | buf.write("%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2") 61 | buf.write("\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67") 62 | buf.write("\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2") 63 | buf.write("A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2") 64 | buf.write("\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2W\3\2\2") 65 | buf.write("\2\3Y\3\2\2\2\5]\3\2\2\2\7_\3\2\2\2\tf\3\2\2\2\13m\3\2") 66 | buf.write("\2\2\ro\3\2\2\2\17t\3\2\2\2\21x\3\2\2\2\23\177\3\2\2\2") 67 | buf.write("\25\u0081\3\2\2\2\27\u0083\3\2\2\2\31\u0085\3\2\2\2\33") 68 | buf.write("\u0089\3\2\2\2\35\u008d\3\2\2\2\37\u0091\3\2\2\2!\u0095") 69 | buf.write("\3\2\2\2#\u009f\3\2\2\2%\u00a4\3\2\2\2\'\u00ab\3\2\2\2") 70 | buf.write(")\u00b5\3\2\2\2+\u00bc\3\2\2\2-\u00c8\3\2\2\2/\u00d4\3") 71 | buf.write("\2\2\2\61\u00e5\3\2\2\2\63\u00f6\3\2\2\2\65\u0100\3\2") 72 | buf.write("\2\2\67\u0107\3\2\2\29\u010f\3\2\2\2;\u0125\3\2\2\2=\u0139") 73 | buf.write("\3\2\2\2?\u013e\3\2\2\2A\u0143\3\2\2\2C\u0189\3\2\2\2") 74 | buf.write("E\u018b\3\2\2\2G\u018d\3\2\2\2I\u018f\3\2\2\2K\u019b\3") 75 | buf.write("\2\2\2M\u01a3\3\2\2\2O\u01ae\3\2\2\2Q\u01b6\3\2\2\2S\u01ba") 76 | buf.write("\3\2\2\2U\u01bc\3\2\2\2W\u01bf\3\2\2\2YZ\7g\2\2Z[\7p\2") 77 | buf.write("\2[\\\7\60\2\2\\\4\3\2\2\2]^\7\60\2\2^\6\3\2\2\2_`\7u") 78 | buf.write("\2\2`a\7v\2\2ab\7t\2\2bc\7k\2\2cd\7p\2\2de\7i\2\2e\b\3") 79 | buf.write("\2\2\2fg\7p\2\2gh\7w\2\2hi\7o\2\2ij\7d\2\2jk\7g\2\2kl") 80 | buf.write("\7t\2\2l\n\3\2\2\2mn\7#\2\2n\f\3\2\2\2op\7v\2\2pq\7{\2") 81 | buf.write("\2qr\7r\2\2rs\7g\2\2s\16\3\2\2\2tu\7x\2\2uv\7c\2\2vw\7") 82 | buf.write("t\2\2w\20\3\2\2\2xy\7n\2\2yz\7c\2\2z{\7o\2\2{|\7d\2\2") 83 | buf.write("|}\7f\2\2}~\7c\2\2~\22\3\2\2\2\177\u0080\7?\2\2\u0080") 84 | buf.write("\24\3\2\2\2\u0081\u0082\7>\2\2\u0082\26\3\2\2\2\u0083") 85 | buf.write("\u0084\7@\2\2\u0084\30\3\2\2\2\u0085\u0086\7o\2\2\u0086") 86 | buf.write("\u0087\7k\2\2\u0087\u0088\7p\2\2\u0088\32\3\2\2\2\u0089") 87 | buf.write("\u008a\7o\2\2\u008a\u008b\7c\2\2\u008b\u008c\7z\2\2\u008c") 88 | buf.write("\34\3\2\2\2\u008d\u008e\7u\2\2\u008e\u008f\7w\2\2\u008f") 89 | buf.write("\u0090\7o\2\2\u0090\36\3\2\2\2\u0091\u0092\7c\2\2\u0092") 90 | buf.write("\u0093\7x\2\2\u0093\u0094\7i\2\2\u0094 \3\2\2\2\u0095") 91 | buf.write("\u0096\7n\2\2\u0096\u0097\7k\2\2\u0097\u0098\7u\2\2\u0098") 92 | buf.write("\u0099\7v\2\2\u0099\u009a\7X\2\2\u009a\u009b\7c\2\2\u009b") 93 | buf.write("\u009c\7n\2\2\u009c\u009d\7w\2\2\u009d\u009e\7g\2\2\u009e") 94 | buf.write("\"\3\2\2\2\u009f\u00a0\7u\2\2\u00a0\u00a1\7k\2\2\u00a1") 95 | buf.write("\u00a2\7|\2\2\u00a2\u00a3\7g\2\2\u00a3$\3\2\2\2\u00a4") 96 | buf.write("\u00a5\7f\2\2\u00a5\u00a6\7q\2\2\u00a6\u00a7\7o\2\2\u00a7") 97 | buf.write("\u00a8\7c\2\2\u00a8\u00a9\7k\2\2\u00a9\u00aa\7p\2\2\u00aa") 98 | buf.write("&\3\2\2\2\u00ab\u00ac\7u\2\2\u00ac\u00ad\7k\2\2\u00ad") 99 | buf.write("\u00ae\7p\2\2\u00ae\u00af\7i\2\2\u00af\u00b0\7n\2\2\u00b0") 100 | buf.write("\u00b1\7g\2\2\u00b1\u00b2\7v\2\2\u00b2\u00b3\7q\2\2\u00b3") 101 | buf.write("\u00b4\7p\2\2\u00b4(\3\2\2\2\u00b5\u00b6\7h\2\2\u00b6") 102 | buf.write("\u00b7\7k\2\2\u00b7\u00b8\7n\2\2\u00b8\u00b9\7v\2\2\u00b9") 103 | buf.write("\u00ba\7g\2\2\u00ba\u00bb\7t\2\2\u00bb*\3\2\2\2\u00bc") 104 | buf.write("\u00bd\7i\2\2\u00bd\u00be\7g\2\2\u00be\u00bf\7v\2\2\u00bf") 105 | buf.write("\u00c0\7R\2\2\u00c0\u00c1\7t\2\2\u00c1\u00c2\7q\2\2\u00c2") 106 | buf.write("\u00c3\7r\2\2\u00c3\u00c4\7g\2\2\u00c4\u00c5\7t\2\2\u00c5") 107 | buf.write("\u00c6\7v\2\2\u00c6\u00c7\7{\2\2\u00c7,\3\2\2\2\u00c8") 108 | buf.write("\u00c9\7u\2\2\u00c9\u00ca\7w\2\2\u00ca\u00cb\7r\2\2\u00cb") 109 | buf.write("\u00cc\7g\2\2\u00cc\u00cd\7t\2\2\u00cd\u00ce\7n\2\2\u00ce") 110 | buf.write("\u00cf\7c\2\2\u00cf\u00d0\7v\2\2\u00d0\u00d1\7k\2\2\u00d1") 111 | buf.write("\u00d2\7x\2\2\u00d2\u00d3\7g\2\2\u00d3.\3\2\2\2\u00d4") 112 | buf.write("\u00d5\7e\2\2\u00d5\u00d6\7q\2\2\u00d6\u00d7\7w\2\2\u00d7") 113 | buf.write("\u00d8\7p\2\2\u00d8\u00d9\7v\2\2\u00d9\u00da\7U\2\2\u00da") 114 | buf.write("\u00db\7w\2\2\u00db\u00dc\7r\2\2\u00dc\u00dd\7g\2\2\u00dd") 115 | buf.write("\u00de\7t\2\2\u00de\u00df\7n\2\2\u00df\u00e0\7c\2\2\u00e0") 116 | buf.write("\u00e1\7v\2\2\u00e1\u00e2\7k\2\2\u00e2\u00e3\7x\2\2\u00e3") 117 | buf.write("\u00e4\7g\2\2\u00e4\60\3\2\2\2\u00e5\u00e6\7e\2\2\u00e6") 118 | buf.write("\u00e7\7q\2\2\u00e7\u00e8\7w\2\2\u00e8\u00e9\7p\2\2\u00e9") 119 | buf.write("\u00ea\7v\2\2\u00ea\u00eb\7E\2\2\u00eb\u00ec\7q\2\2\u00ec") 120 | buf.write("\u00ed\7o\2\2\u00ed\u00ee\7r\2\2\u00ee\u00ef\7c\2\2\u00ef") 121 | buf.write("\u00f0\7t\2\2\u00f0\u00f1\7c\2\2\u00f1\u00f2\7v\2\2\u00f2") 122 | buf.write("\u00f3\7k\2\2\u00f3\u00f4\7x\2\2\u00f4\u00f5\7g\2\2\u00f5") 123 | buf.write("\62\3\2\2\2\u00f6\u00f7\7c\2\2\u00f7\u00f8\7i\2\2\u00f8") 124 | buf.write("\u00f9\7i\2\2\u00f9\u00fa\7t\2\2\u00fa\u00fb\7g\2\2\u00fb") 125 | buf.write("\u00fc\7i\2\2\u00fc\u00fd\7c\2\2\u00fd\u00fe\7v\2\2\u00fe") 126 | buf.write("\u00ff\7g\2\2\u00ff\64\3\2\2\2\u0100\u0101\7e\2\2\u0101") 127 | buf.write("\u0102\7q\2\2\u0102\u0103\7p\2\2\u0103\u0104\7e\2\2\u0104") 128 | buf.write("\u0105\7c\2\2\u0105\u0106\7v\2\2\u0106\66\3\2\2\2\u0107") 129 | buf.write("\u0108\7t\2\2\u0108\u0109\7g\2\2\u0109\u010a\7x\2\2\u010a") 130 | buf.write("\u010b\7g\2\2\u010b\u010c\7t\2\2\u010c\u010d\7u\2\2\u010d") 131 | buf.write("\u010e\7g\2\2\u010e8\3\2\2\2\u010f\u0110\7g\2\2\u0110") 132 | buf.write("\u0111\7p\2\2\u0111\u0112\7u\2\2\u0112\u0113\7w\2\2\u0113") 133 | buf.write("\u0114\7t\2\2\u0114\u0115\7g\2\2\u0115\u0116\7P\2\2\u0116") 134 | buf.write("\u0117\7w\2\2\u0117\u0118\7o\2\2\u0118\u0119\7g\2\2\u0119") 135 | buf.write("\u011a\7t\2\2\u011a\u011b\7k\2\2\u011b\u011c\7e\2\2\u011c") 136 | buf.write("\u011d\7R\2\2\u011d\u011e\7t\2\2\u011e\u011f\7q\2\2\u011f") 137 | buf.write("\u0120\7r\2\2\u0120\u0121\7g\2\2\u0121\u0122\7t\2\2\u0122") 138 | buf.write("\u0123\7v\2\2\u0123\u0124\7{\2\2\u0124:\3\2\2\2\u0125") 139 | buf.write("\u0126\7g\2\2\u0126\u0127\7p\2\2\u0127\u0128\7u\2\2\u0128") 140 | buf.write("\u0129\7w\2\2\u0129\u012a\7t\2\2\u012a\u012b\7g\2\2\u012b") 141 | buf.write("\u012c\7P\2\2\u012c\u012d\7w\2\2\u012d\u012e\7o\2\2\u012e") 142 | buf.write("\u012f\7g\2\2\u012f\u0130\7t\2\2\u0130\u0131\7k\2\2\u0131") 143 | buf.write("\u0132\7e\2\2\u0132\u0133\7G\2\2\u0133\u0134\7p\2\2\u0134") 144 | buf.write("\u0135\7v\2\2\u0135\u0136\7k\2\2\u0136\u0137\7v\2\2\u0137") 145 | buf.write("\u0138\7{\2\2\u0138<\3\2\2\2\u0139\u013a\7f\2\2\u013a") 146 | buf.write("\u013b\7c\2\2\u013b\u013c\7v\2\2\u013c\u013d\7g\2\2\u013d") 147 | buf.write(">\3\2\2\2\u013e\u013f\7{\2\2\u013f\u0140\7g\2\2\u0140") 148 | buf.write("\u0141\7c\2\2\u0141\u0142\7t\2\2\u0142@\3\2\2\2\u0143") 149 | buf.write("\u0144\7v\2\2\u0144\u0145\7k\2\2\u0145\u0146\7o\2\2\u0146") 150 | buf.write("\u0147\7g\2\2\u0147B\3\2\2\2\u0148\u0149\7e\2\2\u0149") 151 | buf.write("\u014a\7c\2\2\u014a\u014b\7n\2\2\u014b\u014c\7n\2\2\u014c") 152 | buf.write("\u014d\7\"\2\2\u014d\u014e\7g\2\2\u014e\u014f\7f\2\2\u014f") 153 | buf.write("\u0150\7w\2\2\u0150\u0151\7\60\2\2\u0151\u0152\7u\2\2") 154 | buf.write("\u0152\u0153\7v\2\2\u0153\u0154\7c\2\2\u0154\u0155\7p") 155 | buf.write("\2\2\u0155\u0156\7h\2\2\u0156\u0157\7q\2\2\u0157\u0158") 156 | buf.write("\7t\2\2\u0158\u0159\7f\2\2\u0159\u015a\7\60\2\2\u015a") 157 | buf.write("\u015b\7p\2\2\u015b\u015c\7n\2\2\u015c\u015d\7r\2\2\u015d") 158 | buf.write("\u015e\7\60\2\2\u015e\u015f\7u\2\2\u015f\u0160\7g\2\2") 159 | buf.write("\u0160\u0161\7o\2\2\u0161\u0162\7r\2\2\u0162\u0163\7t") 160 | buf.write("\2\2\u0163\u0164\7g\2\2\u0164\u0165\7\60\2\2\u0165\u0166") 161 | buf.write("\7q\2\2\u0166\u0167\7x\2\2\u0167\u0168\7g\2\2\u0168\u0169") 162 | buf.write("\7t\2\2\u0169\u016a\7p\2\2\u016a\u016b\7k\2\2\u016b\u016c") 163 | buf.write("\7i\2\2\u016c\u016d\7j\2\2\u016d\u016e\7v\2\2\u016e\u016f") 164 | buf.write("\7\60\2\2\u016f\u0170\7U\2\2\u0170\u0171\7k\2\2\u0171") 165 | buf.write("\u0172\7o\2\2\u0172\u0173\7r\2\2\u0173\u0174\7n\2\2\u0174") 166 | buf.write("\u0175\7g\2\2\u0175\u0176\7Y\2\2\u0176\u0177\7q\2\2\u0177") 167 | buf.write("\u0178\7t\2\2\u0178\u0179\7n\2\2\u0179\u017a\7f\2\2\u017a") 168 | buf.write("\u018a\7\60\2\2\u017b\u017c\7e\2\2\u017c\u017d\7c\2\2") 169 | buf.write("\u017d\u017e\7n\2\2\u017e\u017f\7n\2\2\u017f\u0180\7\"") 170 | buf.write("\2\2\u0180\u0181\7U\2\2\u0181\u0182\7Y\2\2\u0182\u018a") 171 | buf.write("\7\60\2\2\u0183\u0184\7e\2\2\u0184\u0185\7c\2\2\u0185") 172 | buf.write("\u0186\7n\2\2\u0186\u0187\7n\2\2\u0187\u0188\7\"\2\2\u0188") 173 | buf.write("\u018a\7\60\2\2\u0189\u0148\3\2\2\2\u0189\u017b\3\2\2") 174 | buf.write("\2\u0189\u0183\3\2\2\2\u018aD\3\2\2\2\u018b\u018c\7*\2") 175 | buf.write("\2\u018cF\3\2\2\2\u018d\u018e\7+\2\2\u018eH\3\2\2\2\u018f") 176 | buf.write("\u0190\7f\2\2\u0190\u0191\7c\2\2\u0191\u0192\7v\2\2\u0192") 177 | buf.write("\u0193\7g\2\2\u0193\u0194\7\"\2\2\u0194\u0195\3\2\2\2") 178 | buf.write("\u0195\u0196\5O(\2\u0196\u0197\7\"\2\2\u0197\u0198\5O") 179 | buf.write("(\2\u0198\u0199\7\"\2\2\u0199\u019a\5O(\2\u019aJ\3\2\2") 180 | buf.write("\2\u019b\u019c\7{\2\2\u019c\u019d\7g\2\2\u019d\u019e\7") 181 | buf.write("c\2\2\u019e\u019f\7t\2\2\u019f\u01a0\7\"\2\2\u01a0\u01a1") 182 | buf.write("\3\2\2\2\u01a1\u01a2\5O(\2\u01a2L\3\2\2\2\u01a3\u01a4") 183 | buf.write("\7v\2\2\u01a4\u01a5\7k\2\2\u01a5\u01a6\7o\2\2\u01a6\u01a7") 184 | buf.write("\7g\2\2\u01a7\u01a8\7\"\2\2\u01a8\u01a9\3\2\2\2\u01a9") 185 | buf.write("\u01aa\5O(\2\u01aa\u01ab\7\"\2\2\u01ab\u01ac\5O(\2\u01ac") 186 | buf.write("N\3\2\2\2\u01ad\u01af\7/\2\2\u01ae\u01ad\3\2\2\2\u01ae") 187 | buf.write("\u01af\3\2\2\2\u01af\u01b1\3\2\2\2\u01b0\u01b2\5S*\2\u01b1") 188 | buf.write("\u01b0\3\2\2\2\u01b2\u01b3\3\2\2\2\u01b3\u01b1\3\2\2\2") 189 | buf.write("\u01b3\u01b4\3\2\2\2\u01b4P\3\2\2\2\u01b5\u01b7\5U+\2") 190 | buf.write("\u01b6\u01b5\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8\u01b6\3") 191 | buf.write("\2\2\2\u01b8\u01b9\3\2\2\2\u01b9R\3\2\2\2\u01ba\u01bb") 192 | buf.write("\4\62;\2\u01bbT\3\2\2\2\u01bc\u01bd\t\2\2\2\u01bdV\3\2") 193 | buf.write("\2\2\u01be\u01c0\t\3\2\2\u01bf\u01be\3\2\2\2\u01c0\u01c1") 194 | buf.write("\3\2\2\2\u01c1\u01bf\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2") 195 | buf.write("\u01c3\3\2\2\2\u01c3\u01c4\b,\2\2\u01c4X\3\2\2\2\b\2\u0189") 196 | buf.write("\u01ae\u01b3\u01b8\u01c1\3\b\2\2") 197 | return buf.getvalue() 198 | 199 | 200 | class OvernightLexer(Lexer): 201 | 202 | atn = ATNDeserializer().deserialize(serializedATN()) 203 | 204 | decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] 205 | 206 | T__0 = 1 207 | T__1 = 2 208 | T__2 = 3 209 | T__3 = 4 210 | T__4 = 5 211 | T__5 = 6 212 | T__6 = 7 213 | T__7 = 8 214 | T__8 = 9 215 | T__9 = 10 216 | T__10 = 11 217 | T__11 = 12 218 | T__12 = 13 219 | T__13 = 14 220 | T__14 = 15 221 | T__15 = 16 222 | T__16 = 17 223 | T__17 = 18 224 | T__18 = 19 225 | T__19 = 20 226 | T__20 = 21 227 | T__21 = 22 228 | T__22 = 23 229 | T__23 = 24 230 | T__24 = 25 231 | T__25 = 26 232 | T__26 = 27 233 | T__27 = 28 234 | T__28 = 29 235 | T__29 = 30 236 | T__30 = 31 237 | T__31 = 32 238 | PREFIX = 33 239 | LB = 34 240 | RB = 35 241 | DATE = 36 242 | YEAR = 37 243 | TIME = 38 244 | INTEGER = 39 245 | STRING_LITERAL = 40 246 | WS = 41 247 | 248 | channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] 249 | 250 | modeNames = [ "DEFAULT_MODE" ] 251 | 252 | literalNames = [ "", 253 | "'en.'", "'.'", "'string'", "'number'", "'!'", "'type'", "'var'", 254 | "'lambda'", "'='", "'<'", "'>'", "'min'", "'max'", "'sum'", 255 | "'avg'", "'listValue'", "'size'", "'domain'", "'singleton'", 256 | "'filter'", "'getProperty'", "'superlative'", "'countSuperlative'", 257 | "'countComparative'", "'aggregate'", "'concat'", "'reverse'", 258 | "'ensureNumericProperty'", "'ensureNumericEntity'", "'date'", 259 | "'year'", "'time'", "'('", "')'" ] 260 | 261 | symbolicNames = [ "", 262 | "PREFIX", "LB", "RB", "DATE", "YEAR", "TIME", "INTEGER", "STRING_LITERAL", 263 | "WS" ] 264 | 265 | ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", 266 | "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13", 267 | "T__14", "T__15", "T__16", "T__17", "T__18", "T__19", 268 | "T__20", "T__21", "T__22", "T__23", "T__24", "T__25", 269 | "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", 270 | "PREFIX", "LB", "RB", "DATE", "YEAR", "TIME", "INTEGER", 271 | "STRING_LITERAL", "DIGIT", "CHAR", "WS" ] 272 | 273 | grammarFileName = "Overnight.g4" 274 | 275 | def __init__(self, input=None, output:TextIO = sys.stdout): 276 | super().__init__(input, output) 277 | self.checkVersion("4.9.2") 278 | self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) 279 | self._actions = None 280 | self._predicates = None 281 | 282 | 283 | --------------------------------------------------------------------------------