Skip to content

Commit 0c65e67

Browse files
committed
QL language reference: variables must be lowerId
To prepare for a future QL language change where variable names must start with a lower-case letter, this commit updates the QL language reference (including the language specification) to change the variable name grammar from `simpleId` to `lowerId`.
1 parent 51bb33a commit 0c65e67

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ A *variable declaration list* provides a sequence of variables and a type for ea
364364
::
365365

366366
var_decls ::= (var_decl ("," var_decl)*)?
367-
var_decl ::= type simpleId
367+
var_decl ::= type lowerId
368368

369369
A valid variable declaration list must not include two declarations with the same variable name. Moreover, if the declaration has a typing environment that applies, it must not use a variable name that is already present in that typing environment.
370370

@@ -585,7 +585,7 @@ Identifiers are used in following syntactic constructs:
585585
dbasetype ::= atLowerId
586586
predicateRef ::= (moduleId "::")? literalId
587587
predicateName ::= lowerId
588-
varname ::= simpleId
588+
varname ::= lowerId
589589
literalId ::= lowerId | atLowerId
590590

591591
Integer literals (int)
@@ -948,7 +948,7 @@ The ``select`` keyword is followed by a number of *select expressions*. Select e
948948
::
949949

950950
as_exprs ::= as_expr ("," as_expr)*
951-
as_expr ::= expr ("as" simpleId)?
951+
as_expr ::= expr ("as" lowerId)?
952952

953953
The keyword ``as`` gives a *label* to the select expression it is part of. No two select expressions may have the same label. No expression label may be the same as one of the variables of the select clause.
954954

@@ -957,7 +957,7 @@ The ``order`` keyword, if present, is followed by a number of *ordering directiv
957957
::
958958

959959
orderbys ::= orderby ("," orderby)*
960-
orderby ::= simpleId ("asc" | "desc")?
960+
orderby ::= lowerId ("asc" | "desc")?
961961

962962
Each identifier in an ordering directive must identify exactly one of the select expressions. It must either be the label of the expression, or it must be a variable expression that is equivalent to exactly one of the select expressions. The type of the designated select expression must be a subtype of a primitive type.
963963

@@ -2042,11 +2042,11 @@ The complete grammar for QL is as follows:
20422042

20432043
as_exprs ::= as_expr ("," as_expr)*
20442044

2045-
as_expr ::= expr ("as" simpleId)?
2045+
as_expr ::= expr ("as" lowerId)?
20462046

20472047
orderbys ::= orderby ("," orderby)*
20482048

2049-
orderby ::= simpleId ("asc" | "desc")?
2049+
orderby ::= lowerId ("asc" | "desc")?
20502050

20512051
predicate ::= qldoc? annotations head optbody
20522052

@@ -2095,7 +2095,7 @@ The complete grammar for QL is as follows:
20952095
20962096
var_decls ::= (var_decl ("," var_decl)*)?
20972097

2098-
var_decl ::= type simpleId
2098+
var_decl ::= type lowerId
20992099

21002100
formula ::= fparen
21012101
| disjunction
@@ -2216,6 +2216,6 @@ The complete grammar for QL is as follows:
22162216

22172217
predicateName ::= lowerId
22182218

2219-
varname ::= simpleId
2219+
varname ::= lowerId
22202220

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Declaring a variable
2424

2525
All variable declarations consist of a :ref:`type <types>` and a name for the variable.
2626
The name can be any `identifier <https://codeql.github.com/docs/ql-language-reference/ql-language-specification/#identifiers>`_
27-
that starts with an uppercase or lowercase letter.
27+
that starts with a lowercase letter.
2828

2929
For example, ``int i``, ``SsaDefinitionNode node``, and ``LocalScopeVariable lsv`` declare
3030
variables ``i``, ``node``, and ``lsv`` with types ``int``, ``SsaDefinitionNode``, and

0 commit comments

Comments
 (0)