mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
ql lang spec: update links
This commit is contained in:
@@ -203,7 +203,7 @@ the given path without revisiting any previously visited states.
|
||||
revisiting any previous states, and there is a ``safeFerry`` action from the intermediate state to
|
||||
the result state.
|
||||
(Hint: To check whether a state has previously been visited, you could check if
|
||||
there is an `index of <https://help.semmle.com/QL/ql-spec/language.html#built-ins-for-string>`__
|
||||
there is an `index of <ql-language-specification#built-ins-for-string>`__
|
||||
``visitedStates`` at which the state occurs.)
|
||||
|
||||
.. container:: toggle
|
||||
|
||||
@@ -53,7 +53,7 @@ You can write simple queries using the some of the basic functions that are avai
|
||||
Exercise 1
|
||||
~~~~~~~~~~
|
||||
|
||||
Write a query which returns the length of the string ``"lgtm"``. (Hint: `here <https://help.semmle.com/QL/ql-spec/language.html#built-ins-for-string>`__ is the list of the functions that can be applied to strings.)
|
||||
Write a query which returns the length of the string ``"lgtm"``. (Hint: `here <ql-language-specification#built-ins-for-string>`__ is the list of the functions that can be applied to strings.)
|
||||
|
||||
➤ `See answer in the query console on LGTM.com <https://lgtm.com/query/2103060623/>`__
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ Overview of annotations
|
||||
|
||||
This section describes what the different annotations do, and when you can use them.
|
||||
You can also find a summary table in the Annotations section of the
|
||||
`QL language specification <https://help.semmle.com/QL/ql-spec/language.html#annotations-in-java>`_.
|
||||
`QL language specification <ql-language-specification#annotations-in-java>`_.
|
||||
|
||||
.. index:: abstract
|
||||
.. _abstract:
|
||||
|
||||
@@ -21,7 +21,7 @@ A QL program is evaluated from the bottom up, so a predicate is usually only eva
|
||||
all the predicates it depends on are evaluated.
|
||||
|
||||
The database includes sets of ordered tuples for the `built-in predicates
|
||||
<https://help.semmle.com/QL/ql-spec/language.html#built-ins>`_ and :ref:`external predicates <external>`.
|
||||
<ql-language-specification#built-ins>`_ and :ref:`external predicates <external>`.
|
||||
Each evaluation starts from these sets of tuples.
|
||||
The remaining predicates and types in the program are organized into a number of layers, based
|
||||
on the dependencies between them.
|
||||
@@ -33,7 +33,7 @@ results of the program. The results are sorted according to any ordering directi
|
||||
(``order by``) in the queries.
|
||||
|
||||
For more details about each step of the evaluation process, see the "`QL language specification
|
||||
<https://help.semmle.com/QL/ql-spec/language.html#evaluations-of-ql-programs>`_."
|
||||
<ql-language-specification#evaluations-of-ql-programs>`_."
|
||||
|
||||
Validity of programs
|
||||
********************
|
||||
|
||||
@@ -55,7 +55,7 @@ You can express certain values directly in QL, such as numbers, booleans, and st
|
||||
"hello"
|
||||
"They said, \"Please escape quotation marks!\""
|
||||
|
||||
See `String literals <https://help.semmle.com/QL/ql-spec/language.html#string-literals-string>`_
|
||||
See `String literals <ql-language-specification#string-literals-string>`_
|
||||
in the QL language specification for more details.
|
||||
|
||||
Note: there is no "date literal" in QL. Instead, to specify a :ref:`date <date>`, you should
|
||||
@@ -529,7 +529,7 @@ The following table lists some examples of different forms of ``any`` expression
|
||||
+------------------------------------------+-------------------------------------------------+
|
||||
|
||||
.. note::
|
||||
There is also a `built-in predicate <https://help.semmle.com/QL/ql-spec/language.html#non-member-built-ins>`_
|
||||
There is also a `built-in predicate <ql-language-specification#non-member-built-ins>`_
|
||||
``any()``. This is a predicate that always holds.
|
||||
|
||||
Unary operations
|
||||
|
||||
@@ -33,7 +33,7 @@ Order
|
||||
|
||||
To compare two expressions using one of these order operators, each expression must have a type
|
||||
and those types must be :ref:`compatible <type-compatibility>` and
|
||||
`orderable <https://help.semmle.com/QL/ql-spec/language.html#ordering>`_.
|
||||
`orderable <ql-language-specification#ordering>`_.
|
||||
|
||||
+--------------------------+--------+
|
||||
| Name | Symbol |
|
||||
|
||||
@@ -6,7 +6,7 @@ Lexical syntax
|
||||
The QL syntax includes different kinds of keywords, identifiers, and comments.
|
||||
|
||||
For an overview of the lexical syntax, see "`Lexical syntax
|
||||
<https://help.semmle.com/QL/ql-spec/language.html#lexical-syntax>`_" in the QL language specification.
|
||||
<ql-language-specification#lexical-syntax>`_" in the QL language specification.
|
||||
|
||||
.. index:: comment, QLDoc
|
||||
.. _comments:
|
||||
@@ -15,7 +15,7 @@ Comments
|
||||
********
|
||||
|
||||
All standard one-line and multiline comments, as described in the "`QL language specification
|
||||
<https://help.semmle.com/QL/ql-spec/language.html#comments>`_," are ignored by the QL
|
||||
<ql-language-specification#comments>`_," are ignored by the QL
|
||||
compiler and are only visible in the source code.
|
||||
You can also write another kind of comment, namely **QLDoc comments**. These comments describe
|
||||
QL entities and are displayed as pop-up information in QL editors. For information about QLDoc
|
||||
|
||||
@@ -25,7 +25,7 @@ a class ``OneTwoThree``::
|
||||
}
|
||||
}
|
||||
|
||||
The name of a module can be any `identifier <https://help.semmle.com/QL/ql-spec/language.html#identifiers>`_
|
||||
The name of a module can be any `identifier <ql-language-specification#identifiers>`_
|
||||
that starts with an uppercase or lowercase letter.
|
||||
|
||||
``.ql`` or ``.qll`` files also implicitly define modules.
|
||||
@@ -178,5 +178,5 @@ for example ``import javascript as js``.
|
||||
The ``<module_expression>`` itself can be a module name, a selection, or a qualified
|
||||
reference. For more information, see ":ref:`name-resolution`."
|
||||
|
||||
For information about how import statements are looked up, see "`Module resolution <https://help.semmle.com/QL/ql-spec/language.html#module-resolution>`__"
|
||||
For information about how import statements are looked up, see "`Module resolution <ql-language-specification#module-resolution>`__"
|
||||
in the QL language specification.
|
||||
@@ -74,7 +74,7 @@ statement as follows:
|
||||
#. If the compiler can't find the library file using the above two checks, it looks up ``examples/security/MyLibrary.qll``
|
||||
relative to each library path entry.
|
||||
The library path is usually specified using the ``libraryPathDependencies`` of the ``qlpack.yml`` file, though it may also depend on the tools you use to run your query, and whether you have specified any extra settings.
|
||||
For more information, see "`Library path <https://help.semmle.com/QL/ql-spec/language.html#library-path>`__" in the QL language specification.
|
||||
For more information, see "`Library path <ql-language-specification#library-path>`__" in the QL language specification.
|
||||
|
||||
If the compiler cannot resolve an import statement, then it gives a compilation error.
|
||||
|
||||
@@ -146,7 +146,7 @@ Namespaces
|
||||
**********
|
||||
|
||||
When writing QL, it's useful to understand how namespaces (also known as
|
||||
`environments <https://help.semmle.com/QL/ql-spec/language.html#name-resolution>`_) work.
|
||||
`environments <ql-language-specification#name-resolution>`_) work.
|
||||
|
||||
As in many other programming languages, a namespace is a mapping from **keys** to
|
||||
**entities**. A key is a kind of identifier, for example a name, and a QL entity is
|
||||
@@ -173,7 +173,7 @@ In particular:
|
||||
- The **global module namespace** is empty.
|
||||
- The **global type namespace** has entries for the :ref:`primitive types <primitive-types>` ``int``, ``float``,
|
||||
``string``, ``boolean``, and ``date``, as well as any :ref:`database types <database-types>` defined in the database schema.
|
||||
- The **global predicate namespace** includes all the `built-in predicates <https://help.semmle.com/QL/ql-spec/language.html#built-ins>`_,
|
||||
- The **global predicate namespace** includes all the `built-in predicates <ql-language-specification#built-ins>`_,
|
||||
as well as any :ref:`database predicates <database-predicates>`.
|
||||
|
||||
In practice, this means that you can use the built-in types and predicates directly in a QL module (without
|
||||
@@ -289,7 +289,7 @@ The type namespace of ``S`` has entries for:
|
||||
The predicate namespace of ``Villagers`` has entries for:
|
||||
- The predicate ``isBald``, with arity 1.
|
||||
- Any predicates (and their arities) exported by ``tutorial``.
|
||||
- The `built-in predicates <https://help.semmle.com/QL/ql-spec/language.html#built-ins>`_.
|
||||
- The `built-in predicates <ql-language-specification#built-ins>`_.
|
||||
|
||||
The predicate namespace of ``S`` has entries for:
|
||||
- All the above predicates.
|
||||
|
||||
@@ -33,7 +33,7 @@ The `arity <https://en.wikipedia.org/wiki/Arity>`_ of these predicates is one an
|
||||
In general, all tuples in a predicate have the same number of elements. The **arity** of
|
||||
a predicate is that number of elements, not including a possible ``result`` variable. For more information, see ":ref:`predicates-with-result`."
|
||||
|
||||
There are a number of `built-in predicates <https://help.semmle.com/QL/ql-spec/language.html#built-ins>`_
|
||||
There are a number of `built-in predicates <ql-language-specification#built-ins>`_
|
||||
in QL. You can use these in any queries without needing to :ref:`import <importing-modules>`
|
||||
any additional modules. In addition to these built-in predicates, you can also define your
|
||||
own:
|
||||
@@ -45,7 +45,7 @@ When defining a predicate, you should specify:
|
||||
|
||||
#. The keyword ``predicate`` (for a :ref:`predicate without result <predicates-without-result>`),
|
||||
or the type of the result (for a :ref:`predicate with result <predicates-with-result>`).
|
||||
#. The name of the predicate. This is an `identifier <https://help.semmle.com/QL/ql-spec/language.html#identifiers>`_
|
||||
#. The name of the predicate. This is an `identifier <ql-language-specification#identifiers>`_
|
||||
starting with a lowercase letter.
|
||||
#. The arguments to the predicate, if any, separated by commas. For each argument, specify the
|
||||
argument type and an identifier for the argument variable.
|
||||
|
||||
@@ -48,7 +48,7 @@ independent of the database that you are querying.
|
||||
|
||||
|
||||
QL has a range of built-in operations defined on primitive types. These are available by using dispatch on expressions of the appropriate type. For example, ``1.toString()`` is the string representation of the integer constant ``1``. For a full list of built-in operations available in QL, see the
|
||||
section on `built-ins <https://help.semmle.com/QL/ql-spec/language.html#built-ins>`__ in the QL language specification.
|
||||
section on `built-ins <ql-language-specification#built-ins>`__ in the QL language specification.
|
||||
|
||||
.. index:: class
|
||||
.. _classes:
|
||||
@@ -74,7 +74,7 @@ Defining a class
|
||||
To define a class, you write:
|
||||
|
||||
#. The keyword ``class``.
|
||||
#. The name of the class. This is an `identifier <https://help.semmle.com/QL/ql-spec/language.html#identifiers>`_
|
||||
#. The name of the class. This is an `identifier <ql-language-specification#identifiers>`_
|
||||
starting with an uppercase letter.
|
||||
#. The types to extend.
|
||||
#. The :ref:`body of the class <class-bodies>`, enclosed in braces.
|
||||
@@ -419,7 +419,7 @@ The branch definitions have the following form::
|
||||
|
||||
<BranchName>(<arguments>) { <body> }
|
||||
|
||||
- The type name and the branch names must be `identifiers <https://help.semmle.com/QL/ql-spec/language.html#identifiers>`_
|
||||
- The type name and the branch names must be `identifiers <ql-language-specification#identifiers>`_
|
||||
starting with an uppercase letter. Conventionally, they start with ``T``.
|
||||
- The different branches of an algebraic datatype are separated by ``or``.
|
||||
- The arguments to a branch, if any, are :ref:`variable declarations <variable-declarations>`
|
||||
|
||||
@@ -20,7 +20,7 @@ Declaring a variable
|
||||
********************
|
||||
|
||||
All variable declarations consist of a :ref:`type <types>` and a name for the variable.
|
||||
The name can be any `identifier <https://help.semmle.com/QL/ql-spec/language.html#identifiers>`_
|
||||
The name can be any `identifier <ql-language-specification#identifiers>`_
|
||||
that starts with an uppercase or lowercase letter.
|
||||
|
||||
For example, ``int i``, ``SsaDefinitionNode node``, and ``LocalScopeVariable lsv`` declare
|
||||
|
||||
Reference in New Issue
Block a user