Skip to content

Commit c5be3fb

Browse files
committed
add missing syntax for parameterised module declaration
1 parent 41df8ca commit c5be3fb

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

docs/codeql/ql-language-reference/ql-language-specification.rst

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ A QL module definition has the following syntax:
176176

177177
::
178178

179-
module ::= annotation* "module" modulename "{" moduleBody "}"
179+
module ::= annotation* "module" modulename parameters? implements? "{" moduleBody "}"
180+
181+
parameters ::= "<" signatureExpr simpleId ("," signatureExpr simpleId)* ">"
182+
183+
implements ::= "implements" moduleSignatureExpr ("," moduleSignatureExpr)*
180184

181185
moduleBody ::= (import | predicate | class | module | alias | select)*
182186

@@ -212,8 +216,11 @@ An import directive refers to a module identifier:
212216

213217
qualId ::= simpleId | qualId "." simpleId
214218

215-
importModuleExpr ::= qualId
216-
| importModuleExpr "::" simpleId
219+
importModuleExpr ::= qualId | importModuleExpr "::" simpleId arguments?
220+
221+
arguments ::= "<" argument ("," argument)* ">"
222+
223+
argument ::= moduleExpr | type | predicateRef "/" int
217224

218225
An import directive may optionally name the imported module using an ``as`` declaration. If a name is defined, then the import directive adds to the declared module environment of the current module a mapping from the name to the declaration of the imported module. Otherwise, the current module *directly imports* the imported module.
219226

@@ -282,7 +289,7 @@ With the exception of class domain types and character types (which cannot be re
282289

283290
type ::= (moduleExpr "::")? classname | dbasetype | "boolean" | "date" | "float" | "int" | "string"
284291

285-
moduleExpr ::= simpleId | moduleExpr "::" simpleId
292+
moduleExpr ::= simpleId arguments? | moduleExpr "::" simpleId arguments?
286293

287294
A type reference is resolved to a type as follows:
288295

@@ -2064,16 +2071,23 @@ The complete grammar for QL is as follows:
20642071

20652072
ql ::= qldoc? moduleBody
20662073

2067-
module ::= annotation* "module" modulename "{" moduleBody "}"
2074+
module ::= annotation* "module" modulename parameters? implements? "{" moduleBody "}"
2075+
2076+
parameters ::= "<" signatureExpr simpleId ("," signatureExpr simpleId)* ">"
2077+
2078+
implements ::= "implements" moduleSignatureExpr ("," moduleSignatureExpr)*
20682079

20692080
moduleBody ::= (import | predicate | class | module | alias | select)*
20702081

20712082
import ::= annotations "import" importModuleExpr ("as" modulename)?
20722083

20732084
qualId ::= simpleId | qualId "." simpleId
20742085

2075-
importModuleExpr ::= qualId
2076-
| importModuleExpr "::" simpleId
2086+
importModuleExpr ::= qualId | importModuleExpr "::" simpleId arguments?
2087+
2088+
arguments ::= "<" argument ("," argument)* ">"
2089+
2090+
argument ::= moduleExpr | type | predicateRef "/" int
20772091

20782092
select ::= ("from" var_decls)? ("where" formula)? "select" as_exprs ("order" "by" orderbys)?
20792093

@@ -2120,7 +2134,11 @@ The complete grammar for QL is as follows:
21202134

21212135
field ::= qldoc? annotations var_decl ";"
21222136

2123-
moduleExpr ::= simpleId | moduleExpr "::" simpleId
2137+
moduleExpr ::= simpleId arguments? | moduleExpr "::" simpleId arguments?
2138+
2139+
moduleSignatureExpr ::= (moduleExpr "::")? upperId arguments?
2140+
2141+
signatureExpr : (moduleExpr "::")? simpleId ("/" Integer | arguments)?;
21242142

21252143
type ::= (moduleExpr "::")? classname | dbasetype | "boolean" | "date" | "float" | "int" | "string"
21262144

0 commit comments

Comments
 (0)