Merge pull request #7895 from github/cklin/upgrades-initial-dbscheme

Upgrade scripts testing: set initial dbschemes
This commit is contained in:
Chuan-kai Lin
2022-02-11 11:06:12 -08:00
committed by GitHub
6 changed files with 3831 additions and 1707 deletions

6
.gitattributes vendored
View File

@@ -52,6 +52,12 @@
java/ql/test/stubs/**/*.java linguist-generated=true
java/ql/test/experimental/stubs/**/*.java linguist-generated=true
# For some languages, upgrade script testing references really old dbscheme
# files from legacy upgrades that have CRLF line endings. Since upgrade
# resolution relies on object hashes, we must suppress line ending conversion
# for those testing dbscheme files.
*/ql/lib/upgrades/initial/*.dbscheme -text
# Generated test files - these are synced from the standard JavaScript libraries using
# `javascript/ql/experimental/adaptivethreatmodeling/test/update_endpoint_test_files.py`.
javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/autogenerated/**/*.js linguist-generated=true -merge

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,648 @@
/*
* External artifacts
*/
externalDefects(
unique int id : @externalDefect,
varchar(900) queryPath : string ref,
int location : @location ref,
varchar(900) message : string ref,
float severity : float ref
);
externalMetrics(
unique int id : @externalMetric,
varchar(900) queryPath : string ref,
int location : @location ref,
float value : float ref
);
externalData(
int id : @externalDataElement,
varchar(900) path : string ref,
int column: int ref,
varchar(900) value : string ref
);
snapshotDate(unique date snapshotDate : date ref);
sourceLocationPrefix(varchar(900) prefix : string ref);
/*
* Duplicate code
*/
duplicateCode(
unique int id : @duplication,
varchar(900) relativePath : string ref,
int equivClass : int ref);
similarCode(
unique int id : @similarity,
varchar(900) relativePath : string ref,
int equivClass : int ref);
@duplication_or_similarity = @duplication | @similarity
tokens(
int id : @duplication_or_similarity ref,
int offset : int ref,
int beginLine : int ref,
int beginColumn : int ref,
int endLine : int ref,
int endColumn : int ref);
/*
* Version history
*/
svnentries(
int id : @svnentry,
varchar(500) revision : string ref,
varchar(500) author : string ref,
date revisionDate : date ref,
int changeSize : int ref
)
svnaffectedfiles(
int id : @svnentry ref,
int file : @file ref,
varchar(500) action : string ref
)
svnentrymsg(
int id : @svnentry ref,
varchar(500) message : string ref
)
svnchurn(
int commit : @svnentry ref,
int file : @file ref,
int churnedLines : int ref
)
/*
* Java dbscheme
*/
@location = @location_default ;
locations_default(unique int id: @location_default,
int file: @file ref,
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref
);
hasLocation(int locatableid: @locatable ref, int id: @location ref);
@sourceline = @locatable ;
numlines(int element_id: @sourceline ref,
int num_lines: int ref,
int num_code: int ref,
int num_comment: int ref
);
/*
fromSource(0) = unknown,
fromSource(1) = from source,
fromSource(2) = from library
*/
files(unique int id: @file,
varchar(900) name: string ref,
varchar(900) simple: string ref,
varchar(900) ext: string ref,
int fromSource: int ref);
folders(unique int id: @folder,
varchar(900) name: string ref,
varchar(900) simple: string ref);
@container = @folder | @file
containerparent(int parent: @container ref,
unique int child: @container ref);
cupackage (unique int id: @file ref, int packageid: @package ref);
/* Java */
packages (unique int id: @package,
varchar(900) nodeName: string ref);
primitives (unique int id: @primitive,
varchar(20) nodeName: string ref);
modifiers (unique int id: @modifier,
varchar(20) nodeName: string ref);
classes (unique int id: @class,
varchar(900) nodeName: string ref,
int parentid: @package ref,
int sourceid: @class ref);
interfaces (unique int id: @interface,
varchar(900) nodeName: string ref,
int parentid: @package ref,
int sourceid: @interface ref);
fielddecls (unique int id: @fielddecl,
int parentid: @reftype ref);
fieldDeclaredIn (int fieldId: @field ref,
int fieldDeclId: @fielddecl ref,
int pos: int ref);
fields (unique int id: @field,
varchar(900) nodeName: string ref,
int typeid: @type ref,
int parentid: @reftype ref,
int sourceid: @field ref);
constrs (unique int id: @constructor,
varchar(900) nodeName: string ref,
varchar(900) signature: string ref,
int typeid: @type ref,
int parentid: @reftype ref,
int sourceid: @constructor ref);
methods (unique int id: @method,
varchar(900) nodeName: string ref,
varchar(900) signature: string ref,
int typeid: @type ref,
int parentid: @reftype ref,
int sourceid: @method ref);
params (int id: @param,
varchar(900) nodeName: string ref,
int typeid: @type ref,
int pos: int ref,
int parentid: @callable ref,
int sourceid: @param ref);
exceptions (unique int id: @exception,
int typeid: @type ref,
int parentid: @callable ref);
isAnnotType (int interfaceid: @interface ref);
isAnnotElem (int methodid: @method ref);
// annotValue(annot, id2, value) holds iff
// annot is an application of an annotation @A(v1=n1,...,vk=nk)]
// && id2=vi, value=ni for some i
annotValue (int parentid: @annotation ref,
int id2: @method ref,
unique int value: @expr ref); // unique because source/bytecode expressions are disjoint
isEnumType (int classid: @class ref);
isEnumConst (int fieldid: @field ref);
typeVars (unique int id: @typevariable,
varchar(900) nodeName: string ref,
int pos: int ref,
int kind: int ref, // unused, but kept for backwards compatibility
int parentid: @typeormethod ref);
wildcards (unique int id: @wildcard,
varchar(900) nodeName: string ref,
int kind: int ref);
typeBounds (unique int id: @typebound,
int typeid: @reftype ref, // reftype because there are no primitive bounds
int pos: int ref,
int parentid: @boundedtype ref);
typeArgs (int argumentid: @reftype ref,
int pos: int ref,
int parentid: @typeormethod ref);
isParameterized(int memberid: @member ref);
isRaw (int memberid: @member ref);
erasure (unique int memberid: @member ref,
int erasureid: @member ref);
isAnonymClass (int classid: @class ref,
int parent: @classinstancexpr ref);
isLocalClass (int classid: @class ref,
int parent: @localclassdeclstmt ref);
isDefConstr (int constructorid: @constructor ref);
arrays (unique int id: @array,
varchar(900) nodeName: string ref,
int elementtypeid: @type ref,
int dimension: int ref,
int componenttypeid: @type ref);
enclInReftype (unique int child: @reftype ref,
int parent: @reftype ref);
// id1 extends id2
extendsReftype (int id1: @reftype ref,
int id2: @classorinterface ref);
implInterface (int id1: @classorarray ref,
int id2: @interface ref);
hasModifier (int id1: @modifiable ref,
int id2: @modifier ref);
readsField (unique int id: @readsFieldExpr,
int id1: @callable ref,
int id2: @field ref);
writesField (unique int id: @writesFieldExpr,
int id1: @callable ref,
int id2: @field ref);
callsMethod (unique int id: @makesMethodCallExpr,
int id1: @callable ref,
int id2: @method ref,
int kind: int ref);
callsConstr (unique int id: @makesConstructorCallExpr,
int id1: @callable ref,
int id2: @constructor ref,
int kind: int ref);
imports (unique int id: @import,
int holder: @typeorpackage ref,
varchar(900) name: string ref,
int kind: int ref);
stmts (unique int id: @stmt,
int kind: int ref,
int parent: @stmtparent ref,
int idx: int ref,
int bodydecl: @callable ref);
@stmtparent = @callable | @stmt;
succs(int fromSuccessor: @stmt ref,
int toSuccessor: @stmtparent ref);
case @stmt.kind of
0 = @block
| 1 = @ifstmt
| 2 = @forstmt
| 3 = @enhancedforstmt
| 4 = @whilestmt
| 5 = @dostmt
| 6 = @trystmt
| 7 = @switchstmt
| 8 = @synchronizedstmt
| 9 = @returnstmt
| 10 = @throwstmt
| 11 = @breakstmt
| 12 = @continuestmt
| 13 = @emptystmt
| 14 = @exprstmt
| 15 = @labeledstmt
| 16 = @assertstmt
| 17 = @localvariabledeclstmt
| 18 = @localclassdeclstmt
| 19 = @constructorinvocationstmt
| 20 = @superconstructorinvocationstmt
| 21 = @case
| 22 = @catchclause;
exprs(
unique int id: @expr,
int kind: int ref,
int typeid: @type ref,
int parent: @element ref, // to deal with annotations inside annotations
int idx: int ref
);
callableEnclosingExpr(
unique int id: @expr ref,
int callable_id: @callable ref
);
statementEnclosingExpr(
unique int id: @expr ref,
int statement_id: @stmt ref
);
case @expr.kind of
1 = @arrayaccess
| 2 = @arraycreationexpr
| 3 = @arrayinit
| 4 = @assignexpr
| 5 = @assignaddexpr
| 6 = @assignsubexpr
| 7 = @assignmulexpr
| 8 = @assigndivexpr
| 9 = @assignremexpr
| 10 = @assignandexpr
| 11 = @assignorexpr
| 12 = @assignxorexpr
| 13 = @assignlshiftexpr
| 14 = @assignrshiftexpr
| 15 = @assignurshiftexpr
| 16 = @booleanliteral
| 17 = @integerliteral
| 18 = @longliteral
| 19 = @floatingpointliteral
| 20 = @doubleliteral
| 21 = @characterliteral
| 22 = @stringliteral
| 23 = @nullliteral
| 24 = @mulexpr
| 25 = @divexpr
| 26 = @remexpr
| 27 = @addexpr
| 28 = @subexpr
| 29 = @lshiftexpr
| 30 = @rshiftexpr
| 31 = @urshiftexpr
| 32 = @andbitexpr
| 33 = @orbitexpr
| 34 = @xorbitexpr
| 35 = @andlogicalexpr
| 36 = @orlogicalexpr
| 37 = @ltexpr
| 38 = @gtexpr
| 39 = @leexpr
| 40 = @geexpr
| 41 = @eqexpr
| 42 = @neexpr
| 43 = @postincexpr
| 44 = @postdecexpr
| 45 = @preincexpr
| 46 = @predecexpr
| 47 = @minusexpr
| 48 = @plusexpr
| 49 = @bitnotexpr
| 50 = @lognotexpr
| 51 = @castexpr
| 52 = @classinstancexpr
| 53 = @conditionalexpr
| 54 = @parexpr
| 55 = @instanceofexpr
| 56 = @localvariabledeclexpr
| 57 = @typeliteral
| 58 = @thisaccess
| 59 = @superaccess
| 60 = @varaccess
| 61 = @methodaccess
| 62 = @typeaccess
| 63 = @arraytypeaccess
| 64 = @packageaccess
| 65 = @wildcardtypeaccess
| 66 = @annotation
| 67 = @uniontypeaccess;
@assignment = @assignexpr
| @assignop;
@unaryassignment = @postincexpr
| @postdecexpr
| @preincexpr
| @predecexpr;
@assignop = @assignaddexpr
| @assignsubexpr
| @assignmulexpr
| @assigndivexpr
| @assignremexpr
| @assignandexpr
| @assignorexpr
| @assignxorexpr
| @assignlshiftexpr
| @assignrshiftexpr
| @assignurshiftexpr;
@literal = @booleanliteral
| @integerliteral
| @longliteral
| @floatingpointliteral
| @doubleliteral
| @characterliteral
| @stringliteral
| @nullliteral;
@binaryexpr = @mulexpr
| @divexpr
| @remexpr
| @addexpr
| @subexpr
| @lshiftexpr
| @rshiftexpr
| @urshiftexpr
| @andbitexpr
| @orbitexpr
| @xorbitexpr
| @andlogicalexpr
| @orlogicalexpr
| @ltexpr
| @gtexpr
| @leexpr
| @geexpr
| @eqexpr
| @neexpr;
@unaryexpr = @postincexpr
| @postdecexpr
| @preincexpr
| @predecexpr
| @minusexpr
| @plusexpr
| @bitnotexpr
| @lognotexpr;
@caller = @classinstancexpr
| @methodaccess
| @constructorinvocationstmt
| @superconstructorinvocationstmt;
@abscaller = @caller | @callExpr ;
callableBinding (unique int callerid: @caller ref,
int callee: @callable ref);
@exprparent = @stmt | @expr | @callable | @field | @fielddecl | @class | @interface;
variableBinding (unique int expr: @varaccess ref,
int variable: @variable ref);
@variable = @localvar | @param | @field;
@localorparam = @localvar | @param;
localvars (unique int id: @localvar,
varchar(900) nodeName: string ref,
int typeid: @type ref,
int parentid: @localvariabledeclexpr ref);
@namedexprorstmt =
@breakstmt
| @continuestmt
| @labeledstmt
| @literal;
namestrings (varchar(900) name: string ref,
unique int parent: @namedexprorstmt ref);
javadoc (unique int id: @javadoc);
isNormalComment(int commentid : @javadoc ref);
hasJavadoc (int documentableid: @member ref,
int javadocid: @javadoc ref);
javadocTag (unique int id: @javadocTag,
varchar(900) name: string ref,
int parentid: @javadocParent ref,
int idx: int ref);
javadocText (unique int id: @javadocText,
varchar(900) text: string ref,
int parentid: @javadocParent ref,
int idx: int ref);
@typeorpackage = @type | @package;
@child = @typeorpackage | @typeormethod | @callable;
@modifiable_or_locatable = @modifiable | @locatable_element;
@named_element = @commentable | @modifier_named;
@typeormethod = @type | @method;
@classorinterface = @interface | @class;
@boundedtype = @typevariable | @wildcard;
@reftype = @classorinterface | @array | @boundedtype;
@classorarray = @class | @array;
@type = @primitive | @reftype;
@callable = @method | @constructor;
@element = @file | @package | @primitive | @class | @interface | @method | @constructor | @modifier | @param | @exception | @field |
@annotation | @boundedtype | @array | @localvar | @expr | @stmt | @import | @fielddecl;
@modifiable = @member_modifiable| @param | @localvar ;
@commentable = @package | @modifiable | @locatable_element ;
@package_member = @file | @param | @member ;
@member_modifiable = @class | @interface | @method | @constructor | @field ;
@expression = @callExpr | @fieldAccessExpr;
@fieldAccessExpr = @readsFieldExpr | @writesFieldExpr;
@callExpr = @makesMethodCallExpr | @makesConstructorCallExpr;
@member = @method | @constructor | @field | @reftype ;
@locatable = @file | @class | @interface | @fielddecl | @field | @constructor | @method | @param | @exception
| @boundedtype | @typebound | @array
| @readsFieldExpr | @writesFieldExpr | @makesMethodCallExpr | @makesConstructorCallExpr
| @import | @stmt | @expr | @localvar | @javadoc | @javadocTag | @javadocText
| @xmllocatable | @externalDefect | @externalMetric;
@locatable_element = @file | @class | @interface | @field | @param | @exception | @callable
@named = @param | @member | @package | @typeormethod | @file;
@modifier_named = @modifier | @modifiable | @named;
@javadocParent = @javadoc | @javadocTag;
@javadocElement = @javadocTag | @javadocText;
/* XML Files */
xmlEncoding (unique int id: @file ref, varchar(900) encoding: string ref);
xmlDTDs (unique int id: @xmldtd,
varchar(900) root: string ref,
varchar(900) publicId: string ref,
varchar(900) systemId: string ref,
int fileid: @file ref);
xmlElements (unique int id: @xmlelement,
varchar(900) name: string ref,
int parentid: @xmlparent ref,
int idx: int ref,
int fileid: @file ref);
xmlAttrs (unique int id: @xmlattribute,
int elementid: @xmlelement ref,
varchar(900) name: string ref,
varchar(3600) value: string ref,
int idx: int ref,
int fileid: @file ref);
xmlNs (int id: @xmlnamespace,
varchar(900) prefixName: string ref,
varchar(900) URI: string ref,
int fileid: @file ref);
xmlHasNs (int elementId: @xmlnamespaceable ref,
int nsId: @xmlnamespace ref,
int fileid: @file ref);
xmlComments (unique int id: @xmlcomment,
varchar(3600) text: string ref,
int parentid: @xmlparent ref,
int fileid: @file ref);
xmlChars (unique int id: @xmlcharacters,
varchar(3600) text: string ref,
int parentid: @xmlparent ref,
int idx: int ref,
int isCDATA: int ref,
int fileid: @file ref);
@xmlparent = @file | @xmlelement;
@xmlnamespaceable = @xmlelement | @xmlattribute;
xmllocations(int xmlElement: @xmllocatable ref,
int location: @location_default ref);
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
@top = @element | @locatable | @folder;
/* *** Well-Founded Orders *** */
/* The type hierarchy order */
order:typeOrder(3);
key:extendsReftype.order(id1, id2, typeOrder);
key:implInterface.order(id1, id2, typeOrder);
/* The AST parent-child order */
order:astChildOrder(4);
key:classes.order(id, parentid, astChildOrder); // Transitive
key:interfaces.order(id, parentid, astChildOrder); // Transitive
key:fields.order(id, parentid, astChildOrder);
key:methods.order(id, parentid, astChildOrder);
key:constrs.order(id, parentid, astChildOrder);
key:params.order(id, parentid, astChildOrder);
key:exceptions.order(id, parentid, astChildOrder);
key:typeVars.order(id, parentid, astChildOrder);
key:typeBounds.order(id, parentid, astChildOrder);
key:stmts.order(id,parent,astChildOrder);
key:stmts.order(id,bodydecl,astChildOrder);
key:exprs.order(id,parent,astChildOrder);
key:localvars.order(id,parentid,astChildOrder);
/* Calls and field accesses */
key:readsField.order(id, id1, astChildOrder);
key:writesField.order(id, id1, astChildOrder);
key:callsMethod.order(id, id1, astChildOrder);
key:callsConstr.order(id, id1, astChildOrder);
/* Binary Relations */
key:enclInReftype.order(child, parent, astChildOrder);

View File

@@ -0,0 +1,477 @@
/*** Standard fragments ***/
/** Files and folders **/
@location = @location_default;
locations_default(unique int id: @location_default,
int file: @file ref,
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref
);
@sourceline = @toplevel;
numlines(int element_id: @sourceline ref,
int num_lines: int ref,
int num_code: int ref,
int num_comment: int ref
);
/*
fromSource(0) = unknown,
fromSource(1) = from source,
fromSource(2) = from library
*/
files(unique int id: @file,
varchar(900) name: string ref,
varchar(900) simple: string ref,
varchar(900) ext: string ref,
int fromSource: int ref);
folders(unique int id: @folder,
varchar(900) name: string ref,
varchar(900) simple: string ref);
@container = @folder | @file ;
containerparent(int parent: @container ref,
unique int child: @container ref);
/** Duplicate code **/
duplicateCode(
unique int id : @duplication,
varchar(900) relativePath : string ref,
int equivClass : int ref);
similarCode(
unique int id : @similarity,
varchar(900) relativePath : string ref,
int equivClass : int ref);
@duplication_or_similarity = @duplication | @similarity;
tokens(
int id : @duplication_or_similarity ref,
int offset : int ref,
int beginLine : int ref,
int beginColumn : int ref,
int endLine : int ref,
int endColumn : int ref);
/** External data **/
externalDefects(
unique int id : @externalDefect,
varchar(900) queryPath : string ref,
int location : @location ref,
varchar(900) message : string ref,
float severity : float ref
);
externalMetrics(
unique int id : @externalMetric,
varchar(900) queryPath : string ref,
int location : @location ref,
float value : float ref
);
externalData(
int id : @externalDataElement,
varchar(900) path : string ref,
int column: int ref,
varchar(900) value : string ref
);
snapshotDate(unique date snapshotDate : date ref);
sourceLocationPrefix(varchar(900) prefix : string ref);
/** Version control data **/
svnentries(
int id : @svnentry,
varchar(500) revision : string ref,
varchar(500) author : string ref,
date revisionDate : date ref,
int changeSize : int ref
);
svnaffectedfiles(
int id : @svnentry ref,
int file : @file ref,
varchar(500) action : string ref
);
svnentrymsg(
int id : @svnentry ref,
varchar(500) message : string ref
);
svnchurn(
int commit : @svnentry ref,
int file : @file ref,
int churnedLines : int ref
);
/*** JavaScript-specific part ***/
// top-level code fragments
toplevels (unique int id: @toplevel,
int kind: int ref);
case @toplevel.kind of
0 = @script
| 1 = @inline_script
| 2 = @event_handler
| 3 = @javascript_url;
// statements
stmts (unique int id: @stmt,
int kind: int ref,
int parent: @stmtparent ref,
int idx: int ref,
varchar(900) tostring: string ref);
stmtContainers (int stmt: @stmt ref,
int container: @stmt_container ref);
semicolonInserted (int stmt: @stmt ref);
jumpTargets (int jump: @stmt ref,
int target: @stmt ref);
@stmtparent = @stmt | @toplevel | @functionexpr;
@stmt_container = @toplevel | @functiondecl;
case @stmt.kind of
0 = @emptystmt
| 1 = @blockstmt
| 2 = @exprstmt
| 3 = @ifstmt
| 4 = @labeledstmt
| 5 = @breakstmt
| 6 = @continuestmt
| 7 = @withstmt
| 8 = @switchstmt
| 9 = @returnstmt
| 10 = @throwstmt
| 11 = @trystmt
| 12 = @whilestmt
| 13 = @dowhilestmt
| 14 = @forstmt
| 15 = @forinstmt
| 16 = @debuggerstmt
| 17 = @functiondeclstmt
| 18 = @vardeclstmt
| 19 = @case
| 20 = @catchclause
;
// expressions
exprs (unique int id: @expr,
int kind: int ref,
int parent: @exprparent ref,
int idx: int ref,
varchar(900) tostring: string ref);
literals (varchar(900) value: string ref,
varchar(900) raw: string ref,
unique int expr: @expr ref);
enclosingStmt (int expr: @expr ref,
int stmt: @stmt ref);
arraySize (int ae: @arrayexpr ref,
int sz: int ref);
@exprparent = @expr | @stmt | @property | @vardeclarator;
case @expr.kind of
0 = @identifier
| 1 = @nullliteral
| 2 = @booleanliteral
| 3 = @numberliteral
| 4 = @stringliteral
| 5 = @regexpliteral
| 6 = @thisexpr
| 7 = @arrayexpr
| 8 = @objexpr
| 9 = @functionexpr
| 10 = @seqexpr
| 11 = @conditionalexpr
| 12 = @newexpr
| 13 = @callexpr
| 14 = @dotexpr
| 15 = @indexexpr
| 16 = @negexpr
| 17 = @plusexpr
| 18 = @lognotexpr
| 19 = @bitnotexpr
| 20 = @typeofexpr
| 21 = @voidexpr
| 22 = @deleteexpr
| 23 = @eqexpr
| 24 = @neqexpr
| 25 = @eqqexpr
| 26 = @neqqexpr
| 27 = @ltexpr
| 28 = @leexpr
| 29 = @gtexpr
| 30 = @geexpr
| 31 = @lshiftexpr
| 32 = @rshiftexpr
| 33 = @urshiftexpr
| 34 = @addexpr
| 35 = @subexpr
| 36 = @mulexpr
| 37 = @divexpr
| 38 = @modexpr
| 39 = @bitorexpr
| 40 = @xorexpr
| 41 = @bitandexpr
| 42 = @inexpr
| 43 = @instanceofexpr
| 44 = @logandexpr
| 45 = @logorexpr
| 47 = @assignexpr
| 48 = @assignaddexpr
| 49 = @assignsubexpr
| 50 = @assignmulexpr
| 51 = @assigndivexpr
| 52 = @assignmodexpr
| 53 = @assignlshiftexpr
| 54 = @assignrshiftexpr
| 55 = @assignurshiftexpr
| 56 = @assignorexpr
| 57 = @assignxorexpr
| 58 = @assignandexpr
| 59 = @preincexpr
| 60 = @postincexpr
| 61 = @predecexpr
| 62 = @postdecexpr
| 63 = @parexpr
;
@literal = @nullliteral | @booleanliteral | @numberliteral | @stringliteral | @regexpliteral;
@propaccess = @dotexpr | @indexexpr;
@invokeexpr = @newexpr | @callexpr;
@unaryexpr = @negexpr | @plusexpr | @lognotexpr | @bitnotexpr | @typeofexpr | @voidexpr | @deleteexpr;
@equalitytest = @eqexpr | @neqexpr | @eqqexpr | @neqqexpr;
@comparison = @equalitytest | @ltexpr | @leexpr | @gtexpr | @geexpr;
@binaryexpr = @comparison | @lshiftexpr | @rshiftexpr | @urshiftexpr | @addexpr | @subexpr | @mulexpr | @divexpr | @modexpr | @bitorexpr | @xorexpr | @bitandexpr | @inexpr | @instanceofexpr | @logandexpr | @logorexpr;
@assignment = @assignexpr | @assignaddexpr | @assignsubexpr | @assignmulexpr | @assigndivexpr | @assignmodexpr | @assignlshiftexpr | @assignrshiftexpr | @assignurshiftexpr | @assignorexpr | @assignxorexpr | @assignandexpr;
@updateexpr = @preincexpr | @postincexpr | @predecexpr | @postdecexpr;
// scopes
scopes (unique int id: @scope,
int kind: int ref);
case @scope.kind of
0 = @globalscope
| 1 = @functionscope
| 2 = @catchscope
| 3 = @modulescope;
@scopenode = @functiondecl | @catchclause | @script;
scopenodes (int node: @scopenode ref,
int scope: @scope ref);
scopenesting (int inner: @scope ref,
int outer: @scope ref);
// functions
@functiondecl = @functiondeclstmt | @functionexpr;
@parameterized = @functiondecl | @catchclause;
params (unique int id: @param,
int variable: @variable ref,
varchar(900) name: string ref,
int pos: int ref,
int parent: @parameterized ref);
// variables
variables (unique int id: @variable,
varchar(900) name: string ref,
int scope: @scope ref);
isArgumentsObject (int id: @variable ref);
vardecls (unique int id: @vardeclarator,
int variable: @variable ref,
int parent: @stmt ref,
int pos: int ref,
varchar(900) tostring: string ref);
// function declaration statements and named function expressions implicitly
// declare variables; this table links the function declaration with its variable
functionvars (int func: @functiondecl ref,
int var: @variable ref);
bind (int id: @identifier ref,
int decl: @variable ref);
@vardeclaration = @param | @vardeclarator | @functiondecl;
// properties in object literals
properties (unique int id: @property,
int parent: @objexpr ref,
int index: int ref,
int kind: int ref, // 0 - normal, 1 - getter, 2 - setter
varchar(900) tostring: string ref);
// comments
comments (unique int id: @comment,
int kind: int ref,
int toplevel: @toplevel ref,
varchar(900) text: string ref,
varchar(900) tostring: string ref);
case @comment.kind of
0 = @slashslashcomment
| 1 = @slashstarcomment
| 2 = @doccomment
| 3 = @htmlcommentstart
| 4 = @htmlcommentend;
@htmlcomment = @htmlcommentstart | @htmlcommentend;
@linecomment = @slashslashcomment | @htmlcomment;
@blockcomment = @slashstarcomment | @doccomment;
// source lines
lines (unique int id: @line,
int toplevel: @toplevel ref,
varchar(900) text: string ref,
varchar(2) terminator: string ref);
// errors
errors (unique int id: @error,
int kind: int ref,
int toplevel: @toplevel ref,
varchar(900) message: string ref);
case @error.kind of
0 = @parseerror;
// regular expressions
regexpterm (unique int id: @regexpterm,
int kind: int ref,
int parent: @regexpparent ref,
int idx: int ref,
varchar(900) tostring: string ref);
@regexpparent = @regexpterm | @regexpliteral;
case @regexpterm.kind of
0 = @regexp_alt
| 1 = @regexp_seq
| 2 = @regexp_caret
| 3 = @regexp_dollar
| 4 = @regexp_wordboundary
| 5 = @regexp_nonwordboundary
| 6 = @regexp_positive_lookahead
| 7 = @regexp_negative_lookahead
| 8 = @regexp_star
| 9 = @regexp_plus
| 10 = @regexp_opt
| 11 = @regexp_range
| 12 = @regexp_dot
| 13 = @regexp_group
| 14 = @regexp_normal_char
| 15 = @regexp_hex_escape
| 16 = @regexp_unicode_escape
| 17 = @regexp_dec_escape
| 18 = @regexp_oct_escape
| 19 = @regexp_ctrl_escape
| 20 = @regexp_char_class_escape
| 21 = @regexp_id_escape
| 22 = @regexp_backref
| 23 = @regexp_char_class
| 24 = @regexp_char_range;
regexpParseErrors (unique int id: @regexp_parse_error,
int kind: int ref,
int regexp: @regexpterm ref);
case @regexp_parse_error.kind of
0 = @regexp_parse_error_unexpected_eos
| 1 = @regexp_parse_error_unexpected_char
| 2 = @regexp_parse_error_expected_digit
| 3 = @regexp_parse_error_expected_hex_digit
| 4 = @regexp_parse_error_expected_control_letter
| 5 = @regexp_parse_error_expected_closing_paren
| 6 = @regexp_parse_error_expected_closing_brace
| 7 = @regexp_parse_error_expected_eos
| 8 = @regexp_parse_error_octal_escape
| 9 = @regexp_parse_error_invalid_backref;
@regexp_quantifier = @regexp_star | @regexp_plus | @regexp_opt | @regexp_range;
@regexp_escape = @regexp_char_escape | @regexp_char_class_escape;
@regexp_char_escape = @regexp_hex_escape | @regexp_unicode_escape | @regexp_dec_escape | @regexp_oct_escape | @regexp_ctrl_escape | @regexp_id_escape;
@regexp_constant = @regexp_normal_char | @regexp_char_escape;
isGreedy (int id: @regexp_quantifier ref);
rangeQuantifierLowerBound (int id: @regexp_range ref, int lo: int ref);
rangeQuantifierUpperBound (int id: @regexp_range ref, int hi: int ref);
isCapture (int id: @regexp_group ref, int number: int ref);
isInverted (int id: @regexp_char_class ref);
regexpConstValue (int id: @regexp_constant ref, varchar(1) value: string ref);
charClassEscape (int id: @regexp_char_class_escape ref, varchar(1) value: string ref);
backref (int id: @regexp_backref ref, int value: int ref);
// tokens
tokeninfo (unique int id: @token,
int kind: int ref,
int toplevel: @toplevel ref,
int idx: int ref,
varchar(900) value: string ref);
case @token.kind of
0 = @token_eof
| 1 = @token_null_literal
| 2 = @token_boolean_literal
| 3 = @token_numeric_literal
| 4 = @token_string_literal
| 5 = @token_regular_expression
| 6 = @token_identifier
| 7 = @token_keyword
| 8 = @token_punctuator;
// locations
@locatable = @file
| @toplevel | @stmt | @expr | @property | @vardeclaration
| @comment
| @line
| @error | @regexp_parse_error
| @regexpterm
| @token;
hasLocation (int locatable: @locatable ref,
int location: @location ref);
// Closure externs
external_global (unique int id: @external_global, varchar(900) name: string ref);
external_member (unique int id: @external_member, varchar(900) name: string ref, int parent: @external_entity ref);
external_function (unique int id: @external_function, int decl: @external_decl ref);
external_object (unique int id: @external_object, int decl: @external_decl ref);
@external_decl = @external_global | @external_member;
@external_entity = @external_function | @external_object;

View File

@@ -0,0 +1,837 @@
/*
* This dbscheme is auto-generated by 'semmle/dbscheme_gen.py'.
* WARNING: Any modifications to this file will be lost.
* Relations can be changed by modifying master.py or
* by adding rules to dbscheme.template
*/
/*
* External artifacts
*/
externalDefects(
unique int id : @externalDefect,
varchar(900) queryPath : string ref,
int location : @location ref,
varchar(900) message : string ref,
float severity : float ref
);
externalMetrics(
unique int id : @externalMetric,
varchar(900) queryPath : string ref,
int location : @location ref,
float value : float ref
);
externalData(
int id : @externalDataElement,
varchar(900) queryPath : string ref,
int column: int ref,
varchar(900) data : string ref
);
snapshotDate(unique date snapshotDate : date ref);
sourceLocationPrefix(varchar(900) prefix : string ref);
/*
* Duplicate code
*/
duplicateCode(
unique int id : @duplication,
varchar(900) relativePath : string ref,
int equivClass : int ref);
similarCode(
unique int id : @similarity,
varchar(900) relativePath : string ref,
int equivClass : int ref);
@duplication_or_similarity = @duplication | @similarity
tokens(
int id : @duplication_or_similarity ref,
int offset : int ref,
int beginLine : int ref,
int beginColumn : int ref,
int endLine : int ref,
int endColumn : int ref);
/*
* Line metrics
*/
py_codelines(int id : @py_scope ref,
int count : int ref);
py_commentlines(int id : @py_scope ref,
int count : int ref);
py_docstringlines(int id : @py_scope ref,
int count : int ref);
py_alllines(int id : @py_scope ref,
int count : int ref);
/*
* Version history
*/
svnentries(
int id : @svnentry,
varchar(500) revision : string ref,
varchar(500) author : string ref,
date revisionDate : date ref,
int changeSize : int ref
)
svnaffectedfiles(
int id : @svnentry ref,
int file : @file ref,
varchar(500) action : string ref
)
svnentrymsg(
int id : @svnentry ref,
varchar(500) message : string ref
)
svnchurn(
int commit : @svnentry ref,
int file : @file ref,
int churnedLines : int ref
)
/****************************
Python dbscheme
****************************/
/*
fromSource(0) = unknown,
fromSource(1) = from source,
fromSource(2) = from library
*/
files(unique int id: @file,
varchar(900) name: string ref,
varchar(900) simple: string ref,
varchar(900) ext: string ref,
int fromSource: int ref);
folders(unique int id: @folder,
varchar(900) name: string ref,
varchar(900) simple: string ref);
@container = @folder | @file;
containerparent(int parent: @container ref,
unique int child: @container ref);
@sourceline = @file | @py_Module;
numlines(int element_id: @sourceline ref,
int num_lines: int ref,
int num_code: int ref,
int num_comment: int ref
);
@location = @location_ast | @location_default ;
locations_default(unique int id: @location_default,
int file: @file ref,
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref);
locations_ast(unique int id: @location_ast,
int module: @py_Module ref,
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref);
py_module_path(int module: @py_Module ref, int file: @file ref);
variable(unique int id : @py_variable,
int scope : @py_scope ref,
varchar(1) name : string ref);
py_line_lengths(unique int id : @py_line,
int file: @py_Module ref,
int line : int ref,
int length : int ref);
/* AUTO GENERATED PART STARTS HERE */
/* <Field> Assert.location = 0, location */
/* <Field> Assert.test = 1, expr */
/* <Field> Assert.msg = 2, expr */
/* <Field> Assign.location = 0, location */
/* <Field> Assign.value = 1, expr */
/* <Field> Assign.targets = 2, expr_list */
/* <Field> Attribute.location = 0, location */
/* <Field> Attribute.value = 1, expr */
/* <Field> Attribute.attr = 2, str */
/* <Field> Attribute.ctx = 3, expr_context */
/* <Field> AugAssign.location = 0, location */
/* <Field> AugAssign.operation = 1, BinOp */
/* <Field> BinaryExpr.location = 0, location */
/* <Field> BinaryExpr.left = 1, expr */
/* <Field> BinaryExpr.op = 2, operator */
/* <Field> BinaryExpr.right = 3, expr */
/* <Parent> BinaryExpr = AugAssign */
/* <Field> BoolExpr.location = 0, location */
/* <Field> BoolExpr.op = 1, boolop */
/* <Field> BoolExpr.values = 2, expr_list */
/* <Field> Break.location = 0, location */
/* <Field> Bytes.location = 0, location */
/* <Field> Bytes.s = 1, bytes */
/* <Field> Call.location = 0, location */
/* <Field> Call.func = 1, expr */
/* <Field> Call.args = 2, expr_list */
/* <Field> Call.keywords = 3, keyword_list */
/* <Field> Call.starargs = 4, expr */
/* <Field> Call.kwargs = 5, expr */
/* <Field> Class.name = 0, str */
/* <Field> Class.body = 1, stmt_list */
/* <Parent> Class = ClassExpr */
/* <Field> ClassExpr.location = 0, location */
/* <Field> ClassExpr.name = 1, str */
/* <Field> ClassExpr.bases = 2, expr_list */
/* <Field> ClassExpr.keywords = 3, keyword_list */
/* <Field> ClassExpr.starargs = 4, expr */
/* <Field> ClassExpr.kwargs = 5, expr */
/* <Field> ClassExpr.inner_scope = 6, Class */
/* <Field> Compare.location = 0, location */
/* <Field> Compare.left = 1, expr */
/* <Field> Compare.ops = 2, cmpop_list */
/* <Field> Compare.comparators = 3, expr_list */
/* <Field> Continue.location = 0, location */
/* <Field> Delete.location = 0, location */
/* <Field> Delete.targets = 1, expr_list */
/* <Field> Dict.location = 0, location */
/* <Field> Dict.keys = 1, expr_list */
/* <Field> Dict.values = 2, expr_list */
/* <Field> DictComp.location = 0, location */
/* <Field> DictComp.function = 1, Function */
/* <Field> DictComp.iterable = 2, expr */
/* <Field> Ellipsis.location = 0, location */
/* <Field> ExceptStmt.location = 0, location */
/* <Field> ExceptStmt.type = 1, expr */
/* <Field> ExceptStmt.name = 2, expr */
/* <Field> ExceptStmt.body = 3, stmt_list */
/* <Field> Exec.location = 0, location */
/* <Field> Exec.body = 1, expr */
/* <Field> Exec.globals = 2, expr */
/* <Field> Exec.locals = 3, expr */
/* <Field> ExprStmt.location = 0, location */
/* <Field> ExprStmt.value = 1, expr */
/* <Field> For.location = 0, location */
/* <Field> For.target = 1, expr */
/* <Field> For.iter = 2, expr */
/* <Field> For.body = 3, stmt_list */
/* <Field> For.orelse = 4, stmt_list */
/* <Field> Function.name = 0, str */
/* <Field> Function.args = 1, parameter_list */
/* <Field> Function.vararg = 2, expr */
/* <Field> Function.kwonlyargs = 3, str_list */
/* <Field> Function.kwarg = 4, expr */
/* <Field> Function.body = 5, stmt_list */
/* <Parent> Function = FunctionParent */
/* <Field> FunctionExpr.location = 0, location */
/* <Field> FunctionExpr.name = 1, str */
/* <Field> FunctionExpr.args = 2, arguments */
/* <Field> FunctionExpr.returns = 3, expr */
/* <Field> FunctionExpr.inner_scope = 4, Function */
/* <Field> GeneratorExp.location = 0, location */
/* <Field> GeneratorExp.function = 1, Function */
/* <Field> GeneratorExp.iterable = 2, expr */
/* <Field> Global.location = 0, location */
/* <Field> Global.names = 1, str_list */
/* <Field> If.location = 0, location */
/* <Field> If.test = 1, expr */
/* <Field> If.body = 2, stmt_list */
/* <Field> If.orelse = 3, stmt_list */
/* <Field> IfExp.location = 0, location */
/* <Field> IfExp.test = 1, expr */
/* <Field> IfExp.body = 2, expr */
/* <Field> IfExp.orelse = 3, expr */
/* <Field> Import.location = 0, location */
/* <Field> Import.names = 1, alias_list */
/* <Field> ImportExpr.location = 0, location */
/* <Field> ImportExpr.level = 1, int */
/* <Field> ImportExpr.name = 2, str */
/* <Field> ImportExpr.top = 3, bool */
/* <Field> ImportStar.location = 0, location */
/* <Field> ImportStar.module = 1, expr */
/* <Field> ImportMember.location = 0, location */
/* <Field> ImportMember.module = 1, expr */
/* <Field> ImportMember.name = 2, str */
/* <Field> Lambda.location = 0, location */
/* <Field> Lambda.args = 1, arguments */
/* <Field> Lambda.inner_scope = 2, Function */
/* <Field> List.location = 0, location */
/* <Field> List.elts = 1, expr_list */
/* <Field> List.ctx = 2, expr_context */
/* <Field> ListComp.location = 0, location */
/* <Field> ListComp.function = 1, Function */
/* <Field> ListComp.iterable = 2, expr */
/* <Field> ListComp.generators = 3, comprehension_list */
/* <Field> ListComp.elt = 4, expr */
/* <Field> Module.name = 0, str */
/* <Field> Module.hash = 1, str */
/* <Field> Module.body = 2, stmt_list */
/* <Field> Module.kind = 3, str */
/* <Field> Name.location = 0, location */
/* <Field> Name.variable = 1, variable */
/* <Field> Name.ctx = 2, expr_context */
/* <Parent> Name = ParameterList */
/* <Field> Nonlocal.location = 0, location */
/* <Field> Nonlocal.names = 1, str_list */
/* <Field> Num.location = 0, location */
/* <Field> Num.n = 1, number */
/* <Field> Num.text = 2, number */
/* <Field> Pass.location = 0, location */
/* <Field> Print.location = 0, location */
/* <Field> Print.dest = 1, expr */
/* <Field> Print.values = 2, expr_list */
/* <Field> Print.nl = 3, bool */
/* <Field> Raise.location = 0, location */
/* <Field> Raise.exc = 1, expr */
/* <Field> Raise.cause = 2, expr */
/* <Field> Raise.type = 3, expr */
/* <Field> Raise.inst = 4, expr */
/* <Field> Raise.tback = 5, expr */
/* <Field> Repr.location = 0, location */
/* <Field> Repr.value = 1, expr */
/* <Field> Return.location = 0, location */
/* <Field> Return.value = 1, expr */
/* <Field> Set.location = 0, location */
/* <Field> Set.elts = 1, expr_list */
/* <Field> SetComp.location = 0, location */
/* <Field> SetComp.function = 1, Function */
/* <Field> SetComp.iterable = 2, expr */
/* <Field> Slice.location = 0, location */
/* <Field> Slice.start = 1, expr */
/* <Field> Slice.stop = 2, expr */
/* <Field> Slice.step = 3, expr */
/* <Field> Starred.location = 0, location */
/* <Field> Starred.value = 1, expr */
/* <Field> Starred.ctx = 2, expr_context */
/* <Field> Str.location = 0, location */
/* <Field> Str.s = 1, str */
/* <Field> Subscript.location = 0, location */
/* <Field> Subscript.value = 1, expr */
/* <Field> Subscript.index = 2, expr */
/* <Field> Subscript.ctx = 3, expr_context */
/* <Field> Try.location = 0, location */
/* <Field> Try.body = 1, stmt_list */
/* <Field> Try.orelse = 2, stmt_list */
/* <Field> Try.handlers = 3, stmt_list */
/* <Field> Try.finalbody = 4, stmt_list */
/* <Field> Tuple.location = 0, location */
/* <Field> Tuple.elts = 1, expr_list */
/* <Field> Tuple.ctx = 2, expr_context */
/* <Parent> Tuple = ParameterList */
/* <Field> UnaryExpr.location = 0, location */
/* <Field> UnaryExpr.op = 1, unaryop */
/* <Field> UnaryExpr.operand = 2, expr */
/* <Field> While.location = 0, location */
/* <Field> While.test = 1, expr */
/* <Field> While.body = 2, stmt_list */
/* <Field> While.orelse = 3, stmt_list */
/* <Field> With.location = 0, location */
/* <Field> With.context_expr = 1, expr */
/* <Field> With.optional_vars = 2, expr */
/* <Field> With.body = 3, stmt_list */
/* <Field> Yield.location = 0, location */
/* <Field> Yield.value = 1, expr */
/* <Field> YieldFrom.location = 0, location */
/* <Field> YieldFrom.value = 1, expr */
/* <Field> Alias.value = 0, expr */
/* <Field> Alias.asname = 1, expr */
/* <Parent> Alias = AliasList */
/* <Parent> AliasList = Import */
/* <Field> Arguments.kw_defaults = 0, expr_list */
/* <Field> Arguments.defaults = 1, expr_list */
/* <Field> Arguments.annotations = 2, expr_list */
/* <Field> Arguments.varargannotation = 3, expr */
/* <Field> Arguments.kwargannotation = 4, expr */
/* <Parent> Arguments = ArgumentsParent */
/* <Parent> boolean = BoolParent */
/* <Parent> Boolop = BoolExpr */
/* <Parent> string = Bytes */
/* <Parent> Cmpop = CmpopList */
/* <Parent> CmpopList = Compare */
/* <Field> Comprehension.iter = 0, expr */
/* <Field> Comprehension.target = 1, expr */
/* <Field> Comprehension.ifs = 2, expr_list */
/* <Parent> Comprehension = ComprehensionList */
/* <Parent> ComprehensionList = ListComp */
/* <Field> Expr.location = 0, location */
/* <Parent> Expr = ExprParent */
/* <Parent> ExprContext = ExprContextParent */
/* <Parent> ExprList = ExprListParent */
/* <Parent> int = ImportExpr */
/* <Field> Keyword.arg = 0, str */
/* <Field> Keyword.value = 1, expr */
/* <Parent> Keyword = KeywordList */
/* <Parent> KeywordList = KeywordListParent */
/* <Parent> Location = ExprOrStmt */
/* <Parent> string = Num */
/* <Parent> Operator = BinaryExpr */
/* <Parent> ParameterList = Function */
/* <Field> Stmt.location = 0, location */
/* <Parent> Stmt = StmtList */
/* <Parent> StmtList = StmtListParent */
/* <Parent> string = StrParent */
/* <Parent> StringList = StrListParent */
/* <Parent> Unaryop = UnaryExpr */
/* <Parent> Variable = Name */
py_Classes(unique int id : @py_Class,
unique int parent : @py_ClassExpr ref);
py_Functions(unique int id : @py_Function,
int parent : @py_Function_parent ref,
int idx : int ref);
py_Modules(unique int id : @py_Module);
py_aliases(unique int id : @py_alias,
int parent : @py_alias_list ref,
int idx : int ref);
py_alias_lists(unique int id : @py_alias_list,
unique int parent : @py_Import ref);
py_arguments(unique int id : @py_arguments,
int parent : @py_arguments_parent ref,
int idx : int ref);
py_bools(boolean id : boolean ref,
unique int parent : @py_bool_parent ref);
py_boolops(unique int id : @py_boolop,
int kind: int ref,
unique int parent : @py_BoolExpr ref);
py_bytes(varchar(1) id : string ref,
unique int parent : @py_Bytes ref);
py_cmpops(unique int id : @py_cmpop,
int kind: int ref,
int parent : @py_cmpop_list ref,
int idx : int ref);
py_cmpop_lists(unique int id : @py_cmpop_list,
unique int parent : @py_Compare ref);
py_comprehensions(unique int id : @py_comprehension,
int parent : @py_comprehension_list ref,
int idx : int ref);
py_comprehension_lists(unique int id : @py_comprehension_list,
unique int parent : @py_ListComp ref);
py_exprs(unique int id : @py_expr,
int kind: int ref,
int parent : @py_expr_parent ref,
int idx : int ref);
py_expr_contexts(unique int id : @py_expr_context,
int kind: int ref,
int parent : @py_expr_context_parent ref,
int idx : int ref);
py_expr_lists(unique int id : @py_expr_list,
int parent : @py_expr_list_parent ref,
int idx : int ref);
py_ints(int id : int ref,
unique int parent : @py_ImportExpr ref);
py_keywords(unique int id : @py_keyword,
int parent : @py_keyword_list ref,
int idx : int ref);
py_keyword_lists(unique int id : @py_keyword_list,
unique int parent : @py_keyword_list_parent ref);
py_locations(unique int id : @location ref,
unique int parent : @py_expr_or_stmt ref);
py_numbers(varchar(1) id : string ref,
int parent : @py_Num ref,
int idx : int ref);
py_operators(unique int id : @py_operator,
int kind: int ref,
unique int parent : @py_BinaryExpr ref);
py_parameter_lists(unique int id : @py_parameter_list,
unique int parent : @py_Function ref);
py_stmts(unique int id : @py_stmt,
int kind: int ref,
int parent : @py_stmt_list ref,
int idx : int ref);
py_stmt_lists(unique int id : @py_stmt_list,
int parent : @py_stmt_list_parent ref,
int idx : int ref);
py_strs(varchar(1) id : string ref,
int parent : @py_str_parent ref,
int idx : int ref);
py_str_lists(unique int id : @py_str_list,
int parent : @py_str_list_parent ref,
int idx : int ref);
py_unaryops(unique int id : @py_unaryop,
int kind: int ref,
unique int parent : @py_UnaryExpr ref);
py_variables(int id : @py_variable ref,
unique int parent : @py_Name ref);
@py_Function_parent = @py_DictComp | @py_FunctionExpr | @py_GeneratorExp | @py_Lambda | @py_ListComp | @py_SetComp;
@py_arguments_parent = @py_FunctionExpr | @py_Lambda;
@py_ast_node = @py_Class | @py_Function | @py_Module | @py_expr | @py_stmt;
@py_bool_parent = @py_ImportExpr | @py_Print;
case @py_boolop.kind of
0 = @py_And
| 1 = @py_Or;
case @py_cmpop.kind of
0 = @py_Eq
| 1 = @py_Gt
| 2 = @py_GtE
| 3 = @py_In
| 4 = @py_Is
| 5 = @py_IsNot
| 6 = @py_Lt
| 7 = @py_LtE
| 8 = @py_NotEq
| 9 = @py_NotIn;
case @py_expr.kind of
0 = @py_Attribute
| 1 = @py_BinaryExpr
| 2 = @py_BoolExpr
| 3 = @py_Bytes
| 4 = @py_Call
| 5 = @py_ClassExpr
| 6 = @py_Compare
| 7 = @py_Dict
| 8 = @py_DictComp
| 9 = @py_Ellipsis
| 10 = @py_FunctionExpr
| 11 = @py_GeneratorExp
| 12 = @py_IfExp
| 13 = @py_ImportExpr
| 14 = @py_ImportMember
| 15 = @py_Lambda
| 16 = @py_List
| 17 = @py_ListComp
| 18 = @py_Name
| 19 = @py_Num
| 20 = @py_Repr
| 21 = @py_Set
| 22 = @py_SetComp
| 23 = @py_Slice
| 24 = @py_Starred
| 25 = @py_Str
| 26 = @py_Subscript
| 27 = @py_Tuple
| 28 = @py_UnaryExpr
| 29 = @py_Yield
| 30 = @py_YieldFrom;
case @py_expr_context.kind of
0 = @py_AugLoad
| 1 = @py_AugStore
| 2 = @py_Del
| 3 = @py_Load
| 4 = @py_Param
| 5 = @py_Store;
@py_expr_context_parent = @py_Attribute | @py_List | @py_Name | @py_Starred | @py_Subscript | @py_Tuple;
@py_expr_list_parent = @py_Assign | @py_BoolExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_Delete | @py_Dict | @py_List | @py_Print | @py_Set | @py_Tuple | @py_arguments | @py_comprehension;
@py_expr_or_stmt = @py_expr | @py_stmt;
@py_expr_parent = @py_Assert | @py_Assign | @py_Attribute | @py_AugAssign | @py_BinaryExpr | @py_Call | @py_ClassExpr | @py_Compare | @py_DictComp | @py_ExceptStmt | @py_Exec | @py_Expr_stmt | @py_For | @py_Function | @py_FunctionExpr | @py_GeneratorExp | @py_If | @py_IfExp | @py_ImportMember | @py_ImportStar | @py_ListComp | @py_Print | @py_Raise | @py_Repr | @py_Return | @py_SetComp | @py_Slice | @py_Starred | @py_Subscript | @py_UnaryExpr | @py_While | @py_With | @py_Yield | @py_YieldFrom | @py_alias | @py_arguments | @py_comprehension | @py_expr_list | @py_keyword | @py_parameter_list;
@py_keyword_list_parent = @py_Call | @py_ClassExpr;
case @py_operator.kind of
0 = @py_Add
| 1 = @py_BitAnd
| 2 = @py_BitOr
| 3 = @py_BitXor
| 4 = @py_Div
| 5 = @py_FloorDiv
| 6 = @py_LShift
| 7 = @py_Mod
| 8 = @py_Mult
| 9 = @py_Pow
| 10 = @py_RShift
| 11 = @py_Sub;
@py_parameter = @py_Name | @py_Tuple;
@py_scope = @py_Class | @py_Function | @py_Module;
case @py_stmt.kind of
0 = @py_Assert
| 1 = @py_Assign
| 2 = @py_AugAssign
| 3 = @py_Break
| 4 = @py_Continue
| 5 = @py_Delete
| 6 = @py_ExceptStmt
| 7 = @py_Exec
| 8 = @py_Expr_stmt
| 9 = @py_For
| 10 = @py_Global
| 11 = @py_If
| 12 = @py_Import
| 13 = @py_ImportStar
| 14 = @py_Nonlocal
| 15 = @py_Pass
| 16 = @py_Print
| 17 = @py_Raise
| 18 = @py_Return
| 19 = @py_Try
| 20 = @py_While
| 21 = @py_With;
@py_stmt_list_parent = @py_Class | @py_ExceptStmt | @py_For | @py_Function | @py_If | @py_Module | @py_Try | @py_While | @py_With;
@py_str_list_parent = @py_Function | @py_Global | @py_Nonlocal;
@py_str_parent = @py_Attribute | @py_Class | @py_ClassExpr | @py_Function | @py_FunctionExpr | @py_ImportExpr | @py_ImportMember | @py_Module | @py_Str | @py_keyword | @py_str_list;
case @py_unaryop.kind of
0 = @py_Invert
| 1 = @py_Not
| 2 = @py_UAdd
| 3 = @py_USub;
/*
* End of auto-generated part
*/
/* Map relative names to absolute names for imports */
py_absolute_names(int module : @py_Module ref,
varchar(1) relname : string ref,
varchar(1) absname : string ref);
py_exports(int id : @py_Module ref,
varchar(1) name : string ref);
/* Successor information */
py_successors(int predecessor : @py_flow_node ref,
int successor : @py_flow_node ref);
py_true_successors(int predecessor : @py_flow_node ref,
int successor : @py_flow_node ref);
py_exception_successors(int predecessor : @py_flow_node ref,
int successor : @py_flow_node ref);
py_false_successors(int predecessor : @py_flow_node ref,
int successor : @py_flow_node ref);
py_flow_bb_node(unique int flownode : @py_flow_node,
int realnode : @py_ast_node ref,
int basicblock : @py_flow_node ref,
int index : int ref);
py_scope_flow(int flow : @py_flow_node ref,
int scope : @py_scope ref,
int kind : int ref);
py_idoms(unique int node : @py_flow_node ref,
int immediate_dominator : @py_flow_node ref);
py_ssa_phi(int phi : @py_ssa_var ref,
int arg: @py_ssa_var ref);
py_ssa_var(unique int id : @py_ssa_var,
int var : @py_variable ref);
py_ssa_use(int node: @py_flow_node ref,
int var : @py_ssa_var ref);
py_ssa_defn(unique int id : @py_ssa_var ref,
int node: @py_flow_node ref);
@py_base_var = @py_variable | @py_ssa_var;
py_scopes(unique int node : @py_expr_or_stmt ref,
int scope : @py_scope ref);
py_scope_location(unique int id : @location ref,
unique int scope : @py_scope ref);
py_flags(unique varchar(1) name : string ref,
varchar(1) value : string ref);
py_syntax_error(unique int id : @location ref,
varchar(1) message : string ref);
py_comments(unique int id : @py_comment,
varchar(1) text : string ref,
unique int location : @location ref);
/* Type information support */
py_cobjects(unique int obj : @py_cobject,
int typeof : @py_cobject ref);
py_cmembers(int object : @py_cobject ref,
varchar(1) name : string ref,
int member : @py_cobject ref);
py_citems(int object : @py_cobject ref,
int index : int ref,
int member : @py_cobject ref);
py_cobjectnames(unique int obj : @py_cobject ref,
varchar(1) name : string ref);
py_special_objects(unique int obj : @py_cobject ref,
unique varchar(1) name : string ref);
py_decorated_object(int object : @py_object ref,
int level: int ref);
@py_object = @py_cobject | @py_flow_node;
@py_source_element = @py_ast_node | @container;
/* XML Files */
xmlEncoding (unique int id: @file ref, varchar(900) encoding: string ref);
xmlDTDs (unique int id: @xmldtd,
varchar(900) root: string ref,
varchar(900) publicId: string ref,
varchar(900) systemId: string ref,
int fileid: @file ref);
xmlElements (unique int id: @xmlelement,
varchar(900) name: string ref,
int parentid: @xmlparent ref,
int idx: int ref,
int fileid: @file ref);
xmlAttrs (unique int id: @xmlattribute,
int elementid: @xmlelement ref,
varchar(900) name: string ref,
varchar(3600) value: string ref,
int idx: int ref,
int fileid: @file ref);
xmlNs (int id: @xmlnamespace,
varchar(900) prefixName: string ref,
varchar(900) URI: string ref,
int fileid: @file ref);
xmlHasNs (int elementId: @xmlnamespaceable ref,
int nsId: @xmlnamespace ref,
int fileid: @file ref);
xmlComments (unique int id: @xmlcomment,
varchar(3600) text: string ref,
int parentid: @xmlparent ref,
int fileid: @file ref);
xmlChars (unique int id: @xmlcharacters,
varchar(3600) text: string ref,
int parentid: @xmlparent ref,
int idx: int ref,
int isCDATA: int ref,
int fileid: @file ref);
@xmlparent = @file | @xmlelement;
@xmlnamespaceable = @xmlelement | @xmlattribute;
xmllocations(int xmlElement: @xmllocatable ref,
int location: @location_default ref);
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;