From 5d4edc826e67d1e2f6142c0de82ff810d3840b6f Mon Sep 17 00:00:00 2001 From: Brian Tu Date: Fri, 13 Dec 2024 15:50:40 -0500 Subject: [PATCH] [OPER-1484] Add ANTLR syntax for op selection on frontend (#26099) ## Summary & Motivation Similar to the new asset selection syntax, we want to add one for ops on the frontend. This PR just adds grammar, which is just a subset of the asset selection grammar, and the generated files from ANTLR. ## How I Tested These Changes N/A --- js_modules/dagster-ui/.gitattributes | 1 + .../dagster-ui/packages/ui-core/package.json | 1 + .../ui-core/src/op-selection/OpSelection.g4 | 63 + .../op-selection/generated/OpSelection.interp | 43 + .../op-selection/generated/OpSelection.tokens | 23 + .../generated/OpSelectionLexer.interp | 56 + .../generated/OpSelectionLexer.tokens | 23 + .../generated/OpSelectionLexer.ts | 170 +++ .../generated/OpSelectionListener.ts | 252 ++++ .../generated/OpSelectionParser.ts | 1115 +++++++++++++++++ .../generated/OpSelectionVisitor.ts | 171 +++ .../src/scripts/generateOpSelection.ts | 16 + 12 files changed, 1934 insertions(+) create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.interp create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.tokens create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.interp create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.tokens create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.ts create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionListener.ts create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionParser.ts create mode 100644 js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionVisitor.ts create mode 100644 js_modules/dagster-ui/packages/ui-core/src/scripts/generateOpSelection.ts diff --git a/js_modules/dagster-ui/.gitattributes b/js_modules/dagster-ui/.gitattributes index bf95c09ab463e..9428a42a1d54b 100644 --- a/js_modules/dagster-ui/.gitattributes +++ b/js_modules/dagster-ui/.gitattributes @@ -10,3 +10,4 @@ packages/ui-core/client.json linguist-generated=true packages/ui-core/src/asset-selection/generated/* linguist-generated=true packages/ui-core/src/selection/generated/* linguist-generated=true packages/ui-core/src/run-selection/generated/* linguist-generated=true +packages/ui-core/src/op-selection/generated/* linguist-generated=true diff --git a/js_modules/dagster-ui/packages/ui-core/package.json b/js_modules/dagster-ui/packages/ui-core/package.json index af7ba534148f7..ff98bbec75a34 100644 --- a/js_modules/dagster-ui/packages/ui-core/package.json +++ b/js_modules/dagster-ui/packages/ui-core/package.json @@ -17,6 +17,7 @@ "generate-asset-selection": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateAssetSelection.ts && eslint src/asset-selection/generated/ --fix -c .eslintrc.js", "generate-selection-autocomplete": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateSelection.ts && eslint src/selection/generated/ --fix -c .eslintrc.js", "generate-run-selection": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateRunSelection.ts && eslint src/run-selection/generated/ --fix -c .eslintrc.js", + "generate-op-selection": "ts-node -O '{\"module\": \"commonjs\"}' ./src/scripts/generateOpSelection.ts && eslint src/op-selection/generated/ --fix -c .eslintrc.js", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" }, diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 b/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 new file mode 100644 index 0000000000000..1edc8b2e04c85 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 @@ -0,0 +1,63 @@ +grammar OpSelection; + +start: expr EOF; + +// Root rule for parsing expressions +expr + : traversalAllowedExpr # TraversalAllowedExpression + | traversal traversalAllowedExpr traversal # UpAndDownTraversalExpression + | traversal traversalAllowedExpr # UpTraversalExpression + | traversalAllowedExpr traversal # DownTraversalExpression + | NOT expr # NotExpression + | expr AND expr # AndExpression + | expr OR expr # OrExpression + | STAR # AllExpression + ; + +// Allowed expressions for traversals +traversalAllowedExpr + : attributeExpr # AttributeExpression + | LPAREN expr RPAREN # ParenthesizedExpression + ; + +// Traversal operators +traversal + : STAR + | PLUS+ + ; + +// Attribute expressions for specific attributes +attributeExpr + : NAME COLON value # NameExpr + | NAME_SUBSTRING COLON value # NameSubstringExpr + ; + +// Value can be a quoted or unquoted string +value + : QUOTED_STRING + | UNQUOTED_STRING + ; + +// Tokens for operators and keywords +AND : 'and'; +OR : 'or'; +NOT : 'not'; + +STAR : '*'; +PLUS : '+'; + +COLON : ':'; + +LPAREN : '('; +RPAREN : ')'; + +// Tokens for attributes +NAME : 'name'; +NAME_SUBSTRING : 'name_substring'; + +// Tokens for strings +QUOTED_STRING : '"' (~["\\\r\n])* '"' ; +UNQUOTED_STRING : [a-zA-Z_][a-zA-Z0-9_]*; + +// Whitespace +WS : [ \t\r\n]+ -> skip ; \ No newline at end of file diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.interp b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.interp new file mode 100644 index 0000000000000..88357962b7070 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.interp @@ -0,0 +1,43 @@ +token literal names: +null +'and' +'or' +'not' +'*' +'+' +':' +'(' +')' +'name' +'name_substring' +null +null +null + +token symbolic names: +null +AND +OR +NOT +STAR +PLUS +COLON +LPAREN +RPAREN +NAME +NAME_SUBSTRING +QUOTED_STRING +UNQUOTED_STRING +WS + +rule names: +start +expr +traversalAllowedExpr +traversal +attributeExpr +value + + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 3, 15, 71, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 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, 5, 3, 33, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 3, 41, 10, 3, 12, 3, 14, 3, 44, 11, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 51, 10, 4, 3, 5, 3, 5, 6, 5, 55, 10, 5, 13, 5, 14, 5, 56, 5, 5, 59, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 67, 10, 6, 3, 7, 3, 7, 3, 7, 2, 2, 3, 4, 8, 2, 2, 4, 2, 6, 2, 8, 2, 10, 2, 12, 2, 2, 3, 3, 2, 13, 14, 2, 75, 2, 14, 3, 2, 2, 2, 4, 32, 3, 2, 2, 2, 6, 50, 3, 2, 2, 2, 8, 58, 3, 2, 2, 2, 10, 66, 3, 2, 2, 2, 12, 68, 3, 2, 2, 2, 14, 15, 5, 4, 3, 2, 15, 16, 7, 2, 2, 3, 16, 3, 3, 2, 2, 2, 17, 18, 8, 3, 1, 2, 18, 33, 5, 6, 4, 2, 19, 20, 5, 8, 5, 2, 20, 21, 5, 6, 4, 2, 21, 22, 5, 8, 5, 2, 22, 33, 3, 2, 2, 2, 23, 24, 5, 8, 5, 2, 24, 25, 5, 6, 4, 2, 25, 33, 3, 2, 2, 2, 26, 27, 5, 6, 4, 2, 27, 28, 5, 8, 5, 2, 28, 33, 3, 2, 2, 2, 29, 30, 7, 5, 2, 2, 30, 33, 5, 4, 3, 6, 31, 33, 7, 6, 2, 2, 32, 17, 3, 2, 2, 2, 32, 19, 3, 2, 2, 2, 32, 23, 3, 2, 2, 2, 32, 26, 3, 2, 2, 2, 32, 29, 3, 2, 2, 2, 32, 31, 3, 2, 2, 2, 33, 42, 3, 2, 2, 2, 34, 35, 12, 5, 2, 2, 35, 36, 7, 3, 2, 2, 36, 41, 5, 4, 3, 6, 37, 38, 12, 4, 2, 2, 38, 39, 7, 4, 2, 2, 39, 41, 5, 4, 3, 5, 40, 34, 3, 2, 2, 2, 40, 37, 3, 2, 2, 2, 41, 44, 3, 2, 2, 2, 42, 40, 3, 2, 2, 2, 42, 43, 3, 2, 2, 2, 43, 5, 3, 2, 2, 2, 44, 42, 3, 2, 2, 2, 45, 51, 5, 10, 6, 2, 46, 47, 7, 9, 2, 2, 47, 48, 5, 4, 3, 2, 48, 49, 7, 10, 2, 2, 49, 51, 3, 2, 2, 2, 50, 45, 3, 2, 2, 2, 50, 46, 3, 2, 2, 2, 51, 7, 3, 2, 2, 2, 52, 59, 7, 6, 2, 2, 53, 55, 7, 7, 2, 2, 54, 53, 3, 2, 2, 2, 55, 56, 3, 2, 2, 2, 56, 54, 3, 2, 2, 2, 56, 57, 3, 2, 2, 2, 57, 59, 3, 2, 2, 2, 58, 52, 3, 2, 2, 2, 58, 54, 3, 2, 2, 2, 59, 9, 3, 2, 2, 2, 60, 61, 7, 11, 2, 2, 61, 62, 7, 8, 2, 2, 62, 67, 5, 12, 7, 2, 63, 64, 7, 12, 2, 2, 64, 65, 7, 8, 2, 2, 65, 67, 5, 12, 7, 2, 66, 60, 3, 2, 2, 2, 66, 63, 3, 2, 2, 2, 67, 11, 3, 2, 2, 2, 68, 69, 9, 2, 2, 2, 69, 13, 3, 2, 2, 2, 9, 32, 40, 42, 50, 56, 58, 66] \ No newline at end of file diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.tokens b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.tokens new file mode 100644 index 0000000000000..34097166bd470 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelection.tokens @@ -0,0 +1,23 @@ +AND=1 +OR=2 +NOT=3 +STAR=4 +PLUS=5 +COLON=6 +LPAREN=7 +RPAREN=8 +NAME=9 +NAME_SUBSTRING=10 +QUOTED_STRING=11 +UNQUOTED_STRING=12 +WS=13 +'and'=1 +'or'=2 +'not'=3 +'*'=4 +'+'=5 +':'=6 +'('=7 +')'=8 +'name'=9 +'name_substring'=10 diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.interp b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.interp new file mode 100644 index 0000000000000..8828f9b625b8b --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.interp @@ -0,0 +1,56 @@ +token literal names: +null +'and' +'or' +'not' +'*' +'+' +':' +'(' +')' +'name' +'name_substring' +null +null +null + +token symbolic names: +null +AND +OR +NOT +STAR +PLUS +COLON +LPAREN +RPAREN +NAME +NAME_SUBSTRING +QUOTED_STRING +UNQUOTED_STRING +WS + +rule names: +AND +OR +NOT +STAR +PLUS +COLON +LPAREN +RPAREN +NAME +NAME_SUBSTRING +QUOTED_STRING +UNQUOTED_STRING +WS + +channel names: +DEFAULT_TOKEN_CHANNEL +HIDDEN + +mode names: +DEFAULT_MODE + +atn: +[3, 51485, 51898, 1421, 44986, 20307, 1543, 60043, 49729, 2, 15, 93, 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, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 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, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 7, 12, 73, 10, 12, 12, 12, 14, 12, 76, 11, 12, 3, 12, 3, 12, 3, 13, 3, 13, 7, 13, 82, 10, 13, 12, 13, 14, 13, 85, 11, 13, 3, 14, 6, 14, 88, 10, 14, 13, 14, 14, 14, 89, 3, 14, 3, 14, 2, 2, 2, 15, 3, 2, 3, 5, 2, 4, 7, 2, 5, 9, 2, 6, 11, 2, 7, 13, 2, 8, 15, 2, 9, 17, 2, 10, 19, 2, 11, 21, 2, 12, 23, 2, 13, 25, 2, 14, 27, 2, 15, 3, 2, 6, 6, 2, 12, 12, 15, 15, 36, 36, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 6, 2, 50, 59, 67, 92, 97, 97, 99, 124, 5, 2, 11, 12, 15, 15, 34, 34, 2, 95, 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, 3, 29, 3, 2, 2, 2, 5, 33, 3, 2, 2, 2, 7, 36, 3, 2, 2, 2, 9, 40, 3, 2, 2, 2, 11, 42, 3, 2, 2, 2, 13, 44, 3, 2, 2, 2, 15, 46, 3, 2, 2, 2, 17, 48, 3, 2, 2, 2, 19, 50, 3, 2, 2, 2, 21, 55, 3, 2, 2, 2, 23, 70, 3, 2, 2, 2, 25, 79, 3, 2, 2, 2, 27, 87, 3, 2, 2, 2, 29, 30, 7, 99, 2, 2, 30, 31, 7, 112, 2, 2, 31, 32, 7, 102, 2, 2, 32, 4, 3, 2, 2, 2, 33, 34, 7, 113, 2, 2, 34, 35, 7, 116, 2, 2, 35, 6, 3, 2, 2, 2, 36, 37, 7, 112, 2, 2, 37, 38, 7, 113, 2, 2, 38, 39, 7, 118, 2, 2, 39, 8, 3, 2, 2, 2, 40, 41, 7, 44, 2, 2, 41, 10, 3, 2, 2, 2, 42, 43, 7, 45, 2, 2, 43, 12, 3, 2, 2, 2, 44, 45, 7, 60, 2, 2, 45, 14, 3, 2, 2, 2, 46, 47, 7, 42, 2, 2, 47, 16, 3, 2, 2, 2, 48, 49, 7, 43, 2, 2, 49, 18, 3, 2, 2, 2, 50, 51, 7, 112, 2, 2, 51, 52, 7, 99, 2, 2, 52, 53, 7, 111, 2, 2, 53, 54, 7, 103, 2, 2, 54, 20, 3, 2, 2, 2, 55, 56, 7, 112, 2, 2, 56, 57, 7, 99, 2, 2, 57, 58, 7, 111, 2, 2, 58, 59, 7, 103, 2, 2, 59, 60, 7, 97, 2, 2, 60, 61, 7, 117, 2, 2, 61, 62, 7, 119, 2, 2, 62, 63, 7, 100, 2, 2, 63, 64, 7, 117, 2, 2, 64, 65, 7, 118, 2, 2, 65, 66, 7, 116, 2, 2, 66, 67, 7, 107, 2, 2, 67, 68, 7, 112, 2, 2, 68, 69, 7, 105, 2, 2, 69, 22, 3, 2, 2, 2, 70, 74, 7, 36, 2, 2, 71, 73, 10, 2, 2, 2, 72, 71, 3, 2, 2, 2, 73, 76, 3, 2, 2, 2, 74, 72, 3, 2, 2, 2, 74, 75, 3, 2, 2, 2, 75, 77, 3, 2, 2, 2, 76, 74, 3, 2, 2, 2, 77, 78, 7, 36, 2, 2, 78, 24, 3, 2, 2, 2, 79, 83, 9, 3, 2, 2, 80, 82, 9, 4, 2, 2, 81, 80, 3, 2, 2, 2, 82, 85, 3, 2, 2, 2, 83, 81, 3, 2, 2, 2, 83, 84, 3, 2, 2, 2, 84, 26, 3, 2, 2, 2, 85, 83, 3, 2, 2, 2, 86, 88, 9, 5, 2, 2, 87, 86, 3, 2, 2, 2, 88, 89, 3, 2, 2, 2, 89, 87, 3, 2, 2, 2, 89, 90, 3, 2, 2, 2, 90, 91, 3, 2, 2, 2, 91, 92, 8, 14, 2, 2, 92, 28, 3, 2, 2, 2, 6, 2, 74, 83, 89, 3, 8, 2, 2] \ No newline at end of file diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.tokens b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.tokens new file mode 100644 index 0000000000000..34097166bd470 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.tokens @@ -0,0 +1,23 @@ +AND=1 +OR=2 +NOT=3 +STAR=4 +PLUS=5 +COLON=6 +LPAREN=7 +RPAREN=8 +NAME=9 +NAME_SUBSTRING=10 +QUOTED_STRING=11 +UNQUOTED_STRING=12 +WS=13 +'and'=1 +'or'=2 +'not'=3 +'*'=4 +'+'=5 +':'=6 +'('=7 +')'=8 +'name'=9 +'name_substring'=10 diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.ts b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.ts new file mode 100644 index 0000000000000..3a01b871699a8 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionLexer.ts @@ -0,0 +1,170 @@ +// Generated from /Users/briantu/repos/dagster/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 by ANTLR 4.9.0-SNAPSHOT + +import {CharStream} from 'antlr4ts/CharStream'; +import {Lexer} from 'antlr4ts/Lexer'; +import {Vocabulary} from 'antlr4ts/Vocabulary'; +import {VocabularyImpl} from 'antlr4ts/VocabularyImpl'; +import {ATN} from 'antlr4ts/atn/ATN'; +import {ATNDeserializer} from 'antlr4ts/atn/ATNDeserializer'; +import {LexerATNSimulator} from 'antlr4ts/atn/LexerATNSimulator'; +import * as Utils from 'antlr4ts/misc/Utils'; + +export class OpSelectionLexer extends Lexer { + public static readonly AND = 1; + public static readonly OR = 2; + public static readonly NOT = 3; + public static readonly STAR = 4; + public static readonly PLUS = 5; + public static readonly COLON = 6; + public static readonly LPAREN = 7; + public static readonly RPAREN = 8; + public static readonly NAME = 9; + public static readonly NAME_SUBSTRING = 10; + public static readonly QUOTED_STRING = 11; + public static readonly UNQUOTED_STRING = 12; + public static readonly WS = 13; + + // tslint:disable:no-trailing-whitespace + public static readonly channelNames: string[] = ['DEFAULT_TOKEN_CHANNEL', 'HIDDEN']; + + // tslint:disable:no-trailing-whitespace + public static readonly modeNames: string[] = ['DEFAULT_MODE']; + + public static readonly ruleNames: string[] = [ + 'AND', + 'OR', + 'NOT', + 'STAR', + 'PLUS', + 'COLON', + 'LPAREN', + 'RPAREN', + 'NAME', + 'NAME_SUBSTRING', + 'QUOTED_STRING', + 'UNQUOTED_STRING', + 'WS', + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, + "'and'", + "'or'", + "'not'", + "'*'", + "'+'", + "':'", + "'('", + "')'", + "'name'", + "'name_substring'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, + 'AND', + 'OR', + 'NOT', + 'STAR', + 'PLUS', + 'COLON', + 'LPAREN', + 'RPAREN', + 'NAME', + 'NAME_SUBSTRING', + 'QUOTED_STRING', + 'UNQUOTED_STRING', + 'WS', + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl( + OpSelectionLexer._LITERAL_NAMES, + OpSelectionLexer._SYMBOLIC_NAMES, + [], + ); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return OpSelectionLexer.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + constructor(input: CharStream) { + super(input); + this._interp = new LexerATNSimulator(OpSelectionLexer._ATN, this); + } + + // @Override + public get grammarFileName(): string { + return 'OpSelection.g4'; + } + + // @Override + public get ruleNames(): string[] { + return OpSelectionLexer.ruleNames; + } + + // @Override + public get serializedATN(): string { + return OpSelectionLexer._serializedATN; + } + + // @Override + public get channelNames(): string[] { + return OpSelectionLexer.channelNames; + } + + // @Override + public get modeNames(): string[] { + return OpSelectionLexer.modeNames; + } + + public static readonly _serializedATN: string = + '\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x02\x0F]\b\x01\x04' + + '\x02\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04' + + '\x07\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r' + + '\x04\x0E\t\x0E\x03\x02\x03\x02\x03\x02\x03\x02\x03\x03\x03\x03\x03\x03' + + '\x03\x04\x03\x04\x03\x04\x03\x04\x03\x05\x03\x05\x03\x06\x03\x06\x03\x07' + + '\x03\x07\x03\b\x03\b\x03\t\x03\t\x03\n\x03\n\x03\n\x03\n\x03\n\x03\v\x03' + + '\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03\v\x03' + + '\v\x03\v\x03\f\x03\f\x07\fI\n\f\f\f\x0E\fL\v\f\x03\f\x03\f\x03\r\x03\r' + + '\x07\rR\n\r\f\r\x0E\rU\v\r\x03\x0E\x06\x0EX\n\x0E\r\x0E\x0E\x0EY\x03\x0E' + + '\x03\x0E\x02\x02\x02\x0F\x03\x02\x03\x05\x02\x04\x07\x02\x05\t\x02\x06' + + '\v\x02\x07\r\x02\b\x0F\x02\t\x11\x02\n\x13\x02\v\x15\x02\f\x17\x02\r\x19' + + '\x02\x0E\x1B\x02\x0F\x03\x02\x06\x06\x02\f\f\x0F\x0F$$^^\x05\x02C\\aa' + + 'c|\x06\x022;C\\aac|\x05\x02\v\f\x0F\x0F""\x02_\x02\x03\x03\x02\x02\x02' + + '\x02\x05\x03\x02\x02\x02\x02\x07\x03\x02\x02\x02\x02\t\x03\x02\x02\x02' + + '\x02\v\x03\x02\x02\x02\x02\r\x03\x02\x02\x02\x02\x0F\x03\x02\x02\x02\x02' + + '\x11\x03\x02\x02\x02\x02\x13\x03\x02\x02\x02\x02\x15\x03\x02\x02\x02\x02' + + '\x17\x03\x02\x02\x02\x02\x19\x03\x02\x02\x02\x02\x1B\x03\x02\x02\x02\x03' + + '\x1D\x03\x02\x02\x02\x05!\x03\x02\x02\x02\x07$\x03\x02\x02\x02\t(\x03' + + '\x02\x02\x02\v*\x03\x02\x02\x02\r,\x03\x02\x02\x02\x0F.\x03\x02\x02\x02' + + '\x110\x03\x02\x02\x02\x132\x03\x02\x02\x02\x157\x03\x02\x02\x02\x17F\x03' + + '\x02\x02\x02\x19O\x03\x02\x02\x02\x1BW\x03\x02\x02\x02\x1D\x1E\x07c\x02' + + '\x02\x1E\x1F\x07p\x02\x02\x1F \x07f\x02\x02 \x04\x03\x02\x02\x02!"\x07' + + 'q\x02\x02"#\x07t\x02\x02#\x06\x03\x02\x02\x02$%\x07p\x02\x02%&\x07q\x02' + + "\x02&'\x07v\x02\x02'\b\x03\x02\x02\x02()\x07,\x02\x02)\n\x03\x02\x02" + + '\x02*+\x07-\x02\x02+\f\x03\x02\x02\x02,-\x07<\x02\x02-\x0E\x03\x02\x02' + + '\x02./\x07*\x02\x02/\x10\x03\x02\x02\x0201\x07+\x02\x021\x12\x03\x02\x02' + + '\x0223\x07p\x02\x0234\x07c\x02\x0245\x07o\x02\x0256\x07g\x02\x026\x14' + + '\x03\x02\x02\x0278\x07p\x02\x0289\x07c\x02\x029:\x07o\x02\x02:;\x07g\x02' + + '\x02;<\x07a\x02\x02<=\x07u\x02\x02=>\x07w\x02\x02>?\x07d\x02\x02?@\x07' + + 'u\x02\x02@A\x07v\x02\x02AB\x07t\x02\x02BC\x07k\x02\x02CD\x07p\x02\x02' + + 'DE\x07i\x02\x02E\x16\x03\x02\x02\x02FJ\x07$\x02\x02GI\n\x02\x02\x02HG' + + '\x03\x02\x02\x02IL\x03\x02\x02\x02JH\x03\x02\x02\x02JK\x03\x02\x02\x02' + + 'KM\x03\x02\x02\x02LJ\x03\x02\x02\x02MN\x07$\x02\x02N\x18\x03\x02\x02\x02' + + 'OS\t\x03\x02\x02PR\t\x04\x02\x02QP\x03\x02\x02\x02RU\x03\x02\x02\x02S' + + 'Q\x03\x02\x02\x02ST\x03\x02\x02\x02T\x1A\x03\x02\x02\x02US\x03\x02\x02' + + '\x02VX\t\x05\x02\x02WV\x03\x02\x02\x02XY\x03\x02\x02\x02YW\x03\x02\x02' + + '\x02YZ\x03\x02\x02\x02Z[\x03\x02\x02\x02[\\\b\x0E\x02\x02\\\x1C\x03\x02' + + '\x02\x02\x06\x02JSY\x03\b\x02\x02'; + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!OpSelectionLexer.__ATN) { + OpSelectionLexer.__ATN = new ATNDeserializer().deserialize( + Utils.toCharArray(OpSelectionLexer._serializedATN), + ); + } + + return OpSelectionLexer.__ATN; + } +} diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionListener.ts b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionListener.ts new file mode 100644 index 0000000000000..5c13bdbb60747 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionListener.ts @@ -0,0 +1,252 @@ +// Generated from /Users/briantu/repos/dagster/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 by ANTLR 4.9.0-SNAPSHOT + +import {ParseTreeListener} from 'antlr4ts/tree/ParseTreeListener'; + +import { + AllExpressionContext, + AndExpressionContext, + AttributeExprContext, + AttributeExpressionContext, + DownTraversalExpressionContext, + ExprContext, + NameExprContext, + NameSubstringExprContext, + NotExpressionContext, + OrExpressionContext, + ParenthesizedExpressionContext, + StartContext, + TraversalAllowedExprContext, + TraversalAllowedExpressionContext, + TraversalContext, + UpAndDownTraversalExpressionContext, + UpTraversalExpressionContext, + ValueContext, +} from './OpSelectionParser'; + +/** + * This interface defines a complete listener for a parse tree produced by + * `OpSelectionParser`. + */ +export interface OpSelectionListener extends ParseTreeListener { + /** + * Enter a parse tree produced by the `TraversalAllowedExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterTraversalAllowedExpression?: (ctx: TraversalAllowedExpressionContext) => void; + /** + * Exit a parse tree produced by the `TraversalAllowedExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitTraversalAllowedExpression?: (ctx: TraversalAllowedExpressionContext) => void; + + /** + * Enter a parse tree produced by the `UpAndDownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterUpAndDownTraversalExpression?: (ctx: UpAndDownTraversalExpressionContext) => void; + /** + * Exit a parse tree produced by the `UpAndDownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitUpAndDownTraversalExpression?: (ctx: UpAndDownTraversalExpressionContext) => void; + + /** + * Enter a parse tree produced by the `UpTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterUpTraversalExpression?: (ctx: UpTraversalExpressionContext) => void; + /** + * Exit a parse tree produced by the `UpTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitUpTraversalExpression?: (ctx: UpTraversalExpressionContext) => void; + + /** + * Enter a parse tree produced by the `DownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterDownTraversalExpression?: (ctx: DownTraversalExpressionContext) => void; + /** + * Exit a parse tree produced by the `DownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitDownTraversalExpression?: (ctx: DownTraversalExpressionContext) => void; + + /** + * Enter a parse tree produced by the `NotExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterNotExpression?: (ctx: NotExpressionContext) => void; + /** + * Exit a parse tree produced by the `NotExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitNotExpression?: (ctx: NotExpressionContext) => void; + + /** + * Enter a parse tree produced by the `AndExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterAndExpression?: (ctx: AndExpressionContext) => void; + /** + * Exit a parse tree produced by the `AndExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitAndExpression?: (ctx: AndExpressionContext) => void; + + /** + * Enter a parse tree produced by the `OrExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterOrExpression?: (ctx: OrExpressionContext) => void; + /** + * Exit a parse tree produced by the `OrExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitOrExpression?: (ctx: OrExpressionContext) => void; + + /** + * Enter a parse tree produced by the `AllExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterAllExpression?: (ctx: AllExpressionContext) => void; + /** + * Exit a parse tree produced by the `AllExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitAllExpression?: (ctx: AllExpressionContext) => void; + + /** + * Enter a parse tree produced by the `NameExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + enterNameExpr?: (ctx: NameExprContext) => void; + /** + * Exit a parse tree produced by the `NameExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + exitNameExpr?: (ctx: NameExprContext) => void; + + /** + * Enter a parse tree produced by the `NameSubstringExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + enterNameSubstringExpr?: (ctx: NameSubstringExprContext) => void; + /** + * Exit a parse tree produced by the `NameSubstringExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + exitNameSubstringExpr?: (ctx: NameSubstringExprContext) => void; + + /** + * Enter a parse tree produced by the `AttributeExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + enterAttributeExpression?: (ctx: AttributeExpressionContext) => void; + /** + * Exit a parse tree produced by the `AttributeExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + exitAttributeExpression?: (ctx: AttributeExpressionContext) => void; + + /** + * Enter a parse tree produced by the `ParenthesizedExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + enterParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void; + /** + * Exit a parse tree produced by the `ParenthesizedExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + exitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.start`. + * @param ctx the parse tree + */ + enterStart?: (ctx: StartContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.start`. + * @param ctx the parse tree + */ + exitStart?: (ctx: StartContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + enterExpr?: (ctx: ExprContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.expr`. + * @param ctx the parse tree + */ + exitExpr?: (ctx: ExprContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + enterTraversalAllowedExpr?: (ctx: TraversalAllowedExprContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + */ + exitTraversalAllowedExpr?: (ctx: TraversalAllowedExprContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.traversal`. + * @param ctx the parse tree + */ + enterTraversal?: (ctx: TraversalContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.traversal`. + * @param ctx the parse tree + */ + exitTraversal?: (ctx: TraversalContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + enterAttributeExpr?: (ctx: AttributeExprContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + */ + exitAttributeExpr?: (ctx: AttributeExprContext) => void; + + /** + * Enter a parse tree produced by `OpSelectionParser.value`. + * @param ctx the parse tree + */ + enterValue?: (ctx: ValueContext) => void; + /** + * Exit a parse tree produced by `OpSelectionParser.value`. + * @param ctx the parse tree + */ + exitValue?: (ctx: ValueContext) => void; +} diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionParser.ts b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionParser.ts new file mode 100644 index 0000000000000..a9c1c99063b14 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionParser.ts @@ -0,0 +1,1115 @@ +// Generated from /Users/briantu/repos/dagster/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 by ANTLR 4.9.0-SNAPSHOT + +import {FailedPredicateException} from 'antlr4ts/FailedPredicateException'; +import {NoViableAltException} from 'antlr4ts/NoViableAltException'; +import {Parser} from 'antlr4ts/Parser'; +import {ParserRuleContext} from 'antlr4ts/ParserRuleContext'; +import {RecognitionException} from 'antlr4ts/RecognitionException'; +import {RuleContext} from 'antlr4ts/RuleContext'; +//import { RuleVersion } from "antlr4ts/RuleVersion"; +import {Token} from 'antlr4ts/Token'; +import {TokenStream} from 'antlr4ts/TokenStream'; +import {Vocabulary} from 'antlr4ts/Vocabulary'; +import {VocabularyImpl} from 'antlr4ts/VocabularyImpl'; +import {ATN} from 'antlr4ts/atn/ATN'; +import {ATNDeserializer} from 'antlr4ts/atn/ATNDeserializer'; +import {ParserATNSimulator} from 'antlr4ts/atn/ParserATNSimulator'; +import * as Utils from 'antlr4ts/misc/Utils'; +import {TerminalNode} from 'antlr4ts/tree/TerminalNode'; + +import {OpSelectionListener} from './OpSelectionListener'; +import {OpSelectionVisitor} from './OpSelectionVisitor'; + +export class OpSelectionParser extends Parser { + public static readonly AND = 1; + public static readonly OR = 2; + public static readonly NOT = 3; + public static readonly STAR = 4; + public static readonly PLUS = 5; + public static readonly COLON = 6; + public static readonly LPAREN = 7; + public static readonly RPAREN = 8; + public static readonly NAME = 9; + public static readonly NAME_SUBSTRING = 10; + public static readonly QUOTED_STRING = 11; + public static readonly UNQUOTED_STRING = 12; + public static readonly WS = 13; + public static readonly RULE_start = 0; + public static readonly RULE_expr = 1; + public static readonly RULE_traversalAllowedExpr = 2; + public static readonly RULE_traversal = 3; + public static readonly RULE_attributeExpr = 4; + public static readonly RULE_value = 5; + // tslint:disable:no-trailing-whitespace + public static readonly ruleNames: string[] = [ + 'start', + 'expr', + 'traversalAllowedExpr', + 'traversal', + 'attributeExpr', + 'value', + ]; + + private static readonly _LITERAL_NAMES: Array = [ + undefined, + "'and'", + "'or'", + "'not'", + "'*'", + "'+'", + "':'", + "'('", + "')'", + "'name'", + "'name_substring'", + ]; + private static readonly _SYMBOLIC_NAMES: Array = [ + undefined, + 'AND', + 'OR', + 'NOT', + 'STAR', + 'PLUS', + 'COLON', + 'LPAREN', + 'RPAREN', + 'NAME', + 'NAME_SUBSTRING', + 'QUOTED_STRING', + 'UNQUOTED_STRING', + 'WS', + ]; + public static readonly VOCABULARY: Vocabulary = new VocabularyImpl( + OpSelectionParser._LITERAL_NAMES, + OpSelectionParser._SYMBOLIC_NAMES, + [], + ); + + // @Override + // @NotNull + public get vocabulary(): Vocabulary { + return OpSelectionParser.VOCABULARY; + } + // tslint:enable:no-trailing-whitespace + + // @Override + public get grammarFileName(): string { + return 'OpSelection.g4'; + } + + // @Override + public get ruleNames(): string[] { + return OpSelectionParser.ruleNames; + } + + // @Override + public get serializedATN(): string { + return OpSelectionParser._serializedATN; + } + + protected createFailedPredicateException( + predicate?: string, + message?: string, + ): FailedPredicateException { + return new FailedPredicateException(this, predicate, message); + } + + constructor(input: TokenStream) { + super(input); + this._interp = new ParserATNSimulator(OpSelectionParser._ATN, this); + } + // @RuleVersion(0) + public start(): StartContext { + const _localctx: StartContext = new StartContext(this._ctx, this.state); + this.enterRule(_localctx, 0, OpSelectionParser.RULE_start); + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 12; + this.expr(0); + this.state = 13; + this.match(OpSelectionParser.EOF); + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return _localctx; + } + + public expr(): ExprContext; + public expr(_p: number): ExprContext; + // @RuleVersion(0) + public expr(_p?: number): ExprContext { + if (_p === undefined) { + _p = 0; + } + + const _parentctx: ParserRuleContext = this._ctx; + const _parentState: number = this.state; + let _localctx: ExprContext = new ExprContext(this._ctx, _parentState); + let _prevctx: ExprContext = _localctx; + const _startState: number = 2; + this.enterRecursionRule(_localctx, 2, OpSelectionParser.RULE_expr, _p); + try { + let _alt: number; + this.enterOuterAlt(_localctx, 1); + { + this.state = 30; + this._errHandler.sync(this); + switch (this.interpreter.adaptivePredict(this._input, 0, this._ctx)) { + case 1: + { + _localctx = new TraversalAllowedExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + + this.state = 16; + this.traversalAllowedExpr(); + } + break; + + case 2: + { + _localctx = new UpAndDownTraversalExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 17; + this.traversal(); + this.state = 18; + this.traversalAllowedExpr(); + this.state = 19; + this.traversal(); + } + break; + + case 3: + { + _localctx = new UpTraversalExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 21; + this.traversal(); + this.state = 22; + this.traversalAllowedExpr(); + } + break; + + case 4: + { + _localctx = new DownTraversalExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 24; + this.traversalAllowedExpr(); + this.state = 25; + this.traversal(); + } + break; + + case 5: + { + _localctx = new NotExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 27; + this.match(OpSelectionParser.NOT); + this.state = 28; + this.expr(4); + } + break; + + case 6: + { + _localctx = new AllExpressionContext(_localctx); + this._ctx = _localctx; + _prevctx = _localctx; + this.state = 29; + this.match(OpSelectionParser.STAR); + } + break; + } + this._ctx._stop = this._input.tryLT(-1); + this.state = 40; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx); + while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER) { + if (_alt === 1) { + if (this._parseListeners != null) { + this.triggerExitRuleEvent(); + } + _prevctx = _localctx; + { + this.state = 38; + this._errHandler.sync(this); + switch (this.interpreter.adaptivePredict(this._input, 1, this._ctx)) { + case 1: + { + _localctx = new AndExpressionContext(new ExprContext(_parentctx, _parentState)); + this.pushNewRecursionContext( + _localctx, + _startState, + OpSelectionParser.RULE_expr, + ); + this.state = 32; + if (!this.precpred(this._ctx, 3)) { + throw this.createFailedPredicateException('this.precpred(this._ctx, 3)'); + } + this.state = 33; + this.match(OpSelectionParser.AND); + this.state = 34; + this.expr(4); + } + break; + + case 2: + { + _localctx = new OrExpressionContext(new ExprContext(_parentctx, _parentState)); + this.pushNewRecursionContext( + _localctx, + _startState, + OpSelectionParser.RULE_expr, + ); + this.state = 35; + if (!this.precpred(this._ctx, 2)) { + throw this.createFailedPredicateException('this.precpred(this._ctx, 2)'); + } + this.state = 36; + this.match(OpSelectionParser.OR); + this.state = 37; + this.expr(3); + } + break; + } + } + } + this.state = 42; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 2, this._ctx); + } + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.unrollRecursionContexts(_parentctx); + } + return _localctx; + } + // @RuleVersion(0) + public traversalAllowedExpr(): TraversalAllowedExprContext { + let _localctx: TraversalAllowedExprContext = new TraversalAllowedExprContext( + this._ctx, + this.state, + ); + this.enterRule(_localctx, 4, OpSelectionParser.RULE_traversalAllowedExpr); + try { + this.state = 48; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case OpSelectionParser.NAME: + case OpSelectionParser.NAME_SUBSTRING: + _localctx = new AttributeExpressionContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 43; + this.attributeExpr(); + } + break; + case OpSelectionParser.LPAREN: + _localctx = new ParenthesizedExpressionContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 44; + this.match(OpSelectionParser.LPAREN); + this.state = 45; + this.expr(0); + this.state = 46; + this.match(OpSelectionParser.RPAREN); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public traversal(): TraversalContext { + const _localctx: TraversalContext = new TraversalContext(this._ctx, this.state); + this.enterRule(_localctx, 6, OpSelectionParser.RULE_traversal); + try { + let _alt: number; + this.state = 56; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case OpSelectionParser.STAR: + this.enterOuterAlt(_localctx, 1); + { + this.state = 50; + this.match(OpSelectionParser.STAR); + } + break; + case OpSelectionParser.PLUS: + this.enterOuterAlt(_localctx, 2); + { + this.state = 52; + this._errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + this.state = 51; + this.match(OpSelectionParser.PLUS); + } + } + break; + default: + throw new NoViableAltException(this); + } + this.state = 54; + this._errHandler.sync(this); + _alt = this.interpreter.adaptivePredict(this._input, 4, this._ctx); + } while (_alt !== 2 && _alt !== ATN.INVALID_ALT_NUMBER); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public attributeExpr(): AttributeExprContext { + let _localctx: AttributeExprContext = new AttributeExprContext(this._ctx, this.state); + this.enterRule(_localctx, 8, OpSelectionParser.RULE_attributeExpr); + try { + this.state = 64; + this._errHandler.sync(this); + switch (this._input.LA(1)) { + case OpSelectionParser.NAME: + _localctx = new NameExprContext(_localctx); + this.enterOuterAlt(_localctx, 1); + { + this.state = 58; + this.match(OpSelectionParser.NAME); + this.state = 59; + this.match(OpSelectionParser.COLON); + this.state = 60; + this.value(); + } + break; + case OpSelectionParser.NAME_SUBSTRING: + _localctx = new NameSubstringExprContext(_localctx); + this.enterOuterAlt(_localctx, 2); + { + this.state = 61; + this.match(OpSelectionParser.NAME_SUBSTRING); + this.state = 62; + this.match(OpSelectionParser.COLON); + this.state = 63; + this.value(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return _localctx; + } + // @RuleVersion(0) + public value(): ValueContext { + const _localctx: ValueContext = new ValueContext(this._ctx, this.state); + this.enterRule(_localctx, 10, OpSelectionParser.RULE_value); + let _la: number; + try { + this.enterOuterAlt(_localctx, 1); + { + this.state = 66; + _la = this._input.LA(1); + if ( + !(_la === OpSelectionParser.QUOTED_STRING || _la === OpSelectionParser.UNQUOTED_STRING) + ) { + this._errHandler.recoverInline(this); + } else { + if (this._input.LA(1) === Token.EOF) { + this.matchedEOF = true; + } + + this._errHandler.reportMatch(this); + this.consume(); + } + } + } catch (re) { + if (re instanceof RecognitionException) { + _localctx.exception = re; + this._errHandler.reportError(this, re); + this._errHandler.recover(this, re); + } else { + throw re; + } + } finally { + this.exitRule(); + } + return _localctx; + } + + public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean { + switch (ruleIndex) { + case 1: + return this.expr_sempred(_localctx as ExprContext, predIndex); + } + return true; + } + private expr_sempred(_localctx: ExprContext, predIndex: number): boolean { + switch (predIndex) { + case 0: + return this.precpred(this._ctx, 3); + + case 1: + return this.precpred(this._ctx, 2); + } + return true; + } + + public static readonly _serializedATN: string = + '\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x0FG\x04\x02' + + '\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07' + + '\t\x07\x03\x02\x03\x02\x03\x02\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' + + '\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' + + '\x03\x03\x05\x03!\n\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03' + + '\x07\x03)\n\x03\f\x03\x0E\x03,\v\x03\x03\x04\x03\x04\x03\x04\x03\x04\x03' + + '\x04\x05\x043\n\x04\x03\x05\x03\x05\x06\x057\n\x05\r\x05\x0E\x058\x05' + + '\x05;\n\x05\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x03\x06\x05\x06C\n' + + '\x06\x03\x07\x03\x07\x03\x07\x02\x02\x03\x04\b\x02\x02\x04\x02\x06\x02' + + '\b\x02\n\x02\f\x02\x02\x03\x03\x02\r\x0E\x02K\x02\x0E\x03\x02\x02\x02' + + '\x04 \x03\x02\x02\x02\x062\x03\x02\x02\x02\b:\x03\x02\x02\x02\nB\x03\x02' + + '\x02\x02\fD\x03\x02\x02\x02\x0E\x0F\x05\x04\x03\x02\x0F\x10\x07\x02\x02' + + '\x03\x10\x03\x03\x02\x02\x02\x11\x12\b\x03\x01\x02\x12!\x05\x06\x04\x02' + + '\x13\x14\x05\b\x05\x02\x14\x15\x05\x06\x04\x02\x15\x16\x05\b\x05\x02\x16' + + '!\x03\x02\x02\x02\x17\x18\x05\b\x05\x02\x18\x19\x05\x06\x04\x02\x19!\x03' + + '\x02\x02\x02\x1A\x1B\x05\x06\x04\x02\x1B\x1C\x05\b\x05\x02\x1C!\x03\x02' + + '\x02\x02\x1D\x1E\x07\x05\x02\x02\x1E!\x05\x04\x03\x06\x1F!\x07\x06\x02' + + '\x02 \x11\x03\x02\x02\x02 \x13\x03\x02\x02\x02 \x17\x03\x02\x02\x02 \x1A' + + '\x03\x02\x02\x02 \x1D\x03\x02\x02\x02 \x1F\x03\x02\x02\x02!*\x03\x02\x02' + + '\x02"#\f\x05\x02\x02#$\x07\x03\x02\x02$)\x05\x04\x03\x06%&\f\x04\x02' + + "\x02&'\x07\x04\x02\x02')\x05\x04\x03\x05(\"\x03\x02\x02\x02(%\x03\x02" + + '\x02\x02),\x03\x02\x02\x02*(\x03\x02\x02\x02*+\x03\x02\x02\x02+\x05\x03' + + '\x02\x02\x02,*\x03\x02\x02\x02-3\x05\n\x06\x02./\x07\t\x02\x02/0\x05\x04' + + '\x03\x0201\x07\n\x02\x0213\x03\x02\x02\x022-\x03\x02\x02\x022.\x03\x02' + + '\x02\x023\x07\x03\x02\x02\x024;\x07\x06\x02\x0257\x07\x07\x02\x0265\x03' + + '\x02\x02\x0278\x03\x02\x02\x0286\x03\x02\x02\x0289\x03\x02\x02\x029;\x03' + + '\x02\x02\x02:4\x03\x02\x02\x02:6\x03\x02\x02\x02;\t\x03\x02\x02\x02<=' + + '\x07\v\x02\x02=>\x07\b\x02\x02>C\x05\f\x07\x02?@\x07\f\x02\x02@A\x07\b' + + '\x02\x02AC\x05\f\x07\x02B<\x03\x02\x02\x02B?\x03\x02\x02\x02C\v\x03\x02' + + '\x02\x02DE\t\x02\x02\x02E\r\x03\x02\x02\x02\t (*28:B'; + public static __ATN: ATN; + public static get _ATN(): ATN { + if (!OpSelectionParser.__ATN) { + OpSelectionParser.__ATN = new ATNDeserializer().deserialize( + Utils.toCharArray(OpSelectionParser._serializedATN), + ); + } + + return OpSelectionParser.__ATN; + } +} + +export class StartContext extends ParserRuleContext { + public expr(): ExprContext { + return this.getRuleContext(0, ExprContext); + } + public EOF(): TerminalNode { + return this.getToken(OpSelectionParser.EOF, 0); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_start; + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterStart) { + listener.enterStart(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitStart) { + listener.exitStart(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitStart) { + return visitor.visitStart(this); + } else { + return visitor.visitChildren(this); + } + } +} + +export class ExprContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_expr; + } + public copyFrom(ctx: ExprContext): void { + super.copyFrom(ctx); + } +} +export class TraversalAllowedExpressionContext extends ExprContext { + public traversalAllowedExpr(): TraversalAllowedExprContext { + return this.getRuleContext(0, TraversalAllowedExprContext); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterTraversalAllowedExpression) { + listener.enterTraversalAllowedExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitTraversalAllowedExpression) { + listener.exitTraversalAllowedExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitTraversalAllowedExpression) { + return visitor.visitTraversalAllowedExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class UpAndDownTraversalExpressionContext extends ExprContext { + public traversal(): TraversalContext[]; + public traversal(i: number): TraversalContext; + public traversal(i?: number): TraversalContext | TraversalContext[] { + if (i === undefined) { + return this.getRuleContexts(TraversalContext); + } else { + return this.getRuleContext(i, TraversalContext); + } + } + public traversalAllowedExpr(): TraversalAllowedExprContext { + return this.getRuleContext(0, TraversalAllowedExprContext); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterUpAndDownTraversalExpression) { + listener.enterUpAndDownTraversalExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitUpAndDownTraversalExpression) { + listener.exitUpAndDownTraversalExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitUpAndDownTraversalExpression) { + return visitor.visitUpAndDownTraversalExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class UpTraversalExpressionContext extends ExprContext { + public traversal(): TraversalContext { + return this.getRuleContext(0, TraversalContext); + } + public traversalAllowedExpr(): TraversalAllowedExprContext { + return this.getRuleContext(0, TraversalAllowedExprContext); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterUpTraversalExpression) { + listener.enterUpTraversalExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitUpTraversalExpression) { + listener.exitUpTraversalExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitUpTraversalExpression) { + return visitor.visitUpTraversalExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class DownTraversalExpressionContext extends ExprContext { + public traversalAllowedExpr(): TraversalAllowedExprContext { + return this.getRuleContext(0, TraversalAllowedExprContext); + } + public traversal(): TraversalContext { + return this.getRuleContext(0, TraversalContext); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterDownTraversalExpression) { + listener.enterDownTraversalExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitDownTraversalExpression) { + listener.exitDownTraversalExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitDownTraversalExpression) { + return visitor.visitDownTraversalExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NotExpressionContext extends ExprContext { + public NOT(): TerminalNode { + return this.getToken(OpSelectionParser.NOT, 0); + } + public expr(): ExprContext { + return this.getRuleContext(0, ExprContext); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterNotExpression) { + listener.enterNotExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitNotExpression) { + listener.exitNotExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitNotExpression) { + return visitor.visitNotExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AndExpressionContext extends ExprContext { + public expr(): ExprContext[]; + public expr(i: number): ExprContext; + public expr(i?: number): ExprContext | ExprContext[] { + if (i === undefined) { + return this.getRuleContexts(ExprContext); + } else { + return this.getRuleContext(i, ExprContext); + } + } + public AND(): TerminalNode { + return this.getToken(OpSelectionParser.AND, 0); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterAndExpression) { + listener.enterAndExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitAndExpression) { + listener.exitAndExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitAndExpression) { + return visitor.visitAndExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class OrExpressionContext extends ExprContext { + public expr(): ExprContext[]; + public expr(i: number): ExprContext; + public expr(i?: number): ExprContext | ExprContext[] { + if (i === undefined) { + return this.getRuleContexts(ExprContext); + } else { + return this.getRuleContext(i, ExprContext); + } + } + public OR(): TerminalNode { + return this.getToken(OpSelectionParser.OR, 0); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterOrExpression) { + listener.enterOrExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitOrExpression) { + listener.exitOrExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitOrExpression) { + return visitor.visitOrExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class AllExpressionContext extends ExprContext { + public STAR(): TerminalNode { + return this.getToken(OpSelectionParser.STAR, 0); + } + constructor(ctx: ExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterAllExpression) { + listener.enterAllExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitAllExpression) { + listener.exitAllExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitAllExpression) { + return visitor.visitAllExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + +export class TraversalAllowedExprContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_traversalAllowedExpr; + } + public copyFrom(ctx: TraversalAllowedExprContext): void { + super.copyFrom(ctx); + } +} +export class AttributeExpressionContext extends TraversalAllowedExprContext { + public attributeExpr(): AttributeExprContext { + return this.getRuleContext(0, AttributeExprContext); + } + constructor(ctx: TraversalAllowedExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterAttributeExpression) { + listener.enterAttributeExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitAttributeExpression) { + listener.exitAttributeExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitAttributeExpression) { + return visitor.visitAttributeExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class ParenthesizedExpressionContext extends TraversalAllowedExprContext { + public LPAREN(): TerminalNode { + return this.getToken(OpSelectionParser.LPAREN, 0); + } + public expr(): ExprContext { + return this.getRuleContext(0, ExprContext); + } + public RPAREN(): TerminalNode { + return this.getToken(OpSelectionParser.RPAREN, 0); + } + constructor(ctx: TraversalAllowedExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterParenthesizedExpression) { + listener.enterParenthesizedExpression(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitParenthesizedExpression) { + listener.exitParenthesizedExpression(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitParenthesizedExpression) { + return visitor.visitParenthesizedExpression(this); + } else { + return visitor.visitChildren(this); + } + } +} + +export class TraversalContext extends ParserRuleContext { + public STAR(): TerminalNode | undefined { + return this.tryGetToken(OpSelectionParser.STAR, 0); + } + public PLUS(): TerminalNode[]; + public PLUS(i: number): TerminalNode; + public PLUS(i?: number): TerminalNode | TerminalNode[] { + if (i === undefined) { + return this.getTokens(OpSelectionParser.PLUS); + } else { + return this.getToken(OpSelectionParser.PLUS, i); + } + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_traversal; + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterTraversal) { + listener.enterTraversal(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitTraversal) { + listener.exitTraversal(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitTraversal) { + return visitor.visitTraversal(this); + } else { + return visitor.visitChildren(this); + } + } +} + +export class AttributeExprContext extends ParserRuleContext { + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_attributeExpr; + } + public copyFrom(ctx: AttributeExprContext): void { + super.copyFrom(ctx); + } +} +export class NameExprContext extends AttributeExprContext { + public NAME(): TerminalNode { + return this.getToken(OpSelectionParser.NAME, 0); + } + public COLON(): TerminalNode { + return this.getToken(OpSelectionParser.COLON, 0); + } + public value(): ValueContext { + return this.getRuleContext(0, ValueContext); + } + constructor(ctx: AttributeExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterNameExpr) { + listener.enterNameExpr(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitNameExpr) { + listener.exitNameExpr(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitNameExpr) { + return visitor.visitNameExpr(this); + } else { + return visitor.visitChildren(this); + } + } +} +export class NameSubstringExprContext extends AttributeExprContext { + public NAME_SUBSTRING(): TerminalNode { + return this.getToken(OpSelectionParser.NAME_SUBSTRING, 0); + } + public COLON(): TerminalNode { + return this.getToken(OpSelectionParser.COLON, 0); + } + public value(): ValueContext { + return this.getRuleContext(0, ValueContext); + } + constructor(ctx: AttributeExprContext) { + super(ctx.parent, ctx.invokingState); + this.copyFrom(ctx); + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterNameSubstringExpr) { + listener.enterNameSubstringExpr(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitNameSubstringExpr) { + listener.exitNameSubstringExpr(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitNameSubstringExpr) { + return visitor.visitNameSubstringExpr(this); + } else { + return visitor.visitChildren(this); + } + } +} + +export class ValueContext extends ParserRuleContext { + public QUOTED_STRING(): TerminalNode | undefined { + return this.tryGetToken(OpSelectionParser.QUOTED_STRING, 0); + } + public UNQUOTED_STRING(): TerminalNode | undefined { + return this.tryGetToken(OpSelectionParser.UNQUOTED_STRING, 0); + } + constructor(parent: ParserRuleContext | undefined, invokingState: number) { + super(parent, invokingState); + } + // @Override + public get ruleIndex(): number { + return OpSelectionParser.RULE_value; + } + // @Override + public enterRule(listener: OpSelectionListener): void { + if (listener.enterValue) { + listener.enterValue(this); + } + } + // @Override + public exitRule(listener: OpSelectionListener): void { + if (listener.exitValue) { + listener.exitValue(this); + } + } + // @Override + public accept(visitor: OpSelectionVisitor): Result { + if (visitor.visitValue) { + return visitor.visitValue(this); + } else { + return visitor.visitChildren(this); + } + } +} diff --git a/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionVisitor.ts b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionVisitor.ts new file mode 100644 index 0000000000000..19e9f3b480257 --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/op-selection/generated/OpSelectionVisitor.ts @@ -0,0 +1,171 @@ +// Generated from /Users/briantu/repos/dagster/js_modules/dagster-ui/packages/ui-core/src/op-selection/OpSelection.g4 by ANTLR 4.9.0-SNAPSHOT + +import {ParseTreeVisitor} from 'antlr4ts/tree/ParseTreeVisitor'; + +import { + AllExpressionContext, + AndExpressionContext, + AttributeExprContext, + AttributeExpressionContext, + DownTraversalExpressionContext, + ExprContext, + NameExprContext, + NameSubstringExprContext, + NotExpressionContext, + OrExpressionContext, + ParenthesizedExpressionContext, + StartContext, + TraversalAllowedExprContext, + TraversalAllowedExpressionContext, + TraversalContext, + UpAndDownTraversalExpressionContext, + UpTraversalExpressionContext, + ValueContext, +} from './OpSelectionParser'; + +/** + * This interface defines a complete generic visitor for a parse tree produced + * by `OpSelectionParser`. + * + * @param The return type of the visit operation. Use `void` for + * operations with no return type. + */ +export interface OpSelectionVisitor extends ParseTreeVisitor { + /** + * Visit a parse tree produced by the `TraversalAllowedExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTraversalAllowedExpression?: (ctx: TraversalAllowedExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `UpAndDownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUpAndDownTraversalExpression?: (ctx: UpAndDownTraversalExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `UpTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitUpTraversalExpression?: (ctx: UpTraversalExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `DownTraversalExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitDownTraversalExpression?: (ctx: DownTraversalExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `NotExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNotExpression?: (ctx: NotExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `AndExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAndExpression?: (ctx: AndExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `OrExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitOrExpression?: (ctx: OrExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `AllExpression` + * labeled alternative in `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAllExpression?: (ctx: AllExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `NameExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNameExpr?: (ctx: NameExprContext) => Result; + + /** + * Visit a parse tree produced by the `NameSubstringExpr` + * labeled alternative in `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitNameSubstringExpr?: (ctx: NameSubstringExprContext) => Result; + + /** + * Visit a parse tree produced by the `AttributeExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAttributeExpression?: (ctx: AttributeExpressionContext) => Result; + + /** + * Visit a parse tree produced by the `ParenthesizedExpression` + * labeled alternative in `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.start`. + * @param ctx the parse tree + * @return the visitor result + */ + visitStart?: (ctx: StartContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.expr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitExpr?: (ctx: ExprContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.traversalAllowedExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTraversalAllowedExpr?: (ctx: TraversalAllowedExprContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.traversal`. + * @param ctx the parse tree + * @return the visitor result + */ + visitTraversal?: (ctx: TraversalContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.attributeExpr`. + * @param ctx the parse tree + * @return the visitor result + */ + visitAttributeExpr?: (ctx: AttributeExprContext) => Result; + + /** + * Visit a parse tree produced by `OpSelectionParser.value`. + * @param ctx the parse tree + * @return the visitor result + */ + visitValue?: (ctx: ValueContext) => Result; +} diff --git a/js_modules/dagster-ui/packages/ui-core/src/scripts/generateOpSelection.ts b/js_modules/dagster-ui/packages/ui-core/src/scripts/generateOpSelection.ts new file mode 100644 index 0000000000000..ff79e194f3a8d --- /dev/null +++ b/js_modules/dagster-ui/packages/ui-core/src/scripts/generateOpSelection.ts @@ -0,0 +1,16 @@ +import {execSync} from 'child_process'; +import path from 'path'; + +const OP_SELECTION_GRAMMAR_FILE_PATH = path.resolve('./src/op-selection/OpSelection.g4'); +execSync(`antlr4ts -visitor -o ./src/op-selection/generated ${OP_SELECTION_GRAMMAR_FILE_PATH}`); + +const files = [ + 'OpSelectionLexer.ts', + 'OpSelectionListener.ts', + 'OpSelectionParser.ts', + 'OpSelectionVisitor.ts', +]; + +files.forEach((file) => { + execSync(`yarn prettier ./src/op-selection/generated/${file} --write`); +});