Skip to content

Commit b5ef15c

Browse files
committed
QL4QL: Regenerate raw AST
1 parent 5735ac3 commit b5ef15c

1 file changed

Lines changed: 328 additions & 0 deletions

File tree

ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,244 @@ module QL {
13121312
/** Gets a field or child node of this node. */
13131313
final override AstNode getAFieldOrChild() { ql_variable_def(this, result) }
13141314
}
1315+
1316+
/** Provides predicates for mapping AST nodes to their named children. */
1317+
module PrintAst {
1318+
/** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */
1319+
AstNode getChild(AstNode node, string name, int i) {
1320+
result = node.(AddExpr).getLeft() and i = -1 and name = "getLeft"
1321+
or
1322+
result = node.(AddExpr).getRight() and i = -1 and name = "getRight"
1323+
or
1324+
result = node.(AddExpr).getChild() and i = -1 and name = "getChild"
1325+
or
1326+
result = node.(Aggregate).getChild(i) and name = "getChild"
1327+
or
1328+
result = node.(AnnotArg).getChild() and i = -1 and name = "getChild"
1329+
or
1330+
result = node.(Annotation).getArgs(i) and name = "getArgs"
1331+
or
1332+
result = node.(Annotation).getName() and i = -1 and name = "getName"
1333+
or
1334+
result = node.(AritylessPredicateExpr).getName() and i = -1 and name = "getName"
1335+
or
1336+
result = node.(AritylessPredicateExpr).getQualifier() and i = -1 and name = "getQualifier"
1337+
or
1338+
result = node.(AsExpr).getChild(i) and name = "getChild"
1339+
or
1340+
result = node.(AsExprs).getChild(i) and name = "getChild"
1341+
or
1342+
result = node.(Body).getChild() and i = -1 and name = "getChild"
1343+
or
1344+
result = node.(Bool).getChild() and i = -1 and name = "getChild"
1345+
or
1346+
result = node.(CallBody).getChild(i) and name = "getChild"
1347+
or
1348+
result = node.(CallOrUnqualAggExpr).getChild(i) and name = "getChild"
1349+
or
1350+
result = node.(Charpred).getBody() and i = -1 and name = "getBody"
1351+
or
1352+
result = node.(Charpred).getChild() and i = -1 and name = "getChild"
1353+
or
1354+
result = node.(ClassMember).getChild(i) and name = "getChild"
1355+
or
1356+
result = node.(ClasslessPredicate).getName() and i = -1 and name = "getName"
1357+
or
1358+
result = node.(ClasslessPredicate).getReturnType() and i = -1 and name = "getReturnType"
1359+
or
1360+
result = node.(ClasslessPredicate).getChild(i) and name = "getChild"
1361+
or
1362+
result = node.(CompTerm).getLeft() and i = -1 and name = "getLeft"
1363+
or
1364+
result = node.(CompTerm).getRight() and i = -1 and name = "getRight"
1365+
or
1366+
result = node.(CompTerm).getChild() and i = -1 and name = "getChild"
1367+
or
1368+
result = node.(Conjunction).getLeft() and i = -1 and name = "getLeft"
1369+
or
1370+
result = node.(Conjunction).getRight() and i = -1 and name = "getRight"
1371+
or
1372+
result = node.(Dataclass).getExtends(i) and name = "getExtends"
1373+
or
1374+
result = node.(Dataclass).getInstanceof(i) and name = "getInstanceof"
1375+
or
1376+
result = node.(Dataclass).getName() and i = -1 and name = "getName"
1377+
or
1378+
result = node.(Dataclass).getChild(i) and name = "getChild"
1379+
or
1380+
result = node.(Datatype).getName() and i = -1 and name = "getName"
1381+
or
1382+
result = node.(Datatype).getChild() and i = -1 and name = "getChild"
1383+
or
1384+
result = node.(DatatypeBranch).getName() and i = -1 and name = "getName"
1385+
or
1386+
result = node.(DatatypeBranch).getChild(i) and name = "getChild"
1387+
or
1388+
result = node.(DatatypeBranches).getChild(i) and name = "getChild"
1389+
or
1390+
result = node.(Disjunction).getLeft() and i = -1 and name = "getLeft"
1391+
or
1392+
result = node.(Disjunction).getRight() and i = -1 and name = "getRight"
1393+
or
1394+
result = node.(ExprAggregateBody).getAsExprs() and i = -1 and name = "getAsExprs"
1395+
or
1396+
result = node.(ExprAggregateBody).getOrderBys() and i = -1 and name = "getOrderBys"
1397+
or
1398+
result = node.(ExprAnnotation).getAnnotArg() and i = -1 and name = "getAnnotArg"
1399+
or
1400+
result = node.(ExprAnnotation).getName() and i = -1 and name = "getName"
1401+
or
1402+
result = node.(ExprAnnotation).getChild() and i = -1 and name = "getChild"
1403+
or
1404+
result = node.(Field).getChild() and i = -1 and name = "getChild"
1405+
or
1406+
result = node.(FullAggregateBody).getAsExprs() and i = -1 and name = "getAsExprs"
1407+
or
1408+
result = node.(FullAggregateBody).getGuard() and i = -1 and name = "getGuard"
1409+
or
1410+
result = node.(FullAggregateBody).getOrderBys() and i = -1 and name = "getOrderBys"
1411+
or
1412+
result = node.(FullAggregateBody).getChild(i) and name = "getChild"
1413+
or
1414+
result = node.(HigherOrderTerm).getName() and i = -1 and name = "getName"
1415+
or
1416+
result = node.(HigherOrderTerm).getChild(i) and name = "getChild"
1417+
or
1418+
result = node.(IfTerm).getCond() and i = -1 and name = "getCond"
1419+
or
1420+
result = node.(IfTerm).getFirst() and i = -1 and name = "getFirst"
1421+
or
1422+
result = node.(IfTerm).getSecond() and i = -1 and name = "getSecond"
1423+
or
1424+
result = node.(Implication).getLeft() and i = -1 and name = "getLeft"
1425+
or
1426+
result = node.(Implication).getRight() and i = -1 and name = "getRight"
1427+
or
1428+
result = node.(ImportDirective).getChild(i) and name = "getChild"
1429+
or
1430+
result = node.(ImportModuleExpr).getQualName(i) and name = "getQualName"
1431+
or
1432+
result = node.(ImportModuleExpr).getChild() and i = -1 and name = "getChild"
1433+
or
1434+
result = node.(InExpr).getLeft() and i = -1 and name = "getLeft"
1435+
or
1436+
result = node.(InExpr).getRight() and i = -1 and name = "getRight"
1437+
or
1438+
result = node.(InstanceOf).getChild(i) and name = "getChild"
1439+
or
1440+
result = node.(Literal).getChild() and i = -1 and name = "getChild"
1441+
or
1442+
result = node.(MemberPredicate).getName() and i = -1 and name = "getName"
1443+
or
1444+
result = node.(MemberPredicate).getReturnType() and i = -1 and name = "getReturnType"
1445+
or
1446+
result = node.(MemberPredicate).getChild(i) and name = "getChild"
1447+
or
1448+
result = node.(Module).getImplements(i) and name = "getImplements"
1449+
or
1450+
result = node.(Module).getName() and i = -1 and name = "getName"
1451+
or
1452+
result = node.(Module).getParameter(i) and name = "getParameter"
1453+
or
1454+
result = node.(Module).getChild(i) and name = "getChild"
1455+
or
1456+
result = node.(ModuleAliasBody).getChild() and i = -1 and name = "getChild"
1457+
or
1458+
result = node.(ModuleExpr).getName() and i = -1 and name = "getName"
1459+
or
1460+
result = node.(ModuleExpr).getChild() and i = -1 and name = "getChild"
1461+
or
1462+
result = node.(ModuleInstantiation).getName() and i = -1 and name = "getName"
1463+
or
1464+
result = node.(ModuleInstantiation).getChild(i) and name = "getChild"
1465+
or
1466+
result = node.(ModuleMember).getChild(i) and name = "getChild"
1467+
or
1468+
result = node.(ModuleName).getChild() and i = -1 and name = "getChild"
1469+
or
1470+
result = node.(ModuleParam).getParameter() and i = -1 and name = "getParameter"
1471+
or
1472+
result = node.(ModuleParam).getSignature() and i = -1 and name = "getSignature"
1473+
or
1474+
result = node.(MulExpr).getLeft() and i = -1 and name = "getLeft"
1475+
or
1476+
result = node.(MulExpr).getRight() and i = -1 and name = "getRight"
1477+
or
1478+
result = node.(MulExpr).getChild() and i = -1 and name = "getChild"
1479+
or
1480+
result = node.(Negation).getChild() and i = -1 and name = "getChild"
1481+
or
1482+
result = node.(OrderBy).getChild(i) and name = "getChild"
1483+
or
1484+
result = node.(OrderBys).getChild(i) and name = "getChild"
1485+
or
1486+
result = node.(ParExpr).getChild() and i = -1 and name = "getChild"
1487+
or
1488+
result = node.(PredicateAliasBody).getChild() and i = -1 and name = "getChild"
1489+
or
1490+
result = node.(PredicateExpr).getChild(i) and name = "getChild"
1491+
or
1492+
result = node.(PrefixCast).getChild(i) and name = "getChild"
1493+
or
1494+
result = node.(Ql).getChild(i) and name = "getChild"
1495+
or
1496+
result = node.(QualifiedRhs).getName() and i = -1 and name = "getName"
1497+
or
1498+
result = node.(QualifiedRhs).getChild(i) and name = "getChild"
1499+
or
1500+
result = node.(QualifiedExpr).getChild(i) and name = "getChild"
1501+
or
1502+
result = node.(Quantified).getExpr() and i = -1 and name = "getExpr"
1503+
or
1504+
result = node.(Quantified).getFormula() and i = -1 and name = "getFormula"
1505+
or
1506+
result = node.(Quantified).getRange() and i = -1 and name = "getRange"
1507+
or
1508+
result = node.(Quantified).getChild(i) and name = "getChild"
1509+
or
1510+
result = node.(Range).getLower() and i = -1 and name = "getLower"
1511+
or
1512+
result = node.(Range).getUpper() and i = -1 and name = "getUpper"
1513+
or
1514+
result = node.(Select).getChild(i) and name = "getChild"
1515+
or
1516+
result = node.(SetLiteral).getChild(i) and name = "getChild"
1517+
or
1518+
result = node.(SignatureExpr).getModExpr() and i = -1 and name = "getModExpr"
1519+
or
1520+
result = node.(SignatureExpr).getPredicate() and i = -1 and name = "getPredicate"
1521+
or
1522+
result = node.(SignatureExpr).getTypeExpr() and i = -1 and name = "getTypeExpr"
1523+
or
1524+
result = node.(SpecialCall).getChild() and i = -1 and name = "getChild"
1525+
or
1526+
result = node.(SuperRef).getChild(i) and name = "getChild"
1527+
or
1528+
result = node.(TypeAliasBody).getChild() and i = -1 and name = "getChild"
1529+
or
1530+
result = node.(TypeExpr).getName() and i = -1 and name = "getName"
1531+
or
1532+
result = node.(TypeExpr).getQualifier() and i = -1 and name = "getQualifier"
1533+
or
1534+
result = node.(TypeExpr).getChild() and i = -1 and name = "getChild"
1535+
or
1536+
result = node.(TypeUnionBody).getChild(i) and name = "getChild"
1537+
or
1538+
result = node.(UnaryExpr).getChild(i) and name = "getChild"
1539+
or
1540+
result = node.(UnqualAggBody).getAsExprs(i) and name = "getAsExprs"
1541+
or
1542+
result = node.(UnqualAggBody).getGuard() and i = -1 and name = "getGuard"
1543+
or
1544+
result = node.(UnqualAggBody).getChild(i) and name = "getChild"
1545+
or
1546+
result = node.(VarDecl).getChild(i) and name = "getChild"
1547+
or
1548+
result = node.(VarName).getChild() and i = -1 and name = "getChild"
1549+
or
1550+
result = node.(Variable).getChild() and i = -1 and name = "getChild"
1551+
}
1552+
}
13151553
}
13161554

13171555
overlay[local]
@@ -1669,6 +1907,60 @@ module Dbscheme {
16691907
/** Gets the name of the primary QL class for this element. */
16701908
final override string getAPrimaryQlClass() { result = "Varchar" }
16711909
}
1910+
1911+
/** Provides predicates for mapping AST nodes to their named children. */
1912+
module PrintAst {
1913+
/** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */
1914+
AstNode getChild(AstNode node, string name, int i) {
1915+
result = node.(Annotation).getArgsAnnotation() and i = -1 and name = "getArgsAnnotation"
1916+
or
1917+
result = node.(Annotation).getSimpleAnnotation() and i = -1 and name = "getSimpleAnnotation"
1918+
or
1919+
result = node.(ArgsAnnotation).getName() and i = -1 and name = "getName"
1920+
or
1921+
result = node.(ArgsAnnotation).getChild(i) and name = "getChild"
1922+
or
1923+
result = node.(Branch).getQldoc() and i = -1 and name = "getQldoc"
1924+
or
1925+
result = node.(Branch).getChild(i) and name = "getChild"
1926+
or
1927+
result = node.(CaseDecl).getBase() and i = -1 and name = "getBase"
1928+
or
1929+
result = node.(CaseDecl).getDiscriminator() and i = -1 and name = "getDiscriminator"
1930+
or
1931+
result = node.(CaseDecl).getChild(i) and name = "getChild"
1932+
or
1933+
result = node.(ColType).getChild() and i = -1 and name = "getChild"
1934+
or
1935+
result = node.(Column).getColName() and i = -1 and name = "getColName"
1936+
or
1937+
result = node.(Column).getColType() and i = -1 and name = "getColType"
1938+
or
1939+
result = node.(Column).getIsRef() and i = -1 and name = "getIsRef"
1940+
or
1941+
result = node.(Column).getIsUnique() and i = -1 and name = "getIsUnique"
1942+
or
1943+
result = node.(Column).getQldoc() and i = -1 and name = "getQldoc"
1944+
or
1945+
result = node.(Column).getReprType() and i = -1 and name = "getReprType"
1946+
or
1947+
result = node.(Dbscheme).getChild(i) and name = "getChild"
1948+
or
1949+
result = node.(Entry).getChild() and i = -1 and name = "getChild"
1950+
or
1951+
result = node.(ReprType).getChild(i) and name = "getChild"
1952+
or
1953+
result = node.(Table).getTableName() and i = -1 and name = "getTableName"
1954+
or
1955+
result = node.(Table).getChild(i) and name = "getChild"
1956+
or
1957+
result = node.(TableName).getChild() and i = -1 and name = "getChild"
1958+
or
1959+
result = node.(UnionDecl).getBase() and i = -1 and name = "getBase"
1960+
or
1961+
result = node.(UnionDecl).getChild(i) and name = "getChild"
1962+
}
1963+
}
16721964
}
16731965

16741966
overlay[local]
@@ -1803,6 +2095,24 @@ module Blame {
18032095
/** Gets the name of the primary QL class for this element. */
18042096
final override string getAPrimaryQlClass() { result = "Number" }
18052097
}
2098+
2099+
/** Provides predicates for mapping AST nodes to their named children. */
2100+
module PrintAst {
2101+
/** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */
2102+
AstNode getChild(AstNode node, string name, int i) {
2103+
result = node.(BlameEntry).getDate() and i = -1 and name = "getDate"
2104+
or
2105+
result = node.(BlameEntry).getLine(i) and name = "getLine"
2106+
or
2107+
result = node.(BlameInfo).getFileEntry(i) and name = "getFileEntry"
2108+
or
2109+
result = node.(BlameInfo).getToday() and i = -1 and name = "getToday"
2110+
or
2111+
result = node.(FileEntry).getBlameEntry(i) and name = "getBlameEntry"
2112+
or
2113+
result = node.(FileEntry).getFileName() and i = -1 and name = "getFileName"
2114+
}
2115+
}
18062116
}
18072117

18082118
overlay[local]
@@ -1977,4 +2287,22 @@ module JSON {
19772287
/** Gets the name of the primary QL class for this element. */
19782288
final override string getAPrimaryQlClass() { result = "True" }
19792289
}
2290+
2291+
/** Provides predicates for mapping AST nodes to their named children. */
2292+
module PrintAst {
2293+
/** Gets a child of `node` returned by the member predicate with the given `name`. If the predicate takes an index argument, `i` is bound to that index, otherwise `i` is `-1` (which is never a valid index). */
2294+
AstNode getChild(AstNode node, string name, int i) {
2295+
result = node.(Array).getChild(i) and name = "getChild"
2296+
or
2297+
result = node.(Document).getChild(i) and name = "getChild"
2298+
or
2299+
result = node.(Object).getChild(i) and name = "getChild"
2300+
or
2301+
result = node.(Pair).getKey() and i = -1 and name = "getKey"
2302+
or
2303+
result = node.(Pair).getValue() and i = -1 and name = "getValue"
2304+
or
2305+
result = node.(String).getChild(i) and name = "getChild"
2306+
}
2307+
}
19802308
}

0 commit comments

Comments
 (0)