Skip to content

Commit 68733a8

Browse files
committed
Python: Regenerate AST and dbscheme files
1 parent 48cd541 commit 68733a8

File tree

2 files changed

+81
-4
lines changed

2 files changed

+81
-4
lines changed

python/ql/lib/semmle/python/AstGenerated.qll

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,20 @@ class Fstring_ extends @py_Fstring, Expr {
768768
override string toString() { result = "Fstring" }
769769
}
770770

771+
/** INTERNAL: See the class `JoinedTemplateString` for further information. */
772+
class JoinedTemplateString_ extends @py_JoinedTemplateString, Expr {
773+
/** Gets the strings of this joined template string. */
774+
TemplateStringList getStrings() { py_TemplateString_lists(result, this) }
775+
776+
/** Gets the nth string of this joined template string. */
777+
TemplateString getString(int index) { result = this.getStrings().getItem(index) }
778+
779+
/** Gets a string of this joined template string. */
780+
TemplateString getAString() { result = this.getStrings().getAnItem() }
781+
782+
override string toString() { result = "JoinedTemplateString" }
783+
}
784+
771785
/** INTERNAL: See the class `KeyValuePair` for further information. */
772786
class KeyValuePair_ extends @py_KeyValuePair, DictItem {
773787
/** Gets the location of this key-value pair. */
@@ -1373,6 +1387,48 @@ class TemplateDottedNotation_ extends @py_TemplateDottedNotation, Expr {
13731387
override string toString() { result = "TemplateDottedNotation" }
13741388
}
13751389

1390+
/** INTERNAL: See the class `TemplateString` for further information. */
1391+
class TemplateString_ extends @py_TemplateString, Expr {
1392+
/** Gets the prefix of this template string literal. */
1393+
string getPrefix() { py_strs(result, this, 2) }
1394+
1395+
/** Gets the values of this template string literal. */
1396+
ExprList getValues() { py_expr_lists(result, this, 3) }
1397+
1398+
/** Gets the nth value of this template string literal. */
1399+
Expr getValue(int index) { result = this.getValues().getItem(index) }
1400+
1401+
/** Gets a value of this template string literal. */
1402+
Expr getAValue() { result = this.getValues().getAnItem() }
1403+
1404+
override ExprParent getParent() { py_exprs(this, _, result, _) }
1405+
1406+
override string toString() { result = "TemplateString" }
1407+
}
1408+
1409+
/** INTERNAL: See the class `TemplateStringPart` for further information. */
1410+
class TemplateStringPart_ extends @py_TemplateStringPart, Expr {
1411+
/** Gets the text of this string part of a template string. */
1412+
string getText() { py_strs(result, this, 2) }
1413+
1414+
override string toString() { result = "TemplateStringPart" }
1415+
}
1416+
1417+
/** INTERNAL: See the class `TemplateStringList` for further information. */
1418+
class TemplateStringList_ extends @py_TemplateString_list {
1419+
/** Gets a parent of this template string literal list */
1420+
JoinedTemplateString getParent() { py_TemplateString_lists(this, result) }
1421+
1422+
/** Gets an item of this template string literal list */
1423+
Expr getAnItem() { py_exprs(result, _, this, _) }
1424+
1425+
/** Gets the nth item of this template string literal list */
1426+
Expr getItem(int index) { py_exprs(result, _, this, index) }
1427+
1428+
/** Gets a textual representation of this element. */
1429+
string toString() { result = "TemplateStringList" }
1430+
}
1431+
13761432
/** INTERNAL: See the class `TemplateWrite` for further information. */
13771433
class TemplateWrite_ extends @py_TemplateWrite, Stmt {
13781434
/** Gets the value of this template write statement. */

python/ql/lib/semmlecode.python.dbscheme

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ py_extracted_version(int module : @py_Module ref,
530530
/* <Field> Fstring.values = 2, expr_list */
531531
/* <Parent> Fstring = FormattedValue */
532532

533+
/* <Field> JoinedTemplateString.location = 0, location */
534+
/* <Field> JoinedTemplateString.parenthesised = 1, bool */
535+
/* <Field> JoinedTemplateString.strings = 2, TemplateString_list */
536+
533537
/* <Field> KeyValuePair.location = 0, location */
534538
/* <Field> KeyValuePair.value = 1, expr */
535539
/* <Field> KeyValuePair.key = 2, expr */
@@ -709,6 +713,17 @@ py_extracted_version(int module : @py_Module ref,
709713
/* <Field> TemplateDottedNotation.attr = 3, str */
710714
/* <Field> TemplateDottedNotation.ctx = 4, expr_context */
711715

716+
/* <Field> TemplateString.location = 0, location */
717+
/* <Field> TemplateString.parenthesised = 1, bool */
718+
/* <Field> TemplateString.prefix = 2, str */
719+
/* <Field> TemplateString.values = 3, expr_list */
720+
/* <Parent> TemplateString = TemplateStringList */
721+
722+
/* <Field> TemplateStringPart.location = 0, location */
723+
/* <Field> TemplateStringPart.parenthesised = 1, bool */
724+
/* <Field> TemplateStringPart.text = 2, str */
725+
/* <Parent> TemplateStringList = JoinedTemplateString */
726+
712727
/* <Field> TemplateWrite.location = 0, location */
713728
/* <Field> TemplateWrite.value = 1, expr */
714729

@@ -835,6 +850,9 @@ py_StringParts(unique int id : @py_StringPart,
835850
py_StringPart_lists(unique int id : @py_StringPart_list,
836851
unique int parent : @py_Bytes_or_Str ref);
837852

853+
py_TemplateString_lists(unique int id : @py_TemplateString_list,
854+
unique int parent : @py_JoinedTemplateString ref);
855+
838856
py_aliases(unique int id : @py_alias,
839857
int parent : @py_alias_list ref,
840858
int idx : int ref);
@@ -1010,7 +1028,10 @@ case @py_expr.kind of
10101028
| 36 = @py_Fstring
10111029
| 37 = @py_FormattedValue
10121030
| 38 = @py_AssignExpr
1013-
| 39 = @py_SpecialOperation;
1031+
| 39 = @py_SpecialOperation
1032+
| 40 = @py_TemplateString
1033+
| 41 = @py_JoinedTemplateString
1034+
| 42 = @py_TemplateStringPart;
10141035

10151036
case @py_expr_context.kind of
10161037
0 = @py_AugLoad
@@ -1105,11 +1126,11 @@ case @py_unaryop.kind of
11051126

11061127
@py_expr_context_parent = @py_Attribute | @py_List | @py_Name | @py_PlaceHolder | @py_Starred | @py_Subscript | @py_TemplateDottedNotation | @py_Tuple;
11071128

1108-
@py_expr_list_parent = @py_Assign | @py_BoolExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_Delete | @py_Fstring | @py_Function | @py_List | @py_Print | @py_Set | @py_SpecialOperation | @py_Tuple | @py_arguments | @py_comprehension;
1129+
@py_expr_list_parent = @py_Assign | @py_BoolExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_Delete | @py_Fstring | @py_Function | @py_List | @py_Print | @py_Set | @py_SpecialOperation | @py_TemplateString | @py_Tuple | @py_arguments | @py_comprehension;
11091130

11101131
@py_expr_or_stmt = @py_expr | @py_stmt;
11111132

1112-
@py_expr_parent = @py_AnnAssign | @py_Assert | @py_Assign | @py_AssignExpr | @py_Attribute | @py_AugAssign | @py_Await | @py_BinaryExpr | @py_Call | @py_Case | @py_Compare | @py_DictComp | @py_DictUnpacking | @py_ExceptGroupStmt | @py_ExceptStmt | @py_Exec | @py_Expr_stmt | @py_Filter | @py_For | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_GeneratorExp | @py_Guard | @py_If | @py_IfExp | @py_ImportMember | @py_ImportStar | @py_KeyValuePair | @py_ListComp | @py_MatchAsPattern | @py_MatchCapturePattern | @py_MatchClassPattern | @py_MatchKeywordPattern | @py_MatchLiteralPattern | @py_MatchStmt | @py_MatchValuePattern | @py_ParamSpec | @py_Print | @py_Raise | @py_Repr | @py_Return | @py_SetComp | @py_Slice | @py_Starred | @py_Subscript | @py_TemplateDottedNotation | @py_TemplateWrite | @py_TypeAlias | @py_TypeVar | @py_TypeVarTuple | @py_UnaryExpr | @py_While | @py_With | @py_Yield | @py_YieldFrom | @py_alias | @py_arguments | @py_comprehension | @py_expr_list | @py_keyword | @py_parameter_list;
1133+
@py_expr_parent = @py_AnnAssign | @py_Assert | @py_Assign | @py_AssignExpr | @py_Attribute | @py_AugAssign | @py_Await | @py_BinaryExpr | @py_Call | @py_Case | @py_Compare | @py_DictComp | @py_DictUnpacking | @py_ExceptGroupStmt | @py_ExceptStmt | @py_Exec | @py_Expr_stmt | @py_Filter | @py_For | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_GeneratorExp | @py_Guard | @py_If | @py_IfExp | @py_ImportMember | @py_ImportStar | @py_KeyValuePair | @py_ListComp | @py_MatchAsPattern | @py_MatchCapturePattern | @py_MatchClassPattern | @py_MatchKeywordPattern | @py_MatchLiteralPattern | @py_MatchStmt | @py_MatchValuePattern | @py_ParamSpec | @py_Print | @py_Raise | @py_Repr | @py_Return | @py_SetComp | @py_Slice | @py_Starred | @py_Subscript | @py_TemplateDottedNotation | @py_TemplateString_list | @py_TemplateWrite | @py_TypeAlias | @py_TypeVar | @py_TypeVarTuple | @py_UnaryExpr | @py_While | @py_With | @py_Yield | @py_YieldFrom | @py_alias | @py_arguments | @py_comprehension | @py_expr_list | @py_keyword | @py_parameter_list;
11131134

11141135
@py_location_parent = @py_DictUnpacking | @py_KeyValuePair | @py_StringPart | @py_comprehension | @py_expr | @py_keyword | @py_pattern | @py_stmt | @py_type_parameter;
11151136

@@ -1125,7 +1146,7 @@ case @py_unaryop.kind of
11251146

11261147
@py_str_list_parent = @py_Global | @py_Nonlocal;
11271148

1128-
@py_str_parent = @py_Attribute | @py_Class | @py_ClassExpr | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_ImportExpr | @py_ImportMember | @py_Module | @py_SpecialOperation | @py_Str | @py_StringPart | @py_TemplateDottedNotation | @py_keyword | @py_str_list;
1149+
@py_str_parent = @py_Attribute | @py_Class | @py_ClassExpr | @py_FormattedValue | @py_Function | @py_FunctionExpr | @py_ImportExpr | @py_ImportMember | @py_Module | @py_SpecialOperation | @py_Str | @py_StringPart | @py_TemplateDottedNotation | @py_TemplateString | @py_TemplateStringPart | @py_keyword | @py_str_list;
11291150

11301151
@py_type_parameter_list_parent = @py_ClassExpr | @py_Function | @py_TypeAlias;
11311152

0 commit comments

Comments
 (0)