Skip to content

Commit 22a5775

Browse files
authored
[BG 2.3.0] (#1284)
• Handle `is` properly for v8, will change in v9 and hopefully not require fixup • Add support for disambiguation of type_argument_list with a query_expression • Add (nonsensical) sample to test the above Co-authored-by: Nigel-Ecma <[email protected]>
1 parent 046b37a commit 22a5775

18 files changed

+11111
-7642
lines changed
Binary file not shown.

tools/GrammarTesting/Tests/Parsing/Samples/v6/AllInOneNoPreprocessor-v6-split/part-B/Reference/AllInOneNoPreprocessor-v6-part.gruntree.red.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@
12251225
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎝
12261226
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ is
12271227
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛
1228-
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ pattern
1228+
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ type
12291229
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎛
12301230
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ identifier
12311231
⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ ⎜ Action

tools/GrammarTesting/Tests/Parsing/Samples/v6/AllInOneNoPreprocessor-v6-split/part-B/Reference/AllInOneNoPreprocessor-v6-part.tree.red.txt

+1-1
Large diffs are not rendered by default.

tools/GrammarTesting/Tests/Parsing/Samples/v6/AllInOneNoPreprocessor-v6-split/part-B/Reference/AllInOneNoPreprocessor-v6-part.tree.svg

+5,468-5,468
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Sample: Type argument list disambiguation – Query expressions
2+
3+
Uses modification set Rules which implements the disambiguation algorithm
4+
to determine whether a sequence of tokens is a *type_argument_list* or some expression
5+
when it occurs within a *query_expression*.
6+
7+
Disambiguation is applied when a *type_argument_list* appears immediately before
8+
a contextual query keyword within a query expression. This can happen with
9+
those query clauses which end in an *expression* (e.g. *where_clause*)
10+
and those with *expression* followed by a contextual keyword within the clause
11+
itself (e.g. *join_clause* where the keywords `on` and `in` follow *expression*s).
12+
13+
This is essentially the same process as for disambiguating within expression
14+
context, but with the addition of additional following tokens within the query context.

tools/GrammarTesting/Tests/Parsing/Samples/v8/TAL Query expressions/Reference/sample.gruntree.red.txt

+705
Large diffs are not rendered by default.

tools/GrammarTesting/Tests/Parsing/Samples/v8/TAL Query expressions/Reference/sample.stderr.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
[@0,0:4='class',<'class'>,1:0]
2+
[@1,6:27='TypeArgumentListChecks',<Simple_Identifier>,1:6]
3+
[@2,29:29='{',<'{'>,2:0]
4+
[@3,34:37='void',<'void'>,3:3]
5+
[@4,39:60='TypeArgumentListChecks',<Simple_Identifier>,3:8]
6+
[@5,61:61='(',<'('>,3:30]
7+
[@6,62:62=')',<')'>,3:31]
8+
[@7,67:67='{',<'{'>,4:3]
9+
[@8,1111:1113='var',<'var'>,25:6]
10+
[@9,1115:1119='query',<Simple_Identifier>,25:10]
11+
[@10,1121:1121='=',<'='>,25:16]
12+
[@11,1123:1126='from',<'from'>,25:18]
13+
[@12,1128:1128='c',<Simple_Identifier>,25:23]
14+
[@13,1130:1131='in',<'in'>,25:25]
15+
[@14,1133:1141='customers',<Simple_Identifier>,25:28]
16+
[@15,1142:1142='<',<'<'>,25:37]
17+
[@16,1143:1143='A',<Simple_Identifier>,25:38]
18+
[@17,1144:1144='>',<'>'>,25:39]
19+
[@18,1164:1166='let',<'let'>,26:18]
20+
[@19,1168:1168='d',<Simple_Identifier>,26:22]
21+
[@20,1170:1170='=',<'='>,26:24]
22+
[@21,1172:1172='c',<Simple_Identifier>,26:26]
23+
[@22,1173:1173='<',<'<'>,26:27]
24+
[@23,1174:1174='B',<Simple_Identifier>,26:28]
25+
[@24,1175:1175='>',<'>'>,26:29]
26+
[@25,1195:1199='where',<'where'>,27:18]
27+
[@26,1201:1201='d',<Simple_Identifier>,27:24]
28+
[@27,1203:1204='!=',<'!='>,27:26]
29+
[@28,1206:1209='null',<'null'>,27:29]
30+
[@29,1211:1212='&&',<'&&'>,27:34]
31+
[@30,1214:1214='d',<Simple_Identifier>,27:37]
32+
[@31,1215:1215='<',<'<'>,27:38]
33+
[@32,1216:1216='C',<Simple_Identifier>,27:39]
34+
[@33,1217:1217=',',<','>,27:40]
35+
[@34,1218:1218='D',<Simple_Identifier>,27:41]
36+
[@35,1219:1219='>',<'>'>,27:42]
37+
[@36,1239:1242='join',<'join'>,28:18]
38+
[@37,1244:1245='c1',<Simple_Identifier>,28:23]
39+
[@38,1247:1248='in',<'in'>,28:26]
40+
[@39,1250:1258='customers',<Simple_Identifier>,28:29]
41+
[@40,1259:1259='<',<'<'>,28:38]
42+
[@41,1260:1260='E',<Simple_Identifier>,28:39]
43+
[@42,1261:1261='>',<'>'>,28:40]
44+
[@43,1263:1264='on',<'on'>,28:42]
45+
[@44,1266:1267='c1',<Simple_Identifier>,28:45]
46+
[@45,1268:1268='.',<'.'>,28:47]
47+
[@46,1269:1279='GetHashCode',<Simple_Identifier>,28:48]
48+
[@47,1280:1280='(',<'('>,28:59]
49+
[@48,1281:1281=')',<')'>,28:60]
50+
[@49,1283:1284='&&',<'&&'>,28:62]
51+
[@50,1286:1287='c1',<Simple_Identifier>,28:65]
52+
[@51,1288:1288='<',<'<'>,28:67]
53+
[@52,1289:1289='G',<Simple_Identifier>,28:68]
54+
[@53,1290:1290='>',<'>'>,28:69]
55+
[@54,1292:1297='equals',<'equals'>,28:71]
56+
[@55,1299:1299='c',<Simple_Identifier>,28:78]
57+
[@56,1300:1300='.',<'.'>,28:79]
58+
[@57,1301:1311='GetHashCode',<Simple_Identifier>,28:80]
59+
[@58,1312:1312='(',<'('>,28:91]
60+
[@59,1313:1313=')',<')'>,28:92]
61+
[@60,1315:1316='&&',<'&&'>,28:94]
62+
[@61,1318:1318='c',<Simple_Identifier>,28:97]
63+
[@62,1319:1319='<',<'<'>,28:98]
64+
[@63,1320:1320='H',<Simple_Identifier>,28:99]
65+
[@64,1321:1321='>',<'>'>,28:100]
66+
[@65,1341:1344='join',<'join'>,29:18]
67+
[@66,1346:1347='c1',<Simple_Identifier>,29:23]
68+
[@67,1349:1350='in',<'in'>,29:26]
69+
[@68,1352:1360='customers',<Simple_Identifier>,29:29]
70+
[@69,1362:1363='on',<'on'>,29:39]
71+
[@70,1365:1366='c1',<Simple_Identifier>,29:42]
72+
[@71,1367:1367='.',<'.'>,29:44]
73+
[@72,1368:1378='GetHashCode',<Simple_Identifier>,29:45]
74+
[@73,1379:1379='(',<'('>,29:56]
75+
[@74,1380:1380=')',<')'>,29:57]
76+
[@75,1382:1387='equals',<'equals'>,29:59]
77+
[@76,1389:1389='c',<Simple_Identifier>,29:66]
78+
[@77,1390:1390='.',<'.'>,29:67]
79+
[@78,1391:1401='GetHashCode',<Simple_Identifier>,29:68]
80+
[@79,1402:1402='(',<'('>,29:79]
81+
[@80,1403:1403=')',<')'>,29:80]
82+
[@81,1405:1408='into',<'into'>,29:82]
83+
[@82,1410:1410='e',<Simple_Identifier>,29:87]
84+
[@83,1430:1434='group',<'group'>,30:18]
85+
[@84,1436:1436='c',<Simple_Identifier>,30:24]
86+
[@85,1437:1437='<',<'<'>,30:25]
87+
[@86,1438:1438='K',<Simple_Identifier>,30:26]
88+
[@87,1439:1439='>',<'>'>,30:27]
89+
[@88,1441:1442='by',<'by'>,30:29]
90+
[@89,1444:1444='c',<Simple_Identifier>,30:32]
91+
[@90,1445:1445='.',<'.'>,30:33]
92+
[@91,1446:1452='Country',<Simple_Identifier>,30:34]
93+
[@92,1453:1453='<',<'<'>,30:41]
94+
[@93,1454:1454='M',<Simple_Identifier>,30:42]
95+
[@94,1455:1455='>',<'>'>,30:43]
96+
[@95,1479:1482='into',<'into'>,31:22]
97+
[@96,1484:1484='g',<Simple_Identifier>,31:27]
98+
[@97,1508:1514='orderby',<'orderby'>,32:22]
99+
[@98,1516:1516='g',<Simple_Identifier>,32:30]
100+
[@99,1517:1517='.',<'.'>,32:31]
101+
[@100,1518:1522='Count',<Simple_Identifier>,32:32]
102+
[@101,1523:1523='(',<'('>,32:37]
103+
[@102,1524:1524=')',<')'>,32:38]
104+
[@103,1525:1525='.',<'.'>,32:39]
105+
[@104,1526:1526='O',<Simple_Identifier>,32:40]
106+
[@105,1527:1527='<',<'<'>,32:41]
107+
[@106,1528:1528='P',<Simple_Identifier>,32:42]
108+
[@107,1529:1529='>',<'>'>,32:43]
109+
[@108,1531:1539='ascending',<'ascending'>,32:45]
110+
[@109,1563:1569='orderby',<'orderby'>,33:22]
111+
[@110,1571:1571='g',<Simple_Identifier>,33:30]
112+
[@111,1572:1572='.',<'.'>,33:31]
113+
[@112,1573:1575='Key',<Simple_Identifier>,33:32]
114+
[@113,1577:1586='descending',<'descending'>,33:36]
115+
[@114,1610:1615='select',<'select'>,34:22]
116+
[@115,1617:1619='new',<'new'>,34:29]
117+
[@116,1621:1621='{',<'{'>,34:33]
118+
[@117,1623:1629='Country',<Simple_Identifier>,34:35]
119+
[@118,1631:1631='=',<'='>,34:43]
120+
[@119,1633:1633='g',<Simple_Identifier>,34:45]
121+
[@120,1634:1634='.',<'.'>,34:46]
122+
[@121,1635:1637='Key',<Simple_Identifier>,34:47]
123+
[@122,1638:1638=',',<','>,34:50]
124+
[@123,1640:1648='CustCount',<Simple_Identifier>,34:52]
125+
[@124,1650:1650='=',<'='>,34:62]
126+
[@125,1652:1652='g',<Simple_Identifier>,34:64]
127+
[@126,1653:1653='.',<'.'>,34:65]
128+
[@127,1654:1658='Count',<Simple_Identifier>,34:66]
129+
[@128,1659:1659='(',<'('>,34:71]
130+
[@129,1660:1660=')',<')'>,34:72]
131+
[@130,1662:1662='}',<'}'>,34:74]
132+
[@131,1663:1663=';',<';'>,34:75]
133+
[@132,1669:1669='}',<'}'>,36:3]
134+
[@133,1671:1671='}',<'}'>,37:0]
135+
[@134,1672:1671='<EOF>',<EOF>,37:1]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(prog (compilation_unit (class_declaration class (identifier TypeArgumentListChecks) (class_body { (class_member_declaration (method_declaration method_modifiers (return_type void) (method_header (member_name (identifier TypeArgumentListChecks)) ( )) (method_body (block { (statement_list (declaration_statement (local_variable_declaration (implicitly_typed_local_variable_declaration var (implicitly_typed_local_variable_declarator (identifier query) = (expression (query_expression (from_clause from (identifier c) in (expression (simple_name (identifier customers) (type_argument_list < (type_arguments (identifier A)) >)))) (query_body (query_body_clauses (query_body_clauses (query_body_clauses (query_body_clauses (let_clause let (identifier d) = (expression (simple_name (identifier c) (type_argument_list < (type_arguments (identifier B)) >))))) (query_body_clause (where_clause where (boolean_expression (conditional_and_expression (conditional_and_expression (equality_expression (equality_expression (identifier d)) != (relational_expression (null_literal null)))) && (inclusive_or_expression (simple_name (identifier d) (type_argument_list < (type_arguments (type_argument (identifier C)) , (type_argument (identifier D))) >)))))))) (query_body_clause (join_clause join (identifier c1) in (expression (simple_name (identifier customers) (type_argument_list < (type_arguments (identifier E)) >))) on (expression (conditional_and_expression (conditional_and_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier c1)) . (identifier GetHashCode))) ( ))) && (inclusive_or_expression (simple_name (identifier c1) (type_argument_list < (type_arguments (identifier G)) >))))) equals (expression (conditional_and_expression (conditional_and_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier c)) . (identifier GetHashCode))) ( ))) && (inclusive_or_expression (simple_name (identifier c) (type_argument_list < (type_arguments (identifier H)) >)))))))) (query_body_clause (join_into_clause join (identifier c1) in (expression (identifier customers)) on (expression (invocation_expression (primary_expression (member_access (primary_expression (identifier c1)) . (identifier GetHashCode))) ( ))) equals (expression (invocation_expression (primary_expression (member_access (primary_expression (identifier c)) . (identifier GetHashCode))) ( ))) into (identifier e)))) (select_or_group_clause (group_clause group (expression (simple_name (identifier c) (type_argument_list < (type_arguments (identifier K)) >))) by (expression (member_access (primary_expression (identifier c)) . (identifier Country) (type_argument_list < (type_arguments (identifier M)) >))))) (query_continuation into (identifier g) (query_body (query_body_clauses (query_body_clauses (orderby_clause orderby (orderings (ordering (expression (member_access (primary_expression (invocation_expression (primary_expression (member_access (primary_expression (identifier g)) . (identifier Count))) ( ))) . (identifier O) (type_argument_list < (type_arguments (identifier P)) >))) (ordering_direction ascending))))) (query_body_clause (orderby_clause orderby (orderings (ordering (expression (member_access (primary_expression (identifier g)) . (identifier Key))) (ordering_direction descending)))))) (select_or_group_clause (select_clause select (expression (anonymous_object_creation_expression new (anonymous_object_initializer { (member_declarator_list (member_declarator (identifier Country) = (expression (member_access (primary_expression (identifier g)) . (identifier Key)))) , (member_declarator (identifier CustCount) = (expression (invocation_expression (primary_expression (member_access (primary_expression (identifier g)) . (identifier Count))) ( ))))) }))))))))))))) ;)) })))) }))))

0 commit comments

Comments
 (0)