diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.g4 b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.g4 index 3c90865c6070b..55f1ab5b59e84 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.g4 +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.g4 @@ -1,12 +1,14 @@ grammar AssetSelection; +start: expr EOF; + // Root rule for parsing expressions expr : assetExpr # AssetExpression - | keyValueExpr # KeyValueExpression - | traversal expr # LeftTraversalExpression - | traversal expr traversal # BothTraversalExpression - | expr traversal # RightTraversalExpression + | attributeExpr # AttributeExpression + | traversal expr # UpTraversalExpression + | traversal expr traversal # UpAndDownTraversalExpression + | expr traversal # DownTraversalExpression | NOT expr # NotExpression | expr AND expr # AndExpression | expr OR expr # OrExpression @@ -26,13 +28,13 @@ functionName | ROOTS ; -// Key-value expressions for specific attributes -keyValueExpr - : TAG COLON value (EQUAL value)? # TagKeyValuePair - | OWNER COLON value # OwnerKeyValuePair - | GROUP COLON value # GroupKeyValuePair - | KIND COLON value # KindKeyValuePair - | REPO COLON value # RepoKeyValuePair +// Attribute expressions for specific attributes +attributeExpr + : TAG COLON value (EQUAL value)? # TagAttributeExpr + | OWNER COLON value # OwnerAttributeExpr + | GROUP COLON value # GroupAttributeExpr + | KIND COLON value # KindAttributeExpr + | CODELOCATION COLON value # CodeLocationAttributeExpr ; // Define the EQUAL token for tag:value=value syntax @@ -69,7 +71,7 @@ OWNER : 'owner'; GROUP : 'group'; TAG : 'tag'; KIND : 'kind'; -REPO : 'repo'; +CODELOCATION : 'codelocation'; // Tokens for function names SINKS : 'sinks'; diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.interp b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.interp index c18bc818beaac..f846611621260 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.interp +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.interp @@ -14,7 +14,7 @@ null 'group' 'tag' 'kind' -'repo' +'codelocation' 'sinks' 'roots' null @@ -37,7 +37,7 @@ OWNER GROUP TAG KIND -REPO +CODELOCATION SINKS ROOTS QUOTED_STRING @@ -45,13 +45,14 @@ UNQUOTED_STRING WS rule names: +start expr traversal functionName -keyValueExpr +attributeExpr value assetExpr atn: -[4, 1, 20, 86, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 3, 0, 34, 8, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 5, 0, 44, 8, 0, 10, 0, 12, 0, 47, 9, 0, 1, 1, 1, 1, 4, 1, 51, 8, 1, 11, 1, 12, 1, 52, 3, 1, 55, 8, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 64, 8, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 3, 3, 78, 8, 3, 1, 4, 1, 4, 1, 5, 1, 5, 3, 5, 84, 8, 5, 1, 5, 0, 1, 0, 6, 0, 2, 4, 6, 8, 10, 0, 2, 1, 0, 16, 17, 1, 0, 18, 19, 96, 0, 33, 1, 0, 0, 0, 2, 54, 1, 0, 0, 0, 4, 56, 1, 0, 0, 0, 6, 77, 1, 0, 0, 0, 8, 79, 1, 0, 0, 0, 10, 83, 1, 0, 0, 0, 12, 13, 6, 0, -1, 0, 13, 34, 3, 10, 5, 0, 14, 34, 3, 6, 3, 0, 15, 16, 3, 2, 1, 0, 16, 17, 3, 0, 0, 8, 17, 34, 1, 0, 0, 0, 18, 19, 3, 2, 1, 0, 19, 20, 3, 0, 0, 0, 20, 21, 3, 2, 1, 0, 21, 34, 1, 0, 0, 0, 22, 23, 5, 4, 0, 0, 23, 34, 3, 0, 0, 5, 24, 25, 3, 4, 2, 0, 25, 26, 5, 8, 0, 0, 26, 27, 3, 0, 0, 0, 27, 28, 5, 9, 0, 0, 28, 34, 1, 0, 0, 0, 29, 30, 5, 8, 0, 0, 30, 31, 3, 0, 0, 0, 31, 32, 5, 9, 0, 0, 32, 34, 1, 0, 0, 0, 33, 12, 1, 0, 0, 0, 33, 14, 1, 0, 0, 0, 33, 15, 1, 0, 0, 0, 33, 18, 1, 0, 0, 0, 33, 22, 1, 0, 0, 0, 33, 24, 1, 0, 0, 0, 33, 29, 1, 0, 0, 0, 34, 45, 1, 0, 0, 0, 35, 36, 10, 4, 0, 0, 36, 37, 5, 2, 0, 0, 37, 44, 3, 0, 0, 5, 38, 39, 10, 3, 0, 0, 39, 40, 5, 3, 0, 0, 40, 44, 3, 0, 0, 4, 41, 42, 10, 6, 0, 0, 42, 44, 3, 2, 1, 0, 43, 35, 1, 0, 0, 0, 43, 38, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 1, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 55, 5, 5, 0, 0, 49, 51, 5, 6, 0, 0, 50, 49, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 55, 1, 0, 0, 0, 54, 48, 1, 0, 0, 0, 54, 50, 1, 0, 0, 0, 55, 3, 1, 0, 0, 0, 56, 57, 7, 0, 0, 0, 57, 5, 1, 0, 0, 0, 58, 59, 5, 13, 0, 0, 59, 60, 5, 7, 0, 0, 60, 63, 3, 8, 4, 0, 61, 62, 5, 1, 0, 0, 62, 64, 3, 8, 4, 0, 63, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 78, 1, 0, 0, 0, 65, 66, 5, 11, 0, 0, 66, 67, 5, 7, 0, 0, 67, 78, 3, 8, 4, 0, 68, 69, 5, 12, 0, 0, 69, 70, 5, 7, 0, 0, 70, 78, 3, 8, 4, 0, 71, 72, 5, 14, 0, 0, 72, 73, 5, 7, 0, 0, 73, 78, 3, 8, 4, 0, 74, 75, 5, 15, 0, 0, 75, 76, 5, 7, 0, 0, 76, 78, 3, 8, 4, 0, 77, 58, 1, 0, 0, 0, 77, 65, 1, 0, 0, 0, 77, 68, 1, 0, 0, 0, 77, 71, 1, 0, 0, 0, 77, 74, 1, 0, 0, 0, 78, 7, 1, 0, 0, 0, 79, 80, 7, 1, 0, 0, 80, 9, 1, 0, 0, 0, 81, 84, 5, 18, 0, 0, 82, 84, 5, 19, 0, 0, 83, 81, 1, 0, 0, 0, 83, 82, 1, 0, 0, 0, 84, 11, 1, 0, 0, 0, 8, 33, 43, 45, 52, 54, 63, 77, 83] \ No newline at end of file +[4, 1, 20, 91, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 39, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 49, 8, 1, 10, 1, 12, 1, 52, 9, 1, 1, 2, 1, 2, 4, 2, 56, 8, 2, 11, 2, 12, 2, 57, 3, 2, 60, 8, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 69, 8, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 3, 4, 83, 8, 4, 1, 5, 1, 5, 1, 6, 1, 6, 3, 6, 89, 8, 6, 1, 6, 0, 1, 2, 7, 0, 2, 4, 6, 8, 10, 12, 0, 2, 1, 0, 16, 17, 1, 0, 18, 19, 100, 0, 14, 1, 0, 0, 0, 2, 38, 1, 0, 0, 0, 4, 59, 1, 0, 0, 0, 6, 61, 1, 0, 0, 0, 8, 82, 1, 0, 0, 0, 10, 84, 1, 0, 0, 0, 12, 88, 1, 0, 0, 0, 14, 15, 3, 2, 1, 0, 15, 16, 5, 0, 0, 1, 16, 1, 1, 0, 0, 0, 17, 18, 6, 1, -1, 0, 18, 39, 3, 12, 6, 0, 19, 39, 3, 8, 4, 0, 20, 21, 3, 4, 2, 0, 21, 22, 3, 2, 1, 8, 22, 39, 1, 0, 0, 0, 23, 24, 3, 4, 2, 0, 24, 25, 3, 2, 1, 0, 25, 26, 3, 4, 2, 0, 26, 39, 1, 0, 0, 0, 27, 28, 5, 4, 0, 0, 28, 39, 3, 2, 1, 5, 29, 30, 3, 6, 3, 0, 30, 31, 5, 8, 0, 0, 31, 32, 3, 2, 1, 0, 32, 33, 5, 9, 0, 0, 33, 39, 1, 0, 0, 0, 34, 35, 5, 8, 0, 0, 35, 36, 3, 2, 1, 0, 36, 37, 5, 9, 0, 0, 37, 39, 1, 0, 0, 0, 38, 17, 1, 0, 0, 0, 38, 19, 1, 0, 0, 0, 38, 20, 1, 0, 0, 0, 38, 23, 1, 0, 0, 0, 38, 27, 1, 0, 0, 0, 38, 29, 1, 0, 0, 0, 38, 34, 1, 0, 0, 0, 39, 50, 1, 0, 0, 0, 40, 41, 10, 4, 0, 0, 41, 42, 5, 2, 0, 0, 42, 49, 3, 2, 1, 5, 43, 44, 10, 3, 0, 0, 44, 45, 5, 3, 0, 0, 45, 49, 3, 2, 1, 4, 46, 47, 10, 6, 0, 0, 47, 49, 3, 4, 2, 0, 48, 40, 1, 0, 0, 0, 48, 43, 1, 0, 0, 0, 48, 46, 1, 0, 0, 0, 49, 52, 1, 0, 0, 0, 50, 48, 1, 0, 0, 0, 50, 51, 1, 0, 0, 0, 51, 3, 1, 0, 0, 0, 52, 50, 1, 0, 0, 0, 53, 60, 5, 5, 0, 0, 54, 56, 5, 6, 0, 0, 55, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 55, 1, 0, 0, 0, 57, 58, 1, 0, 0, 0, 58, 60, 1, 0, 0, 0, 59, 53, 1, 0, 0, 0, 59, 55, 1, 0, 0, 0, 60, 5, 1, 0, 0, 0, 61, 62, 7, 0, 0, 0, 62, 7, 1, 0, 0, 0, 63, 64, 5, 13, 0, 0, 64, 65, 5, 7, 0, 0, 65, 68, 3, 10, 5, 0, 66, 67, 5, 1, 0, 0, 67, 69, 3, 10, 5, 0, 68, 66, 1, 0, 0, 0, 68, 69, 1, 0, 0, 0, 69, 83, 1, 0, 0, 0, 70, 71, 5, 11, 0, 0, 71, 72, 5, 7, 0, 0, 72, 83, 3, 10, 5, 0, 73, 74, 5, 12, 0, 0, 74, 75, 5, 7, 0, 0, 75, 83, 3, 10, 5, 0, 76, 77, 5, 14, 0, 0, 77, 78, 5, 7, 0, 0, 78, 83, 3, 10, 5, 0, 79, 80, 5, 15, 0, 0, 80, 81, 5, 7, 0, 0, 81, 83, 3, 10, 5, 0, 82, 63, 1, 0, 0, 0, 82, 70, 1, 0, 0, 0, 82, 73, 1, 0, 0, 0, 82, 76, 1, 0, 0, 0, 82, 79, 1, 0, 0, 0, 83, 9, 1, 0, 0, 0, 84, 85, 7, 1, 0, 0, 85, 11, 1, 0, 0, 0, 86, 89, 5, 18, 0, 0, 87, 89, 5, 19, 0, 0, 88, 86, 1, 0, 0, 0, 88, 87, 1, 0, 0, 0, 89, 13, 1, 0, 0, 0, 8, 38, 48, 50, 57, 59, 68, 82, 88] \ No newline at end of file diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.tokens b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.tokens index b11d74270411b..fb339c25a3492 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.tokens +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelection.tokens @@ -12,7 +12,7 @@ OWNER=11 GROUP=12 TAG=13 KIND=14 -REPO=15 +CODELOCATION=15 SINKS=16 ROOTS=17 QUOTED_STRING=18 @@ -32,6 +32,6 @@ WS=20 'group'=12 'tag'=13 'kind'=14 -'repo'=15 +'codelocation'=15 'sinks'=16 'roots'=17 diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.interp b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.interp index 4f178f8d55cb1..b0149ac5c0aee 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.interp +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.interp @@ -14,7 +14,7 @@ null 'group' 'tag' 'kind' -'repo' +'codelocation' 'sinks' 'roots' null @@ -37,7 +37,7 @@ OWNER GROUP TAG KIND -REPO +CODELOCATION SINKS ROOTS QUOTED_STRING @@ -59,7 +59,7 @@ OWNER GROUP TAG KIND -REPO +CODELOCATION SINKS ROOTS QUOTED_STRING @@ -74,4 +74,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 20, 127, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 107, 8, 17, 10, 17, 12, 17, 110, 9, 17, 1, 17, 1, 17, 1, 18, 1, 18, 5, 18, 116, 8, 18, 10, 18, 12, 18, 119, 9, 18, 1, 19, 4, 19, 122, 8, 19, 11, 19, 12, 19, 123, 1, 19, 1, 19, 0, 0, 20, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 1, 0, 4, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 129, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 1, 41, 1, 0, 0, 0, 3, 43, 1, 0, 0, 0, 5, 47, 1, 0, 0, 0, 7, 50, 1, 0, 0, 0, 9, 54, 1, 0, 0, 0, 11, 56, 1, 0, 0, 0, 13, 58, 1, 0, 0, 0, 15, 60, 1, 0, 0, 0, 17, 62, 1, 0, 0, 0, 19, 64, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 72, 1, 0, 0, 0, 25, 78, 1, 0, 0, 0, 27, 82, 1, 0, 0, 0, 29, 87, 1, 0, 0, 0, 31, 92, 1, 0, 0, 0, 33, 98, 1, 0, 0, 0, 35, 104, 1, 0, 0, 0, 37, 113, 1, 0, 0, 0, 39, 121, 1, 0, 0, 0, 41, 42, 5, 61, 0, 0, 42, 2, 1, 0, 0, 0, 43, 44, 5, 97, 0, 0, 44, 45, 5, 110, 0, 0, 45, 46, 5, 100, 0, 0, 46, 4, 1, 0, 0, 0, 47, 48, 5, 111, 0, 0, 48, 49, 5, 114, 0, 0, 49, 6, 1, 0, 0, 0, 50, 51, 5, 110, 0, 0, 51, 52, 5, 111, 0, 0, 52, 53, 5, 116, 0, 0, 53, 8, 1, 0, 0, 0, 54, 55, 5, 42, 0, 0, 55, 10, 1, 0, 0, 0, 56, 57, 5, 43, 0, 0, 57, 12, 1, 0, 0, 0, 58, 59, 5, 58, 0, 0, 59, 14, 1, 0, 0, 0, 60, 61, 5, 40, 0, 0, 61, 16, 1, 0, 0, 0, 62, 63, 5, 41, 0, 0, 63, 18, 1, 0, 0, 0, 64, 65, 5, 44, 0, 0, 65, 20, 1, 0, 0, 0, 66, 67, 5, 111, 0, 0, 67, 68, 5, 119, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 101, 0, 0, 70, 71, 5, 114, 0, 0, 71, 22, 1, 0, 0, 0, 72, 73, 5, 103, 0, 0, 73, 74, 5, 114, 0, 0, 74, 75, 5, 111, 0, 0, 75, 76, 5, 117, 0, 0, 76, 77, 5, 112, 0, 0, 77, 24, 1, 0, 0, 0, 78, 79, 5, 116, 0, 0, 79, 80, 5, 97, 0, 0, 80, 81, 5, 103, 0, 0, 81, 26, 1, 0, 0, 0, 82, 83, 5, 107, 0, 0, 83, 84, 5, 105, 0, 0, 84, 85, 5, 110, 0, 0, 85, 86, 5, 100, 0, 0, 86, 28, 1, 0, 0, 0, 87, 88, 5, 114, 0, 0, 88, 89, 5, 101, 0, 0, 89, 90, 5, 112, 0, 0, 90, 91, 5, 111, 0, 0, 91, 30, 1, 0, 0, 0, 92, 93, 5, 115, 0, 0, 93, 94, 5, 105, 0, 0, 94, 95, 5, 110, 0, 0, 95, 96, 5, 107, 0, 0, 96, 97, 5, 115, 0, 0, 97, 32, 1, 0, 0, 0, 98, 99, 5, 114, 0, 0, 99, 100, 5, 111, 0, 0, 100, 101, 5, 111, 0, 0, 101, 102, 5, 116, 0, 0, 102, 103, 5, 115, 0, 0, 103, 34, 1, 0, 0, 0, 104, 108, 5, 34, 0, 0, 105, 107, 8, 0, 0, 0, 106, 105, 1, 0, 0, 0, 107, 110, 1, 0, 0, 0, 108, 106, 1, 0, 0, 0, 108, 109, 1, 0, 0, 0, 109, 111, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 111, 112, 5, 34, 0, 0, 112, 36, 1, 0, 0, 0, 113, 117, 7, 1, 0, 0, 114, 116, 7, 2, 0, 0, 115, 114, 1, 0, 0, 0, 116, 119, 1, 0, 0, 0, 117, 115, 1, 0, 0, 0, 117, 118, 1, 0, 0, 0, 118, 38, 1, 0, 0, 0, 119, 117, 1, 0, 0, 0, 120, 122, 7, 3, 0, 0, 121, 120, 1, 0, 0, 0, 122, 123, 1, 0, 0, 0, 123, 121, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 126, 6, 19, 0, 0, 126, 40, 1, 0, 0, 0, 4, 0, 108, 117, 123, 1, 6, 0, 0] \ No newline at end of file +[4, 0, 20, 135, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 7, 1, 7, 1, 8, 1, 8, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 5, 17, 115, 8, 17, 10, 17, 12, 17, 118, 9, 17, 1, 17, 1, 17, 1, 18, 1, 18, 5, 18, 124, 8, 18, 10, 18, 12, 18, 127, 9, 18, 1, 19, 4, 19, 130, 8, 19, 11, 19, 12, 19, 131, 1, 19, 1, 19, 0, 0, 20, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 15, 31, 16, 33, 17, 35, 18, 37, 19, 39, 20, 1, 0, 4, 4, 0, 10, 10, 13, 13, 34, 34, 92, 92, 3, 0, 65, 90, 95, 95, 97, 122, 4, 0, 48, 57, 65, 90, 95, 95, 97, 122, 3, 0, 9, 10, 13, 13, 32, 32, 137, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 0, 19, 1, 0, 0, 0, 0, 21, 1, 0, 0, 0, 0, 23, 1, 0, 0, 0, 0, 25, 1, 0, 0, 0, 0, 27, 1, 0, 0, 0, 0, 29, 1, 0, 0, 0, 0, 31, 1, 0, 0, 0, 0, 33, 1, 0, 0, 0, 0, 35, 1, 0, 0, 0, 0, 37, 1, 0, 0, 0, 0, 39, 1, 0, 0, 0, 1, 41, 1, 0, 0, 0, 3, 43, 1, 0, 0, 0, 5, 47, 1, 0, 0, 0, 7, 50, 1, 0, 0, 0, 9, 54, 1, 0, 0, 0, 11, 56, 1, 0, 0, 0, 13, 58, 1, 0, 0, 0, 15, 60, 1, 0, 0, 0, 17, 62, 1, 0, 0, 0, 19, 64, 1, 0, 0, 0, 21, 66, 1, 0, 0, 0, 23, 72, 1, 0, 0, 0, 25, 78, 1, 0, 0, 0, 27, 82, 1, 0, 0, 0, 29, 87, 1, 0, 0, 0, 31, 100, 1, 0, 0, 0, 33, 106, 1, 0, 0, 0, 35, 112, 1, 0, 0, 0, 37, 121, 1, 0, 0, 0, 39, 129, 1, 0, 0, 0, 41, 42, 5, 61, 0, 0, 42, 2, 1, 0, 0, 0, 43, 44, 5, 97, 0, 0, 44, 45, 5, 110, 0, 0, 45, 46, 5, 100, 0, 0, 46, 4, 1, 0, 0, 0, 47, 48, 5, 111, 0, 0, 48, 49, 5, 114, 0, 0, 49, 6, 1, 0, 0, 0, 50, 51, 5, 110, 0, 0, 51, 52, 5, 111, 0, 0, 52, 53, 5, 116, 0, 0, 53, 8, 1, 0, 0, 0, 54, 55, 5, 42, 0, 0, 55, 10, 1, 0, 0, 0, 56, 57, 5, 43, 0, 0, 57, 12, 1, 0, 0, 0, 58, 59, 5, 58, 0, 0, 59, 14, 1, 0, 0, 0, 60, 61, 5, 40, 0, 0, 61, 16, 1, 0, 0, 0, 62, 63, 5, 41, 0, 0, 63, 18, 1, 0, 0, 0, 64, 65, 5, 44, 0, 0, 65, 20, 1, 0, 0, 0, 66, 67, 5, 111, 0, 0, 67, 68, 5, 119, 0, 0, 68, 69, 5, 110, 0, 0, 69, 70, 5, 101, 0, 0, 70, 71, 5, 114, 0, 0, 71, 22, 1, 0, 0, 0, 72, 73, 5, 103, 0, 0, 73, 74, 5, 114, 0, 0, 74, 75, 5, 111, 0, 0, 75, 76, 5, 117, 0, 0, 76, 77, 5, 112, 0, 0, 77, 24, 1, 0, 0, 0, 78, 79, 5, 116, 0, 0, 79, 80, 5, 97, 0, 0, 80, 81, 5, 103, 0, 0, 81, 26, 1, 0, 0, 0, 82, 83, 5, 107, 0, 0, 83, 84, 5, 105, 0, 0, 84, 85, 5, 110, 0, 0, 85, 86, 5, 100, 0, 0, 86, 28, 1, 0, 0, 0, 87, 88, 5, 99, 0, 0, 88, 89, 5, 111, 0, 0, 89, 90, 5, 100, 0, 0, 90, 91, 5, 101, 0, 0, 91, 92, 5, 108, 0, 0, 92, 93, 5, 111, 0, 0, 93, 94, 5, 99, 0, 0, 94, 95, 5, 97, 0, 0, 95, 96, 5, 116, 0, 0, 96, 97, 5, 105, 0, 0, 97, 98, 5, 111, 0, 0, 98, 99, 5, 110, 0, 0, 99, 30, 1, 0, 0, 0, 100, 101, 5, 115, 0, 0, 101, 102, 5, 105, 0, 0, 102, 103, 5, 110, 0, 0, 103, 104, 5, 107, 0, 0, 104, 105, 5, 115, 0, 0, 105, 32, 1, 0, 0, 0, 106, 107, 5, 114, 0, 0, 107, 108, 5, 111, 0, 0, 108, 109, 5, 111, 0, 0, 109, 110, 5, 116, 0, 0, 110, 111, 5, 115, 0, 0, 111, 34, 1, 0, 0, 0, 112, 116, 5, 34, 0, 0, 113, 115, 8, 0, 0, 0, 114, 113, 1, 0, 0, 0, 115, 118, 1, 0, 0, 0, 116, 114, 1, 0, 0, 0, 116, 117, 1, 0, 0, 0, 117, 119, 1, 0, 0, 0, 118, 116, 1, 0, 0, 0, 119, 120, 5, 34, 0, 0, 120, 36, 1, 0, 0, 0, 121, 125, 7, 1, 0, 0, 122, 124, 7, 2, 0, 0, 123, 122, 1, 0, 0, 0, 124, 127, 1, 0, 0, 0, 125, 123, 1, 0, 0, 0, 125, 126, 1, 0, 0, 0, 126, 38, 1, 0, 0, 0, 127, 125, 1, 0, 0, 0, 128, 130, 7, 3, 0, 0, 129, 128, 1, 0, 0, 0, 130, 131, 1, 0, 0, 0, 131, 129, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 133, 1, 0, 0, 0, 133, 134, 6, 19, 0, 0, 134, 40, 1, 0, 0, 0, 4, 0, 116, 125, 131, 1, 6, 0, 0] \ No newline at end of file diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.py index ad3e85130fbad..f1bc7a362dcf8 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.py +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.py @@ -11,7 +11,7 @@ def serializedATN(): 4, 0, 20, - 127, + 135, 6, -1, 2, @@ -197,6 +197,22 @@ def serializedATN(): 1, 14, 1, + 14, + 1, + 14, + 1, + 14, + 1, + 14, + 1, + 14, + 1, + 14, + 1, + 14, + 1, + 14, + 1, 15, 1, 15, @@ -226,14 +242,14 @@ def serializedATN(): 17, 5, 17, - 107, + 115, 8, 17, 10, 17, 12, 17, - 110, + 118, 9, 17, 1, @@ -246,28 +262,28 @@ def serializedATN(): 18, 5, 18, - 116, + 124, 8, 18, 10, 18, 12, 18, - 119, + 127, 9, 18, 1, 19, 4, 19, - 122, + 130, 8, 19, 11, 19, 12, 19, - 123, + 131, 1, 19, 1, @@ -354,7 +370,7 @@ def serializedATN(): 13, 32, 32, - 129, + 137, 0, 1, 1, @@ -566,31 +582,31 @@ def serializedATN(): 0, 0, 31, - 92, + 100, 1, 0, 0, 0, 33, - 98, + 106, 1, 0, 0, 0, 35, - 104, + 112, 1, 0, 0, 0, 37, - 113, + 121, 1, 0, 0, 0, 39, - 121, + 129, 1, 0, 0, @@ -874,256 +890,304 @@ def serializedATN(): 87, 88, 5, - 114, + 99, 0, 0, 88, 89, 5, - 101, + 111, 0, 0, 89, 90, 5, - 112, + 100, 0, 0, 90, 91, 5, - 111, + 101, 0, 0, 91, - 30, - 1, - 0, + 92, + 5, + 108, 0, 0, 92, 93, 5, - 115, + 111, 0, 0, 93, 94, 5, - 105, + 99, 0, 0, 94, 95, 5, - 110, + 97, 0, 0, 95, 96, 5, - 107, + 116, 0, 0, 96, 97, 5, - 115, + 105, 0, 0, 97, - 32, - 1, - 0, + 98, + 5, + 111, 0, 0, 98, 99, 5, - 114, + 110, 0, 0, 99, - 100, - 5, - 111, + 30, + 1, + 0, 0, 0, 100, 101, 5, - 111, + 115, 0, 0, 101, 102, 5, - 116, + 105, 0, 0, 102, 103, 5, - 115, + 110, 0, 0, 103, - 34, + 104, + 5, + 107, + 0, + 0, + 104, + 105, + 5, + 115, + 0, + 0, + 105, + 32, 1, 0, 0, 0, - 104, + 106, + 107, + 5, + 114, + 0, + 0, + 107, 108, 5, + 111, + 0, + 0, + 108, + 109, + 5, + 111, + 0, + 0, + 109, + 110, + 5, + 116, + 0, + 0, + 110, + 111, + 5, + 115, + 0, + 0, + 111, 34, + 1, 0, 0, - 105, - 107, + 0, + 112, + 116, + 5, + 34, + 0, + 0, + 113, + 115, 8, 0, 0, 0, - 106, - 105, + 114, + 113, 1, 0, 0, 0, - 107, - 110, + 115, + 118, 1, 0, 0, 0, - 108, - 106, + 116, + 114, 1, 0, 0, 0, - 108, - 109, + 116, + 117, 1, 0, 0, 0, - 109, - 111, + 117, + 119, 1, 0, 0, 0, - 110, - 108, + 118, + 116, 1, 0, 0, 0, - 111, - 112, + 119, + 120, 5, 34, 0, 0, - 112, + 120, 36, 1, 0, 0, 0, - 113, - 117, + 121, + 125, 7, 1, 0, 0, - 114, - 116, + 122, + 124, 7, 2, 0, 0, - 115, - 114, + 123, + 122, 1, 0, 0, 0, - 116, - 119, + 124, + 127, 1, 0, 0, 0, - 117, - 115, + 125, + 123, 1, 0, 0, 0, - 117, - 118, + 125, + 126, 1, 0, 0, 0, - 118, + 126, 38, 1, 0, 0, 0, - 119, - 117, + 127, + 125, 1, 0, 0, 0, - 120, - 122, + 128, + 130, 7, 3, 0, 0, - 121, - 120, + 129, + 128, 1, 0, 0, 0, - 122, - 123, + 130, + 131, 1, 0, 0, 0, - 123, - 121, + 131, + 129, 1, 0, 0, 0, - 123, - 124, + 131, + 132, 1, 0, 0, 0, - 124, - 125, + 132, + 133, 1, 0, 0, 0, - 125, - 126, + 133, + 134, 6, 19, 0, 0, - 126, + 134, 40, 1, 0, @@ -1131,9 +1195,9 @@ def serializedATN(): 0, 4, 0, - 108, - 117, - 123, + 116, + 125, + 131, 1, 6, 0, @@ -1160,7 +1224,7 @@ class AssetSelectionLexer(Lexer): GROUP = 12 TAG = 13 KIND = 14 - REPO = 15 + CODELOCATION = 15 SINKS = 16 ROOTS = 17 QUOTED_STRING = 18 @@ -1187,7 +1251,7 @@ class AssetSelectionLexer(Lexer): "'group'", "'tag'", "'kind'", - "'repo'", + "'codelocation'", "'sinks'", "'roots'", ] @@ -1208,7 +1272,7 @@ class AssetSelectionLexer(Lexer): "GROUP", "TAG", "KIND", - "REPO", + "CODELOCATION", "SINKS", "ROOTS", "QUOTED_STRING", @@ -1231,7 +1295,7 @@ class AssetSelectionLexer(Lexer): "GROUP", "TAG", "KIND", - "REPO", + "CODELOCATION", "SINKS", "ROOTS", "QUOTED_STRING", diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.tokens b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.tokens index b11d74270411b..fb339c25a3492 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.tokens +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionLexer.tokens @@ -12,7 +12,7 @@ OWNER=11 GROUP=12 TAG=13 KIND=14 -REPO=15 +CODELOCATION=15 SINKS=16 ROOTS=17 QUOTED_STRING=18 @@ -32,6 +32,6 @@ WS=20 'group'=12 'tag'=13 'kind'=14 -'repo'=15 +'codelocation'=15 'sinks'=16 'roots'=17 diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionListener.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionListener.py index 1c76a1f896dfd..076b4d6c01fa1 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionListener.py +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionListener.py @@ -6,22 +6,20 @@ # This class defines a complete listener for a parse tree produced by AssetSelectionParser. class AssetSelectionListener(ParseTreeListener): - # Enter a parse tree produced by AssetSelectionParser#AssetExpression. - def enterAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): + # Enter a parse tree produced by AssetSelectionParser#start. + def enterStart(self, ctx: AssetSelectionParser.StartContext): pass - # Exit a parse tree produced by AssetSelectionParser#AssetExpression. - def exitAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): + # Exit a parse tree produced by AssetSelectionParser#start. + def exitStart(self, ctx: AssetSelectionParser.StartContext): pass - # Enter a parse tree produced by AssetSelectionParser#BothTraversalExpression. - def enterBothTraversalExpression( - self, ctx: AssetSelectionParser.BothTraversalExpressionContext - ): + # Enter a parse tree produced by AssetSelectionParser#AssetExpression. + def enterAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): pass - # Exit a parse tree produced by AssetSelectionParser#BothTraversalExpression. - def exitBothTraversalExpression(self, ctx: AssetSelectionParser.BothTraversalExpressionContext): + # Exit a parse tree produced by AssetSelectionParser#AssetExpression. + def exitAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): pass # Enter a parse tree produced by AssetSelectionParser#ParenthesizedExpression. @@ -34,32 +32,20 @@ def enterParenthesizedExpression( def exitParenthesizedExpression(self, ctx: AssetSelectionParser.ParenthesizedExpressionContext): pass - # Enter a parse tree produced by AssetSelectionParser#AndExpression. - def enterAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): + # Enter a parse tree produced by AssetSelectionParser#UpTraversalExpression. + def enterUpTraversalExpression(self, ctx: AssetSelectionParser.UpTraversalExpressionContext): pass - # Exit a parse tree produced by AssetSelectionParser#AndExpression. - def exitAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): + # Exit a parse tree produced by AssetSelectionParser#UpTraversalExpression. + def exitUpTraversalExpression(self, ctx: AssetSelectionParser.UpTraversalExpressionContext): pass - # Enter a parse tree produced by AssetSelectionParser#RightTraversalExpression. - def enterRightTraversalExpression( - self, ctx: AssetSelectionParser.RightTraversalExpressionContext - ): - pass - - # Exit a parse tree produced by AssetSelectionParser#RightTraversalExpression. - def exitRightTraversalExpression( - self, ctx: AssetSelectionParser.RightTraversalExpressionContext - ): - pass - - # Enter a parse tree produced by AssetSelectionParser#KeyValueExpression. - def enterKeyValueExpression(self, ctx: AssetSelectionParser.KeyValueExpressionContext): + # Enter a parse tree produced by AssetSelectionParser#AndExpression. + def enterAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): pass - # Exit a parse tree produced by AssetSelectionParser#KeyValueExpression. - def exitKeyValueExpression(self, ctx: AssetSelectionParser.KeyValueExpressionContext): + # Exit a parse tree produced by AssetSelectionParser#AndExpression. + def exitAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): pass # Enter a parse tree produced by AssetSelectionParser#NotExpression. @@ -70,14 +56,14 @@ def enterNotExpression(self, ctx: AssetSelectionParser.NotExpressionContext): def exitNotExpression(self, ctx: AssetSelectionParser.NotExpressionContext): pass - # Enter a parse tree produced by AssetSelectionParser#LeftTraversalExpression. - def enterLeftTraversalExpression( - self, ctx: AssetSelectionParser.LeftTraversalExpressionContext + # Enter a parse tree produced by AssetSelectionParser#DownTraversalExpression. + def enterDownTraversalExpression( + self, ctx: AssetSelectionParser.DownTraversalExpressionContext ): pass - # Exit a parse tree produced by AssetSelectionParser#LeftTraversalExpression. - def exitLeftTraversalExpression(self, ctx: AssetSelectionParser.LeftTraversalExpressionContext): + # Exit a parse tree produced by AssetSelectionParser#DownTraversalExpression. + def exitDownTraversalExpression(self, ctx: AssetSelectionParser.DownTraversalExpressionContext): pass # Enter a parse tree produced by AssetSelectionParser#OrExpression. @@ -88,6 +74,14 @@ def enterOrExpression(self, ctx: AssetSelectionParser.OrExpressionContext): def exitOrExpression(self, ctx: AssetSelectionParser.OrExpressionContext): pass + # Enter a parse tree produced by AssetSelectionParser#AttributeExpression. + def enterAttributeExpression(self, ctx: AssetSelectionParser.AttributeExpressionContext): + pass + + # Exit a parse tree produced by AssetSelectionParser#AttributeExpression. + def exitAttributeExpression(self, ctx: AssetSelectionParser.AttributeExpressionContext): + pass + # Enter a parse tree produced by AssetSelectionParser#FunctionCallExpression. def enterFunctionCallExpression(self, ctx: AssetSelectionParser.FunctionCallExpressionContext): pass @@ -96,6 +90,18 @@ def enterFunctionCallExpression(self, ctx: AssetSelectionParser.FunctionCallExpr def exitFunctionCallExpression(self, ctx: AssetSelectionParser.FunctionCallExpressionContext): pass + # Enter a parse tree produced by AssetSelectionParser#UpAndDownTraversalExpression. + def enterUpAndDownTraversalExpression( + self, ctx: AssetSelectionParser.UpAndDownTraversalExpressionContext + ): + pass + + # Exit a parse tree produced by AssetSelectionParser#UpAndDownTraversalExpression. + def exitUpAndDownTraversalExpression( + self, ctx: AssetSelectionParser.UpAndDownTraversalExpressionContext + ): + pass + # Enter a parse tree produced by AssetSelectionParser#traversal. def enterTraversal(self, ctx: AssetSelectionParser.TraversalContext): pass @@ -112,44 +118,48 @@ def enterFunctionName(self, ctx: AssetSelectionParser.FunctionNameContext): def exitFunctionName(self, ctx: AssetSelectionParser.FunctionNameContext): pass - # Enter a parse tree produced by AssetSelectionParser#TagKeyValuePair. - def enterTagKeyValuePair(self, ctx: AssetSelectionParser.TagKeyValuePairContext): + # Enter a parse tree produced by AssetSelectionParser#TagAttributeExpr. + def enterTagAttributeExpr(self, ctx: AssetSelectionParser.TagAttributeExprContext): pass - # Exit a parse tree produced by AssetSelectionParser#TagKeyValuePair. - def exitTagKeyValuePair(self, ctx: AssetSelectionParser.TagKeyValuePairContext): + # Exit a parse tree produced by AssetSelectionParser#TagAttributeExpr. + def exitTagAttributeExpr(self, ctx: AssetSelectionParser.TagAttributeExprContext): pass - # Enter a parse tree produced by AssetSelectionParser#OwnerKeyValuePair. - def enterOwnerKeyValuePair(self, ctx: AssetSelectionParser.OwnerKeyValuePairContext): + # Enter a parse tree produced by AssetSelectionParser#OwnerAttributeExpr. + def enterOwnerAttributeExpr(self, ctx: AssetSelectionParser.OwnerAttributeExprContext): pass - # Exit a parse tree produced by AssetSelectionParser#OwnerKeyValuePair. - def exitOwnerKeyValuePair(self, ctx: AssetSelectionParser.OwnerKeyValuePairContext): + # Exit a parse tree produced by AssetSelectionParser#OwnerAttributeExpr. + def exitOwnerAttributeExpr(self, ctx: AssetSelectionParser.OwnerAttributeExprContext): pass - # Enter a parse tree produced by AssetSelectionParser#GroupKeyValuePair. - def enterGroupKeyValuePair(self, ctx: AssetSelectionParser.GroupKeyValuePairContext): + # Enter a parse tree produced by AssetSelectionParser#GroupAttributeExpr. + def enterGroupAttributeExpr(self, ctx: AssetSelectionParser.GroupAttributeExprContext): pass - # Exit a parse tree produced by AssetSelectionParser#GroupKeyValuePair. - def exitGroupKeyValuePair(self, ctx: AssetSelectionParser.GroupKeyValuePairContext): + # Exit a parse tree produced by AssetSelectionParser#GroupAttributeExpr. + def exitGroupAttributeExpr(self, ctx: AssetSelectionParser.GroupAttributeExprContext): pass - # Enter a parse tree produced by AssetSelectionParser#KindKeyValuePair. - def enterKindKeyValuePair(self, ctx: AssetSelectionParser.KindKeyValuePairContext): + # Enter a parse tree produced by AssetSelectionParser#KindAttributeExpr. + def enterKindAttributeExpr(self, ctx: AssetSelectionParser.KindAttributeExprContext): pass - # Exit a parse tree produced by AssetSelectionParser#KindKeyValuePair. - def exitKindKeyValuePair(self, ctx: AssetSelectionParser.KindKeyValuePairContext): + # Exit a parse tree produced by AssetSelectionParser#KindAttributeExpr. + def exitKindAttributeExpr(self, ctx: AssetSelectionParser.KindAttributeExprContext): pass - # Enter a parse tree produced by AssetSelectionParser#RepoKeyValuePair. - def enterRepoKeyValuePair(self, ctx: AssetSelectionParser.RepoKeyValuePairContext): + # Enter a parse tree produced by AssetSelectionParser#CodeLocationAttributeExpr. + def enterCodeLocationAttributeExpr( + self, ctx: AssetSelectionParser.CodeLocationAttributeExprContext + ): pass - # Exit a parse tree produced by AssetSelectionParser#RepoKeyValuePair. - def exitRepoKeyValuePair(self, ctx: AssetSelectionParser.RepoKeyValuePairContext): + # Exit a parse tree produced by AssetSelectionParser#CodeLocationAttributeExpr. + def exitCodeLocationAttributeExpr( + self, ctx: AssetSelectionParser.CodeLocationAttributeExprContext + ): pass # Enter a parse tree produced by AssetSelectionParser#value. diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionParser.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionParser.py index 573d6ab5c6d3d..4b7d448cf2a8d 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionParser.py +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionParser.py @@ -13,7 +13,7 @@ def serializedATN(): 4, 1, 20, - 86, + 91, 2, 0, 7, @@ -38,6 +38,10 @@ def serializedATN(): 5, 7, 5, + 2, + 6, + 7, + 6, 1, 0, 1, @@ -45,166 +49,173 @@ def serializedATN(): 1, 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, 3, - 0, - 34, + 1, + 39, 8, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, 1, - 0, - 5, - 0, - 44, - 8, - 0, - 10, - 0, - 12, - 0, - 47, - 9, - 0, 1, 1, 1, 1, - 4, 1, - 51, + 1, + 1, + 1, + 1, + 5, + 1, + 49, 8, 1, - 11, + 10, 1, 12, 1, 52, - 3, - 1, - 55, - 8, + 9, 1, 1, 2, 1, 2, - 1, + 4, + 2, + 56, + 8, + 2, + 11, + 2, + 12, + 2, + 57, 3, + 2, + 60, + 8, + 2, 1, 3, 1, 3, 1, - 3, + 4, 1, - 3, - 3, - 3, - 64, - 8, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, + 4, 3, + 4, + 69, + 8, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, + 4, 1, - 3, - 3, - 3, - 78, - 8, - 3, + 4, 1, 4, 1, 4, 1, + 4, + 3, + 4, + 83, + 8, + 4, + 1, 5, 1, 5, + 1, + 6, + 1, + 6, 3, - 5, - 84, + 6, + 89, 8, - 5, + 6, 1, - 5, + 6, 0, 1, - 0, - 6, + 2, + 7, 0, 2, 4, 6, 8, 10, + 12, 0, 2, 1, @@ -215,592 +226,616 @@ def serializedATN(): 0, 18, 19, - 96, + 100, 0, - 33, + 14, 1, 0, 0, 0, 2, - 54, + 38, 1, 0, 0, 0, 4, - 56, + 59, 1, 0, 0, 0, 6, - 77, + 61, 1, 0, 0, 0, 8, - 79, + 82, 1, 0, 0, 0, 10, - 83, + 84, 1, 0, 0, 0, 12, - 13, - 6, + 88, + 1, 0, - -1, 0, - 13, - 34, - 3, - 10, - 5, 0, 14, - 34, - 3, - 6, - 3, - 0, 15, - 16, 3, 2, 1, 0, + 15, 16, - 17, - 3, + 5, 0, 0, - 8, - 17, - 34, + 1, + 16, + 1, 1, 0, 0, 0, + 17, 18, - 19, - 3, - 2, + 6, 1, + -1, 0, - 19, - 20, + 18, + 39, 3, + 12, + 6, 0, - 0, + 19, + 39, + 3, + 8, + 4, 0, 20, 21, 3, + 4, 2, - 1, 0, 21, - 34, + 22, + 3, + 2, 1, - 0, - 0, - 0, + 8, 22, - 23, - 5, - 4, + 39, + 1, + 0, 0, 0, 23, - 34, + 24, 3, + 4, + 2, 0, - 0, - 5, 24, 25, 3, - 4, 2, + 1, 0, 25, 26, - 5, - 8, - 0, + 3, + 4, + 2, 0, 26, - 27, - 3, + 39, + 1, 0, 0, 0, 27, 28, 5, - 9, + 4, 0, 0, 28, - 34, + 39, + 3, + 2, 1, - 0, - 0, - 0, + 5, 29, 30, + 3, + 6, + 3, + 0, + 30, + 31, 5, 8, 0, 0, - 30, 31, + 32, 3, + 2, + 1, 0, - 0, - 0, - 31, 32, + 33, 5, 9, 0, 0, - 32, + 33, + 39, + 1, + 0, + 0, + 0, 34, + 35, + 5, + 8, + 0, + 0, + 35, + 36, + 3, + 2, 1, 0, + 36, + 37, + 5, + 9, 0, 0, - 33, - 12, + 37, + 39, 1, 0, 0, 0, - 33, - 14, + 38, + 17, 1, 0, 0, 0, - 33, - 15, + 38, + 19, 1, 0, 0, 0, - 33, - 18, + 38, + 20, 1, 0, 0, 0, - 33, - 22, + 38, + 23, 1, 0, 0, 0, - 33, - 24, + 38, + 27, 1, 0, 0, 0, - 33, + 38, 29, 1, 0, 0, 0, - 34, - 45, + 38, + 34, + 1, + 0, + 0, + 0, + 39, + 50, 1, 0, 0, 0, - 35, - 36, + 40, + 41, 10, 4, 0, 0, - 36, - 37, + 41, + 42, 5, 2, 0, 0, - 37, - 44, + 42, + 49, 3, - 0, - 0, + 2, + 1, 5, - 38, - 39, + 43, + 44, 10, 3, 0, 0, - 39, - 40, + 44, + 45, 5, 3, 0, 0, - 40, - 44, + 45, + 49, 3, - 0, - 0, + 2, + 1, 4, - 41, - 42, + 46, + 47, 10, 6, 0, 0, - 42, - 44, + 47, + 49, 3, + 4, 2, - 1, 0, - 43, - 35, + 48, + 40, 1, 0, 0, 0, + 48, 43, - 38, 1, 0, 0, 0, - 43, - 41, + 48, + 46, 1, 0, 0, 0, - 44, - 47, + 49, + 52, 1, 0, 0, 0, - 45, - 43, + 50, + 48, 1, 0, 0, 0, - 45, - 46, + 50, + 51, 1, 0, 0, 0, - 46, - 1, + 51, + 3, 1, 0, 0, 0, - 47, - 45, + 52, + 50, 1, 0, 0, 0, - 48, - 55, + 53, + 60, 5, 5, 0, 0, - 49, - 51, + 54, + 56, 5, 6, 0, 0, - 50, - 49, + 55, + 54, 1, 0, 0, 0, - 51, - 52, + 56, + 57, 1, 0, 0, 0, - 52, - 50, + 57, + 55, 1, 0, 0, 0, - 52, - 53, + 57, + 58, 1, 0, 0, 0, - 53, - 55, + 58, + 60, 1, 0, 0, 0, - 54, - 48, + 59, + 53, 1, 0, 0, 0, - 54, - 50, + 59, + 55, 1, 0, 0, 0, - 55, - 3, + 60, + 5, 1, 0, 0, 0, - 56, - 57, + 61, + 62, 7, 0, 0, 0, - 57, - 5, + 62, + 7, 1, 0, 0, 0, - 58, - 59, + 63, + 64, 5, 13, 0, 0, - 59, - 60, + 64, + 65, 5, 7, 0, 0, - 60, - 63, + 65, + 68, 3, - 8, - 4, + 10, + 5, 0, - 61, - 62, + 66, + 67, 5, 1, 0, 0, - 62, - 64, + 67, + 69, 3, - 8, - 4, + 10, + 5, 0, - 63, - 61, + 68, + 66, 1, 0, 0, 0, - 63, - 64, + 68, + 69, 1, 0, 0, 0, - 64, - 78, + 69, + 83, 1, 0, 0, 0, - 65, - 66, + 70, + 71, 5, 11, 0, 0, - 66, - 67, + 71, + 72, 5, 7, 0, 0, - 67, - 78, + 72, + 83, 3, - 8, - 4, + 10, + 5, 0, - 68, - 69, + 73, + 74, 5, 12, 0, 0, - 69, - 70, + 74, + 75, 5, 7, 0, 0, - 70, - 78, + 75, + 83, 3, - 8, - 4, + 10, + 5, 0, - 71, - 72, + 76, + 77, 5, 14, 0, 0, - 72, - 73, + 77, + 78, 5, 7, 0, 0, - 73, 78, + 83, 3, - 8, - 4, + 10, + 5, 0, - 74, - 75, + 79, + 80, 5, 15, 0, 0, - 75, - 76, + 80, + 81, 5, 7, 0, 0, - 76, - 78, + 81, + 83, 3, - 8, - 4, + 10, + 5, 0, - 77, - 58, + 82, + 63, 1, 0, 0, 0, - 77, - 65, + 82, + 70, 1, 0, 0, 0, - 77, - 68, + 82, + 73, 1, 0, 0, 0, - 77, - 71, + 82, + 76, 1, 0, 0, 0, - 77, - 74, + 82, + 79, 1, 0, 0, 0, - 78, - 7, + 83, + 9, 1, 0, 0, 0, - 79, - 80, + 84, + 85, 7, 1, 0, - 0, - 80, - 9, + 0, + 85, + 11, 1, 0, 0, 0, - 81, - 84, + 86, + 89, 5, 18, 0, 0, - 82, - 84, + 87, + 89, 5, 19, 0, 0, - 83, - 81, + 88, + 86, 1, 0, 0, 0, - 83, - 82, + 88, + 87, 1, 0, 0, 0, - 84, - 11, + 89, + 13, 1, 0, 0, 0, 8, - 33, - 43, - 45, - 52, - 54, - 63, - 77, - 83, + 38, + 48, + 50, + 57, + 59, + 68, + 82, + 88, ] @@ -829,7 +864,7 @@ class AssetSelectionParser(Parser): "'group'", "'tag'", "'kind'", - "'repo'", + "'codelocation'", "'sinks'", "'roots'", ] @@ -850,7 +885,7 @@ class AssetSelectionParser(Parser): "GROUP", "TAG", "KIND", - "REPO", + "CODELOCATION", "SINKS", "ROOTS", "QUOTED_STRING", @@ -858,14 +893,23 @@ class AssetSelectionParser(Parser): "WS", ] - RULE_expr = 0 - RULE_traversal = 1 - RULE_functionName = 2 - RULE_keyValueExpr = 3 - RULE_value = 4 - RULE_assetExpr = 5 - - ruleNames = ["expr", "traversal", "functionName", "keyValueExpr", "value", "assetExpr"] + RULE_start = 0 + RULE_expr = 1 + RULE_traversal = 2 + RULE_functionName = 3 + RULE_attributeExpr = 4 + RULE_value = 5 + RULE_assetExpr = 6 + + ruleNames = [ + "start", + "expr", + "traversal", + "functionName", + "attributeExpr", + "value", + "assetExpr", + ] EOF = Token.EOF EQUAL = 1 @@ -882,7 +926,7 @@ class AssetSelectionParser(Parser): GROUP = 12 TAG = 13 KIND = 14 - REPO = 15 + CODELOCATION = 15 SINKS = 16 ROOTS = 17 QUOTED_STRING = 18 @@ -897,6 +941,53 @@ def __init__(self, input: TokenStream, output: TextIO = sys.stdout): ) self._predicates = None + class StartContext(ParserRuleContext): + __slots__ = "parser" + + def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): + super().__init__(parent, invokingState) + self.parser = parser + + def expr(self): + return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) + + def EOF(self): + return self.getToken(AssetSelectionParser.EOF, 0) + + def getRuleIndex(self): + return AssetSelectionParser.RULE_start + + def enterRule(self, listener: ParseTreeListener): + if hasattr(listener, "enterStart"): + listener.enterStart(self) + + def exitRule(self, listener: ParseTreeListener): + if hasattr(listener, "exitStart"): + listener.exitStart(self) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitStart"): + return visitor.visitStart(self) + else: + return visitor.visitChildren(self) + + def start(self): + localctx = AssetSelectionParser.StartContext(self, self._ctx, self.state) + self.enterRule(localctx, 0, self.RULE_start) + try: + self.enterOuterAlt(localctx, 1) + self.state = 14 + self.expr(0) + self.state = 15 + self.match(AssetSelectionParser.EOF) + except RecognitionException as re: + localctx.exception = re + self._errHandler.reportError(self, re) + self._errHandler.recover(self, re) + finally: + self.exitRule() + return localctx + class ExprContext(ParserRuleContext): __slots__ = "parser" @@ -934,63 +1025,60 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) - class BothTraversalExpressionContext(ExprContext): + class ParenthesizedExpressionContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a AssetSelectionParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def traversal(self, i: int = None): - if i is None: - return self.getTypedRuleContexts(AssetSelectionParser.TraversalContext) - else: - return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, i) + def LPAREN(self): + return self.getToken(AssetSelectionParser.LPAREN, 0) def expr(self): return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) + def RPAREN(self): + return self.getToken(AssetSelectionParser.RPAREN, 0) + def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterBothTraversalExpression"): - listener.enterBothTraversalExpression(self) + if hasattr(listener, "enterParenthesizedExpression"): + listener.enterParenthesizedExpression(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitBothTraversalExpression"): - listener.exitBothTraversalExpression(self) + if hasattr(listener, "exitParenthesizedExpression"): + listener.exitParenthesizedExpression(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitBothTraversalExpression"): - return visitor.visitBothTraversalExpression(self) + if hasattr(visitor, "visitParenthesizedExpression"): + return visitor.visitParenthesizedExpression(self) else: return visitor.visitChildren(self) - class ParenthesizedExpressionContext(ExprContext): + class UpTraversalExpressionContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a AssetSelectionParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def LPAREN(self): - return self.getToken(AssetSelectionParser.LPAREN, 0) + def traversal(self): + return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, 0) def expr(self): return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) - def RPAREN(self): - return self.getToken(AssetSelectionParser.RPAREN, 0) - def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterParenthesizedExpression"): - listener.enterParenthesizedExpression(self) + if hasattr(listener, "enterUpTraversalExpression"): + listener.enterUpTraversalExpression(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitParenthesizedExpression"): - listener.exitParenthesizedExpression(self) + if hasattr(listener, "exitUpTraversalExpression"): + listener.exitUpTraversalExpression(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitParenthesizedExpression"): - return visitor.visitParenthesizedExpression(self) + if hasattr(visitor, "visitUpTraversalExpression"): + return visitor.visitUpTraversalExpression(self) else: return visitor.visitChildren(self) @@ -1024,57 +1112,6 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) - class RightTraversalExpressionContext(ExprContext): - def __init__( - self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.ExprContext - super().__init__(parser) - self.copyFrom(ctx) - - def expr(self): - return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) - - def traversal(self): - return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, 0) - - def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterRightTraversalExpression"): - listener.enterRightTraversalExpression(self) - - def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitRightTraversalExpression"): - listener.exitRightTraversalExpression(self) - - def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitRightTraversalExpression"): - return visitor.visitRightTraversalExpression(self) - else: - return visitor.visitChildren(self) - - class KeyValueExpressionContext(ExprContext): - def __init__( - self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.ExprContext - super().__init__(parser) - self.copyFrom(ctx) - - def keyValueExpr(self): - return self.getTypedRuleContext(AssetSelectionParser.KeyValueExprContext, 0) - - def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterKeyValueExpression"): - listener.enterKeyValueExpression(self) - - def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitKeyValueExpression"): - listener.exitKeyValueExpression(self) - - def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitKeyValueExpression"): - return visitor.visitKeyValueExpression(self) - else: - return visitor.visitChildren(self) - class NotExpressionContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext @@ -1102,30 +1139,30 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) - class LeftTraversalExpressionContext(ExprContext): + class DownTraversalExpressionContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext ): # actually a AssetSelectionParser.ExprContext super().__init__(parser) self.copyFrom(ctx) - def traversal(self): - return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, 0) - def expr(self): return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) + def traversal(self): + return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, 0) + def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterLeftTraversalExpression"): - listener.enterLeftTraversalExpression(self) + if hasattr(listener, "enterDownTraversalExpression"): + listener.enterDownTraversalExpression(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitLeftTraversalExpression"): - listener.exitLeftTraversalExpression(self) + if hasattr(listener, "exitDownTraversalExpression"): + listener.exitDownTraversalExpression(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitLeftTraversalExpression"): - return visitor.visitLeftTraversalExpression(self) + if hasattr(visitor, "visitDownTraversalExpression"): + return visitor.visitDownTraversalExpression(self) else: return visitor.visitChildren(self) @@ -1159,6 +1196,30 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) + class AttributeExpressionContext(ExprContext): + def __init__( + self, parser, ctx: ParserRuleContext + ): # actually a AssetSelectionParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def attributeExpr(self): + return self.getTypedRuleContext(AssetSelectionParser.AttributeExprContext, 0) + + def enterRule(self, listener: ParseTreeListener): + if hasattr(listener, "enterAttributeExpression"): + listener.enterAttributeExpression(self) + + def exitRule(self, listener: ParseTreeListener): + if hasattr(listener, "exitAttributeExpression"): + listener.exitAttributeExpression(self) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitAttributeExpression"): + return visitor.visitAttributeExpression(self) + else: + return visitor.visitChildren(self) + class FunctionCallExpressionContext(ExprContext): def __init__( self, parser, ctx: ParserRuleContext @@ -1192,16 +1253,46 @@ def accept(self, visitor: ParseTreeVisitor): else: return visitor.visitChildren(self) + class UpAndDownTraversalExpressionContext(ExprContext): + def __init__( + self, parser, ctx: ParserRuleContext + ): # actually a AssetSelectionParser.ExprContext + super().__init__(parser) + self.copyFrom(ctx) + + def traversal(self, i: int = None): + if i is None: + return self.getTypedRuleContexts(AssetSelectionParser.TraversalContext) + else: + return self.getTypedRuleContext(AssetSelectionParser.TraversalContext, i) + + def expr(self): + return self.getTypedRuleContext(AssetSelectionParser.ExprContext, 0) + + def enterRule(self, listener: ParseTreeListener): + if hasattr(listener, "enterUpAndDownTraversalExpression"): + listener.enterUpAndDownTraversalExpression(self) + + def exitRule(self, listener: ParseTreeListener): + if hasattr(listener, "exitUpAndDownTraversalExpression"): + listener.exitUpAndDownTraversalExpression(self) + + def accept(self, visitor: ParseTreeVisitor): + if hasattr(visitor, "visitUpAndDownTraversalExpression"): + return visitor.visitUpAndDownTraversalExpression(self) + else: + return visitor.visitChildren(self) + def expr(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = AssetSelectionParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx - _startState = 0 - self.enterRecursionRule(localctx, 0, self.RULE_expr, _p) + _startState = 2 + self.enterRecursionRule(localctx, 2, self.RULE_expr, _p) try: self.enterOuterAlt(localctx, 1) - self.state = 33 + self.state = 38 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 0, self._ctx) if la_ == 1: @@ -1209,37 +1300,37 @@ def expr(self, _p: int = 0): self._ctx = localctx _prevctx = localctx - self.state = 13 + self.state = 18 self.assetExpr() pass elif la_ == 2: - localctx = AssetSelectionParser.KeyValueExpressionContext(self, localctx) + localctx = AssetSelectionParser.AttributeExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 14 - self.keyValueExpr() + self.state = 19 + self.attributeExpr() pass elif la_ == 3: - localctx = AssetSelectionParser.LeftTraversalExpressionContext(self, localctx) + localctx = AssetSelectionParser.UpTraversalExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 15 + self.state = 20 self.traversal() - self.state = 16 + self.state = 21 self.expr(8) pass elif la_ == 4: - localctx = AssetSelectionParser.BothTraversalExpressionContext(self, localctx) + localctx = AssetSelectionParser.UpAndDownTraversalExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 18 + self.state = 23 self.traversal() - self.state = 19 + self.state = 24 self.expr(0) - self.state = 20 + self.state = 25 self.traversal() pass @@ -1247,9 +1338,9 @@ def expr(self, _p: int = 0): localctx = AssetSelectionParser.NotExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 22 + self.state = 27 self.match(AssetSelectionParser.NOT) - self.state = 23 + self.state = 28 self.expr(5) pass @@ -1257,13 +1348,13 @@ def expr(self, _p: int = 0): localctx = AssetSelectionParser.FunctionCallExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 24 + self.state = 29 self.functionName() - self.state = 25 + self.state = 30 self.match(AssetSelectionParser.LPAREN) - self.state = 26 + self.state = 31 self.expr(0) - self.state = 27 + self.state = 32 self.match(AssetSelectionParser.RPAREN) pass @@ -1271,16 +1362,16 @@ def expr(self, _p: int = 0): localctx = AssetSelectionParser.ParenthesizedExpressionContext(self, localctx) self._ctx = localctx _prevctx = localctx - self.state = 29 + self.state = 34 self.match(AssetSelectionParser.LPAREN) - self.state = 30 + self.state = 35 self.expr(0) - self.state = 31 + self.state = 36 self.match(AssetSelectionParser.RPAREN) pass self._ctx.stop = self._input.LT(-1) - self.state = 45 + self.state = 50 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: @@ -1288,7 +1379,7 @@ def expr(self, _p: int = 0): if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx - self.state = 43 + self.state = 48 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 1, self._ctx) if la_ == 1: @@ -1296,14 +1387,14 @@ def expr(self, _p: int = 0): self, AssetSelectionParser.ExprContext(self, _parentctx, _parentState) ) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) - self.state = 35 + self.state = 40 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") - self.state = 36 + self.state = 41 self.match(AssetSelectionParser.AND) - self.state = 37 + self.state = 42 self.expr(5) pass @@ -1312,32 +1403,32 @@ def expr(self, _p: int = 0): self, AssetSelectionParser.ExprContext(self, _parentctx, _parentState) ) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) - self.state = 38 + self.state = 43 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") - self.state = 39 + self.state = 44 self.match(AssetSelectionParser.OR) - self.state = 40 + self.state = 45 self.expr(4) pass elif la_ == 3: - localctx = AssetSelectionParser.RightTraversalExpressionContext( + localctx = AssetSelectionParser.DownTraversalExpressionContext( self, AssetSelectionParser.ExprContext(self, _parentctx, _parentState) ) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) - self.state = 41 + self.state = 46 if not self.precpred(self._ctx, 6): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 6)") - self.state = 42 + self.state = 47 self.traversal() pass - self.state = 47 + self.state = 52 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) @@ -1384,29 +1475,29 @@ def accept(self, visitor: ParseTreeVisitor): def traversal(self): localctx = AssetSelectionParser.TraversalContext(self, self._ctx, self.state) - self.enterRule(localctx, 2, self.RULE_traversal) + self.enterRule(localctx, 4, self.RULE_traversal) try: - self.state = 54 + self.state = 59 self._errHandler.sync(self) token = self._input.LA(1) if token in [5]: self.enterOuterAlt(localctx, 1) - self.state = 48 + self.state = 53 self.match(AssetSelectionParser.STAR) pass elif token in [6]: self.enterOuterAlt(localctx, 2) - self.state = 50 + self.state = 55 self._errHandler.sync(self) _alt = 1 while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: - self.state = 49 + self.state = 54 self.match(AssetSelectionParser.PLUS) else: raise NoViableAltException(self) - self.state = 52 + self.state = 57 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) @@ -1454,11 +1545,11 @@ def accept(self, visitor: ParseTreeVisitor): def functionName(self): localctx = AssetSelectionParser.FunctionNameContext(self, self._ctx, self.state) - self.enterRule(localctx, 4, self.RULE_functionName) + self.enterRule(localctx, 6, self.RULE_functionName) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 56 + self.state = 61 _la = self._input.LA(1) if not (_la == 16 or _la == 17): self._errHandler.recoverInline(self) @@ -1473,7 +1564,7 @@ def functionName(self): self.exitRule() return localctx - class KeyValueExprContext(ParserRuleContext): + class AttributeExprContext(ParserRuleContext): __slots__ = "parser" def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int = -1): @@ -1481,20 +1572,20 @@ def __init__(self, parser, parent: ParserRuleContext = None, invokingState: int self.parser = parser def getRuleIndex(self): - return AssetSelectionParser.RULE_keyValueExpr + return AssetSelectionParser.RULE_attributeExpr def copyFrom(self, ctx: ParserRuleContext): super().copyFrom(ctx) - class RepoKeyValuePairContext(KeyValueExprContext): + class GroupAttributeExprContext(AttributeExprContext): def __init__( self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.KeyValueExprContext + ): # actually a AssetSelectionParser.AttributeExprContext super().__init__(parser) self.copyFrom(ctx) - def REPO(self): - return self.getToken(AssetSelectionParser.REPO, 0) + def GROUP(self): + return self.getToken(AssetSelectionParser.GROUP, 0) def COLON(self): return self.getToken(AssetSelectionParser.COLON, 0) @@ -1503,58 +1594,64 @@ def value(self): return self.getTypedRuleContext(AssetSelectionParser.ValueContext, 0) def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterRepoKeyValuePair"): - listener.enterRepoKeyValuePair(self) + if hasattr(listener, "enterGroupAttributeExpr"): + listener.enterGroupAttributeExpr(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitRepoKeyValuePair"): - listener.exitRepoKeyValuePair(self) + if hasattr(listener, "exitGroupAttributeExpr"): + listener.exitGroupAttributeExpr(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitRepoKeyValuePair"): - return visitor.visitRepoKeyValuePair(self) + if hasattr(visitor, "visitGroupAttributeExpr"): + return visitor.visitGroupAttributeExpr(self) else: return visitor.visitChildren(self) - class GroupKeyValuePairContext(KeyValueExprContext): + class TagAttributeExprContext(AttributeExprContext): def __init__( self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.KeyValueExprContext + ): # actually a AssetSelectionParser.AttributeExprContext super().__init__(parser) self.copyFrom(ctx) - def GROUP(self): - return self.getToken(AssetSelectionParser.GROUP, 0) + def TAG(self): + return self.getToken(AssetSelectionParser.TAG, 0) def COLON(self): return self.getToken(AssetSelectionParser.COLON, 0) - def value(self): - return self.getTypedRuleContext(AssetSelectionParser.ValueContext, 0) + def value(self, i: int = None): + if i is None: + return self.getTypedRuleContexts(AssetSelectionParser.ValueContext) + else: + return self.getTypedRuleContext(AssetSelectionParser.ValueContext, i) + + def EQUAL(self): + return self.getToken(AssetSelectionParser.EQUAL, 0) def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterGroupKeyValuePair"): - listener.enterGroupKeyValuePair(self) + if hasattr(listener, "enterTagAttributeExpr"): + listener.enterTagAttributeExpr(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitGroupKeyValuePair"): - listener.exitGroupKeyValuePair(self) + if hasattr(listener, "exitTagAttributeExpr"): + listener.exitTagAttributeExpr(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitGroupKeyValuePair"): - return visitor.visitGroupKeyValuePair(self) + if hasattr(visitor, "visitTagAttributeExpr"): + return visitor.visitTagAttributeExpr(self) else: return visitor.visitChildren(self) - class OwnerKeyValuePairContext(KeyValueExprContext): + class KindAttributeExprContext(AttributeExprContext): def __init__( self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.KeyValueExprContext + ): # actually a AssetSelectionParser.AttributeExprContext super().__init__(parser) self.copyFrom(ctx) - def OWNER(self): - return self.getToken(AssetSelectionParser.OWNER, 0) + def KIND(self): + return self.getToken(AssetSelectionParser.KIND, 0) def COLON(self): return self.getToken(AssetSelectionParser.COLON, 0) @@ -1563,64 +1660,58 @@ def value(self): return self.getTypedRuleContext(AssetSelectionParser.ValueContext, 0) def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterOwnerKeyValuePair"): - listener.enterOwnerKeyValuePair(self) + if hasattr(listener, "enterKindAttributeExpr"): + listener.enterKindAttributeExpr(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitOwnerKeyValuePair"): - listener.exitOwnerKeyValuePair(self) + if hasattr(listener, "exitKindAttributeExpr"): + listener.exitKindAttributeExpr(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitOwnerKeyValuePair"): - return visitor.visitOwnerKeyValuePair(self) + if hasattr(visitor, "visitKindAttributeExpr"): + return visitor.visitKindAttributeExpr(self) else: return visitor.visitChildren(self) - class TagKeyValuePairContext(KeyValueExprContext): + class CodeLocationAttributeExprContext(AttributeExprContext): def __init__( self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.KeyValueExprContext + ): # actually a AssetSelectionParser.AttributeExprContext super().__init__(parser) self.copyFrom(ctx) - def TAG(self): - return self.getToken(AssetSelectionParser.TAG, 0) + def CODELOCATION(self): + return self.getToken(AssetSelectionParser.CODELOCATION, 0) def COLON(self): return self.getToken(AssetSelectionParser.COLON, 0) - def value(self, i: int = None): - if i is None: - return self.getTypedRuleContexts(AssetSelectionParser.ValueContext) - else: - return self.getTypedRuleContext(AssetSelectionParser.ValueContext, i) - - def EQUAL(self): - return self.getToken(AssetSelectionParser.EQUAL, 0) + def value(self): + return self.getTypedRuleContext(AssetSelectionParser.ValueContext, 0) def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterTagKeyValuePair"): - listener.enterTagKeyValuePair(self) + if hasattr(listener, "enterCodeLocationAttributeExpr"): + listener.enterCodeLocationAttributeExpr(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitTagKeyValuePair"): - listener.exitTagKeyValuePair(self) + if hasattr(listener, "exitCodeLocationAttributeExpr"): + listener.exitCodeLocationAttributeExpr(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitTagKeyValuePair"): - return visitor.visitTagKeyValuePair(self) + if hasattr(visitor, "visitCodeLocationAttributeExpr"): + return visitor.visitCodeLocationAttributeExpr(self) else: return visitor.visitChildren(self) - class KindKeyValuePairContext(KeyValueExprContext): + class OwnerAttributeExprContext(AttributeExprContext): def __init__( self, parser, ctx: ParserRuleContext - ): # actually a AssetSelectionParser.KeyValueExprContext + ): # actually a AssetSelectionParser.AttributeExprContext super().__init__(parser) self.copyFrom(ctx) - def KIND(self): - return self.getToken(AssetSelectionParser.KIND, 0) + def OWNER(self): + return self.getToken(AssetSelectionParser.OWNER, 0) def COLON(self): return self.getToken(AssetSelectionParser.COLON, 0) @@ -1629,83 +1720,83 @@ def value(self): return self.getTypedRuleContext(AssetSelectionParser.ValueContext, 0) def enterRule(self, listener: ParseTreeListener): - if hasattr(listener, "enterKindKeyValuePair"): - listener.enterKindKeyValuePair(self) + if hasattr(listener, "enterOwnerAttributeExpr"): + listener.enterOwnerAttributeExpr(self) def exitRule(self, listener: ParseTreeListener): - if hasattr(listener, "exitKindKeyValuePair"): - listener.exitKindKeyValuePair(self) + if hasattr(listener, "exitOwnerAttributeExpr"): + listener.exitOwnerAttributeExpr(self) def accept(self, visitor: ParseTreeVisitor): - if hasattr(visitor, "visitKindKeyValuePair"): - return visitor.visitKindKeyValuePair(self) + if hasattr(visitor, "visitOwnerAttributeExpr"): + return visitor.visitOwnerAttributeExpr(self) else: return visitor.visitChildren(self) - def keyValueExpr(self): - localctx = AssetSelectionParser.KeyValueExprContext(self, self._ctx, self.state) - self.enterRule(localctx, 6, self.RULE_keyValueExpr) + def attributeExpr(self): + localctx = AssetSelectionParser.AttributeExprContext(self, self._ctx, self.state) + self.enterRule(localctx, 8, self.RULE_attributeExpr) try: - self.state = 77 + self.state = 82 self._errHandler.sync(self) token = self._input.LA(1) if token in [13]: - localctx = AssetSelectionParser.TagKeyValuePairContext(self, localctx) + localctx = AssetSelectionParser.TagAttributeExprContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 58 + self.state = 63 self.match(AssetSelectionParser.TAG) - self.state = 59 + self.state = 64 self.match(AssetSelectionParser.COLON) - self.state = 60 + self.state = 65 self.value() - self.state = 63 + self.state = 68 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 5, self._ctx) if la_ == 1: - self.state = 61 + self.state = 66 self.match(AssetSelectionParser.EQUAL) - self.state = 62 + self.state = 67 self.value() pass elif token in [11]: - localctx = AssetSelectionParser.OwnerKeyValuePairContext(self, localctx) + localctx = AssetSelectionParser.OwnerAttributeExprContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 65 + self.state = 70 self.match(AssetSelectionParser.OWNER) - self.state = 66 + self.state = 71 self.match(AssetSelectionParser.COLON) - self.state = 67 + self.state = 72 self.value() pass elif token in [12]: - localctx = AssetSelectionParser.GroupKeyValuePairContext(self, localctx) + localctx = AssetSelectionParser.GroupAttributeExprContext(self, localctx) self.enterOuterAlt(localctx, 3) - self.state = 68 + self.state = 73 self.match(AssetSelectionParser.GROUP) - self.state = 69 + self.state = 74 self.match(AssetSelectionParser.COLON) - self.state = 70 + self.state = 75 self.value() pass elif token in [14]: - localctx = AssetSelectionParser.KindKeyValuePairContext(self, localctx) + localctx = AssetSelectionParser.KindAttributeExprContext(self, localctx) self.enterOuterAlt(localctx, 4) - self.state = 71 + self.state = 76 self.match(AssetSelectionParser.KIND) - self.state = 72 + self.state = 77 self.match(AssetSelectionParser.COLON) - self.state = 73 + self.state = 78 self.value() pass elif token in [15]: - localctx = AssetSelectionParser.RepoKeyValuePairContext(self, localctx) + localctx = AssetSelectionParser.CodeLocationAttributeExprContext(self, localctx) self.enterOuterAlt(localctx, 5) - self.state = 74 - self.match(AssetSelectionParser.REPO) - self.state = 75 + self.state = 79 + self.match(AssetSelectionParser.CODELOCATION) + self.state = 80 self.match(AssetSelectionParser.COLON) - self.state = 76 + self.state = 81 self.value() pass else: @@ -1751,11 +1842,11 @@ def accept(self, visitor: ParseTreeVisitor): def value(self): localctx = AssetSelectionParser.ValueContext(self, self._ctx, self.state) - self.enterRule(localctx, 8, self.RULE_value) + self.enterRule(localctx, 10, self.RULE_value) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) - self.state = 79 + self.state = 84 _la = self._input.LA(1) if not (_la == 18 or _la == 19): self._errHandler.recoverInline(self) @@ -1833,21 +1924,21 @@ def accept(self, visitor: ParseTreeVisitor): def assetExpr(self): localctx = AssetSelectionParser.AssetExprContext(self, self._ctx, self.state) - self.enterRule(localctx, 10, self.RULE_assetExpr) + self.enterRule(localctx, 12, self.RULE_assetExpr) try: - self.state = 83 + self.state = 88 self._errHandler.sync(self) token = self._input.LA(1) if token in [18]: localctx = AssetSelectionParser.ExactMatchAssetContext(self, localctx) self.enterOuterAlt(localctx, 1) - self.state = 81 + self.state = 86 self.match(AssetSelectionParser.QUOTED_STRING) pass elif token in [19]: localctx = AssetSelectionParser.PrefixMatchAssetContext(self, localctx) self.enterOuterAlt(localctx, 2) - self.state = 82 + self.state = 87 self.match(AssetSelectionParser.UNQUOTED_STRING) pass else: @@ -1864,7 +1955,7 @@ def assetExpr(self): def sempred(self, localctx: RuleContext, ruleIndex: int, predIndex: int): if self._predicates == None: self._predicates = dict() - self._predicates[0] = self.expr_sempred + self._predicates[1] = self.expr_sempred pred = self._predicates.get(ruleIndex, None) if pred is None: raise Exception("No predicate with index:" + str(ruleIndex)) diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionVisitor.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionVisitor.py index 1c62ad2f4e495..0fdbd89562319 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionVisitor.py +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/AssetSelectionVisitor.py @@ -6,14 +6,12 @@ class AssetSelectionVisitor(ParseTreeVisitor): - # Visit a parse tree produced by AssetSelectionParser#AssetExpression. - def visitAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): + # Visit a parse tree produced by AssetSelectionParser#start. + def visitStart(self, ctx: AssetSelectionParser.StartContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#BothTraversalExpression. - def visitBothTraversalExpression( - self, ctx: AssetSelectionParser.BothTraversalExpressionContext - ): + # Visit a parse tree produced by AssetSelectionParser#AssetExpression. + def visitAssetExpression(self, ctx: AssetSelectionParser.AssetExpressionContext): return self.visitChildren(ctx) # Visit a parse tree produced by AssetSelectionParser#ParenthesizedExpression. @@ -22,27 +20,21 @@ def visitParenthesizedExpression( ): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#AndExpression. - def visitAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): - return self.visitChildren(ctx) - - # Visit a parse tree produced by AssetSelectionParser#RightTraversalExpression. - def visitRightTraversalExpression( - self, ctx: AssetSelectionParser.RightTraversalExpressionContext - ): + # Visit a parse tree produced by AssetSelectionParser#UpTraversalExpression. + def visitUpTraversalExpression(self, ctx: AssetSelectionParser.UpTraversalExpressionContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#KeyValueExpression. - def visitKeyValueExpression(self, ctx: AssetSelectionParser.KeyValueExpressionContext): + # Visit a parse tree produced by AssetSelectionParser#AndExpression. + def visitAndExpression(self, ctx: AssetSelectionParser.AndExpressionContext): return self.visitChildren(ctx) # Visit a parse tree produced by AssetSelectionParser#NotExpression. def visitNotExpression(self, ctx: AssetSelectionParser.NotExpressionContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#LeftTraversalExpression. - def visitLeftTraversalExpression( - self, ctx: AssetSelectionParser.LeftTraversalExpressionContext + # Visit a parse tree produced by AssetSelectionParser#DownTraversalExpression. + def visitDownTraversalExpression( + self, ctx: AssetSelectionParser.DownTraversalExpressionContext ): return self.visitChildren(ctx) @@ -50,10 +42,20 @@ def visitLeftTraversalExpression( def visitOrExpression(self, ctx: AssetSelectionParser.OrExpressionContext): return self.visitChildren(ctx) + # Visit a parse tree produced by AssetSelectionParser#AttributeExpression. + def visitAttributeExpression(self, ctx: AssetSelectionParser.AttributeExpressionContext): + return self.visitChildren(ctx) + # Visit a parse tree produced by AssetSelectionParser#FunctionCallExpression. def visitFunctionCallExpression(self, ctx: AssetSelectionParser.FunctionCallExpressionContext): return self.visitChildren(ctx) + # Visit a parse tree produced by AssetSelectionParser#UpAndDownTraversalExpression. + def visitUpAndDownTraversalExpression( + self, ctx: AssetSelectionParser.UpAndDownTraversalExpressionContext + ): + return self.visitChildren(ctx) + # Visit a parse tree produced by AssetSelectionParser#traversal. def visitTraversal(self, ctx: AssetSelectionParser.TraversalContext): return self.visitChildren(ctx) @@ -62,24 +64,26 @@ def visitTraversal(self, ctx: AssetSelectionParser.TraversalContext): def visitFunctionName(self, ctx: AssetSelectionParser.FunctionNameContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#TagKeyValuePair. - def visitTagKeyValuePair(self, ctx: AssetSelectionParser.TagKeyValuePairContext): + # Visit a parse tree produced by AssetSelectionParser#TagAttributeExpr. + def visitTagAttributeExpr(self, ctx: AssetSelectionParser.TagAttributeExprContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#OwnerKeyValuePair. - def visitOwnerKeyValuePair(self, ctx: AssetSelectionParser.OwnerKeyValuePairContext): + # Visit a parse tree produced by AssetSelectionParser#OwnerAttributeExpr. + def visitOwnerAttributeExpr(self, ctx: AssetSelectionParser.OwnerAttributeExprContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#GroupKeyValuePair. - def visitGroupKeyValuePair(self, ctx: AssetSelectionParser.GroupKeyValuePairContext): + # Visit a parse tree produced by AssetSelectionParser#GroupAttributeExpr. + def visitGroupAttributeExpr(self, ctx: AssetSelectionParser.GroupAttributeExprContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#KindKeyValuePair. - def visitKindKeyValuePair(self, ctx: AssetSelectionParser.KindKeyValuePairContext): + # Visit a parse tree produced by AssetSelectionParser#KindAttributeExpr. + def visitKindAttributeExpr(self, ctx: AssetSelectionParser.KindAttributeExprContext): return self.visitChildren(ctx) - # Visit a parse tree produced by AssetSelectionParser#RepoKeyValuePair. - def visitRepoKeyValuePair(self, ctx: AssetSelectionParser.RepoKeyValuePairContext): + # Visit a parse tree produced by AssetSelectionParser#CodeLocationAttributeExpr. + def visitCodeLocationAttributeExpr( + self, ctx: AssetSelectionParser.CodeLocationAttributeExprContext + ): return self.visitChildren(ctx) # Visit a parse tree produced by AssetSelectionParser#value. diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/antlr_asset_selection.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/antlr_asset_selection.py new file mode 100644 index 0000000000000..41749eba6477e --- /dev/null +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/antlr_asset_selection.py @@ -0,0 +1,27 @@ +from antlr4 import CommonTokenStream, InputStream + +from dagster._core.definitions.antlr_asset_selection.AssetSelectionLexer import AssetSelectionLexer +from dagster._core.definitions.antlr_asset_selection.AssetSelectionParser import ( + AssetSelectionParser, +) +from dagster._core.definitions.antlr_asset_selection.AssetSelectionVisitor import ( + AssetSelectionVisitor, +) + + +class AntlrAssetSelection: + _visitor: AssetSelectionVisitor = AssetSelectionVisitor() + + def __init__(self, selection_str: str): + lexer = AssetSelectionLexer(InputStream(selection_str)) + stream = CommonTokenStream(lexer) + parser = AssetSelectionParser(stream) + self._tree = parser.start() + self._tree_str = self._tree.toStringTree(recog=parser) + + @property + def tree_str(self) -> str: + return self._tree_str + + # def assets(self) -> AssetSelection: + # return AntlrAssetSelection._visitor.visit(self._tree) diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/fix_imports.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/fix_imports.py index 7623ba3da0524..22c1b79823f0a 100644 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/fix_imports.py +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/fix_imports.py @@ -15,16 +15,6 @@ def fix_imports(file_path): file.writelines(updated_lines) -def find_and_replace(file_path, target_text, replacement_text): - with open(file_path, "r") as file: - file_contents = file.read() - - updated_contents = file_contents.replace(target_text, replacement_text) - - with open(file_path, "w") as file: - file.write(updated_contents) - - def add_lines_to_start(file_path, lines_to_add): with open(file_path, "r") as file: original_content = file.readlines() @@ -50,17 +40,5 @@ def add_lines_to_start(file_path, lines_to_add): file, [ "# type: ignore\n", - # "from .AssetSelectionListener import AssetSelectionListener\n", - # "from .AssetSelectionVisitor import AssetSelectionVisitor\n", ], ) - # find_and_replace( - # file, - # "ParseTreeListener", - # "AssetSelectionListener", - # ) - # find_and_replace( - # file, - # "ParseTreeVisitor", - # "AssetSelectionVisitor", - # ) diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/main.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/main.py deleted file mode 100644 index 00cec9da08b63..0000000000000 --- a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/main.py +++ /dev/null @@ -1,21 +0,0 @@ -from antlr4 import CommonTokenStream, InputStream - -from dagster._core.definitions.antlr_asset_selection.AssetSelectionLexer import AssetSelectionLexer -from dagster._core.definitions.antlr_asset_selection.AssetSelectionParser import ( - AssetSelectionParser, -) -from dagster._core.definitions.antlr_asset_selection.AssetSelectionVisitor import ( - AssetSelectionVisitor, -) - -input_text = "hello" -lexer = AssetSelectionLexer(InputStream(input_text)) -stream = CommonTokenStream(lexer) -parser = AssetSelectionParser(stream) - -tree = parser.expr() - -visitor = AssetSelectionVisitor() - -# print(tree.toStringTree(recog=parser)) -# print(visitor.visit(tree)) diff --git a/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/test_antlr_asset_selection.py b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/test_antlr_asset_selection.py new file mode 100644 index 0000000000000..1d361578aa0e8 --- /dev/null +++ b/python_modules/dagster/dagster/_core/definitions/antlr_asset_selection/test_antlr_asset_selection.py @@ -0,0 +1,41 @@ +import pytest + +from dagster._core.definitions.antlr_asset_selection.antlr_asset_selection import ( + AntlrAssetSelection, +) + + +@pytest.mark.parametrize( + "selection_str, expected_tree_str", + [ + ("asset1", "(start (expr (assetExpr asset1)) )"), + ( + "(((asset1)))", + "(start (expr ( (expr ( (expr ( (expr (assetExpr asset1)) )) )) )) )", + ), + ('not not "not"', '(start (expr not (expr not (expr (assetExpr "not")))) )'), + ( + '(roots("my_asset") and owner:billing)*', + '(start (expr (expr ( (expr (expr (functionName roots) ( (expr (assetExpr "my_asset")) )) and (expr (attributeExpr owner : (value billing)))) )) (traversal *)) )', + ), + ( + "++(my_asset+)", + "(start (expr (traversal + +) (expr ( (expr (expr (assetExpr my_asset)) (traversal +)) ))) )", + ), + ( + '"asset_a"* and *"asset_b"', + '(start (expr (expr (expr (assetExpr "asset_a")) (traversal *)) and (expr (traversal *) (expr (assetExpr "asset_b")))) )', + ), + ( + 'group:"my_group"*', + '(start (expr (expr (attributeExpr group : (value "my_group"))) (traversal *)) )', + ), + ( + "codelocation:my_location or tag:foo=bar", + "(start (expr (expr (attributeExpr codelocation : (value my_location))) or (expr (attributeExpr tag : (value foo) = (value bar)))) )", + ), + ], +) +def test_antlr_tree(selection_str, expected_tree_str): + asset_selection = AntlrAssetSelection(selection_str) + assert asset_selection.tree_str == expected_tree_str