Skip to content

Commit cff4317

Browse files
authored
Merge pull request github#13236 from github/ginsbach/IdentifierSpecification
repair and update the Identifier section of the QL specification
2 parents ec265c6 + 35114d5 commit cff4317

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

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

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ A QL module definition has the following syntax:
178178

179179
module ::= annotation* "module" modulename parameters? implements? "{" moduleBody "}"
180180

181-
parameters ::= "<" signatureExpr simpleId ("," signatureExpr simpleId)* ">"
181+
parameters ::= "<" signatureExpr parameterName ("," signatureExpr parameterName)* ">"
182182

183183
implements ::= "implements" moduleSignatureExpr ("," moduleSignatureExpr)*
184184

@@ -216,7 +216,7 @@ An import directive refers to a module identifier:
216216

217217
qualId ::= simpleId | qualId "." simpleId
218218

219-
importModuleExpr ::= qualId | importModuleExpr "::" simpleId arguments?
219+
importModuleExpr ::= qualId | importModuleExpr "::" modulename arguments?
220220

221221
arguments ::= "<" argument ("," argument)* ">"
222222

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

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

292-
moduleExpr ::= simpleId arguments? | moduleExpr "::" simpleId arguments?
292+
moduleExpr ::= modulename arguments? | moduleExpr "::" modulename arguments?
293293

294294
A type reference is resolved to a type as follows:
295295

@@ -349,17 +349,17 @@ A QL signature definition has the following syntax:
349349

350350
predicateSignature ::= qldoc? annotations "signature" head ";"
351351

352-
typeSignature ::= qldoc? annotations "signature" "class" upperId ("extends" type ("," type)*)? (";" | "{" signaturePredicate* "}")
352+
typeSignature ::= qldoc? annotations "signature" "class" classname ("extends" type ("," type)*)? (";" | "{" signaturePredicate* "}")
353353

354-
moduleSignature ::= qldoc? annotation* "signature" "module" upperId parameters? "{" moduleSignatureBody "}"
354+
moduleSignature ::= qldoc? annotation* "signature" "module" moduleSignatureName parameters? "{" moduleSignatureBody "}"
355355

356356
moduleSignatureBody ::= (signaturePredicate | defaultPredicate | signatureType)*
357357

358358
signaturePredicate ::= qldoc? annotations head ";"
359359

360360
defaultPredicate ::= qldoc? annotations "default" head "{" formula "}"
361361

362-
signatureType ::= qldoc? annotations "class" upperId ("extends" type ("," type)*)? "{" signaturePredicate* "}"
362+
signatureType ::= qldoc? annotations "class" classname ("extends" type ("," type)*)? "{" signaturePredicate* "}"
363363

364364

365365
A predicate signature definition extends the current module's declared predicate signature environment with a mapping from the predicate signature name and arity to the predicate signature definition.
@@ -628,20 +628,21 @@ There are several kinds of identifiers:
628628

629629
- ``atLowerId``: an identifier that starts with an "@" sign and then a lower-case letter.
630630

631-
- ``atUpperId``: an identifier that starts with an "@" sign and then an upper-case letter.
632-
633631
Identifiers are used in following syntactic constructs:
634632

635633
::
636634

637-
simpleId ::= lowerId | upperId
638-
modulename ::= simpleId
639-
classname ::= upperId
640-
dbasetype ::= atLowerId
641-
predicateRef ::= (moduleExpr "::")? literalId
642-
predicateName ::= lowerId
643-
varname ::= lowerId
644-
literalId ::= lowerId | atLowerId
635+
simpleId ::= lowerId | upperId
636+
modulename ::= simpleId
637+
moduleSignatureName ::= upperId
638+
classname ::= upperId
639+
dbasetype ::= atLowerId
640+
predicateRef ::= (moduleExpr "::")? literalId
641+
signatureExpr ::= (moduleExpr "::")? simpleId ("/" Integer | arguments)?;
642+
predicateName ::= lowerId
643+
parameterName ::= simpleId
644+
varname ::= lowerId
645+
literalId ::= lowerId | atLowerId
645646

646647
Integer literals (int)
647648
~~~~~~~~~~~~~~~~~~~~~~
@@ -2107,7 +2108,7 @@ The complete grammar for QL is as follows:
21072108

21082109
module ::= annotation* "module" modulename parameters? implements? "{" moduleBody "}"
21092110

2110-
parameters ::= "<" signatureExpr simpleId ("," signatureExpr simpleId)* ">"
2111+
parameters ::= "<" signatureExpr parameterName ("," signatureExpr parameterName)* ">"
21112112

21122113
implements ::= "implements" moduleSignatureExpr ("," moduleSignatureExpr)*
21132114

@@ -2117,7 +2118,7 @@ The complete grammar for QL is as follows:
21172118

21182119
qualId ::= simpleId | qualId "." simpleId
21192120

2120-
importModuleExpr ::= qualId | importModuleExpr "::" simpleId arguments?
2121+
importModuleExpr ::= qualId | importModuleExpr "::" modulename arguments?
21212122

21222123
arguments ::= "<" argument ("," argument)* ">"
21232124

@@ -2127,17 +2128,17 @@ The complete grammar for QL is as follows:
21272128

21282129
predicateSignature ::= qldoc? annotations "signature" head ";"
21292130

2130-
typeSignature ::= qldoc? annotations "signature" "class" upperId ("extends" type ("," type)*)? (";" | "{" signaturePredicate* "}")
2131+
typeSignature ::= qldoc? annotations "signature" "class" classname ("extends" type ("," type)*)? (";" | "{" signaturePredicate* "}")
21312132

2132-
moduleSignature ::= qldoc? annotation* "signature" "module" upperId parameters? "{" moduleSignatureBody "}"
2133+
moduleSignature ::= qldoc? annotation* "signature" "module" moduleSignatureName parameters? "{" moduleSignatureBody "}"
21332134

21342135
moduleSignatureBody ::= (signaturePredicate | defaultPredicate | signatureType)*
21352136

21362137
signaturePredicate ::= qldoc? annotations head ";"
21372138

21382139
defaultPredicate ::= qldoc? annotations "default" head "{" formula "}"
21392140

2140-
signatureType ::= qldoc? annotations "class" upperId ("extends" type ("," type)*)? "{" signaturePredicate* "}"
2141+
signatureType ::= qldoc? annotations "class" classname ("extends" type ("," type)*)? "{" signaturePredicate* "}"
21412142

21422143
select ::= ("from" var_decls)? ("where" formula)? "select" as_exprs ("order" "by" orderbys)?
21432144

@@ -2184,9 +2185,9 @@ The complete grammar for QL is as follows:
21842185

21852186
field ::= qldoc? annotations var_decl ";"
21862187

2187-
moduleExpr ::= simpleId arguments? | moduleExpr "::" simpleId arguments?
2188+
moduleExpr ::= modulename arguments? | moduleExpr "::" modulename arguments?
21882189

2189-
moduleSignatureExpr ::= (moduleExpr "::")? upperId arguments?
2190+
moduleSignatureExpr ::= (moduleExpr "::")? moduleSignatureName arguments?
21902191

21912192
signatureExpr : (moduleExpr "::")? simpleId ("/" Integer | arguments)?;
21922193

@@ -2313,6 +2314,8 @@ The complete grammar for QL is as follows:
23132314

23142315
modulename ::= simpleId
23152316

2317+
moduleSignatureName ::= upperId
2318+
23162319
classname ::= upperId
23172320

23182321
dbasetype ::= atLowerId
@@ -2321,6 +2324,8 @@ The complete grammar for QL is as follows:
23212324

23222325
predicateName ::= lowerId
23232326

2327+
parameterName ::= simpleId
2328+
23242329
varname ::= lowerId
23252330

23262331
literalId ::= lowerId | atLowerId | "any" | "none"

0 commit comments

Comments
 (0)