<commit_before>.. _abstract-syntax-tree-classes-for-working-with-ruby-programs:

Abstract syntax tree classes for working with Ruby programs
===========================================================

CodeQL has a large selection of classes for representing the abstract syntax tree of Ruby programs.

.. include:: ../reusables/abstract-syntax-tree.rst

An ``IDENTIFIER`` should match the regular expression ``/[a-zA-Z_][a-zA-Z0-9_]*/``. A ``CNAME`` should match ``/[A-Z][a-zA-Z0-9_]*/``.

Statement classes
~~~~~~~~~~~~~~~~~

This table lists subclasses of Stmt_ representing Ruby statements.
..
  TODO: FNAME definition

+------------------------------------------------+--------------+----------------+---------+
| Statement syntax                               | CodeQL class | Superclasses   | Remarks |
+================================================+==============+================+=========+
| ``alias`` FNAME FNAME                          | AliasStmt_   | Stmt_          |         |
| ``BEGIN {`` StmtSequence_ ``}``                | BeginBlock_  | StmtSequence_  |         |
| ``begin`` StmtSequence_ ``end``                | BeginExpr_   | StmtSequence_  |         |
| ``break`` [Expr_]                              | BreakStmt_   | ReturningStmt_ |         |
| ``;``                                          | EmptyStmt_   | Stmt_          |         |
| ``END {`` StmtSequence_ ``}``                  | EndBlock_    | StmtSequence_  |         |
| ``next`` [Expr_]                               | NextStmt_    | ReturningStmt_ |         |
| ``redo``                                       | RedoStmt_    | Stmt_          |         |
| ``retry``                                      | RetryStmt_   | Stmt_          |         |
| ``return`` [Expr_]                             | ReturnStmt_  | ReturningStmt_ |         |
| ``undef`` FNAME (, FNAME)                      | UndefStmt_   | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+

Calls
~~~~~

+-------------------------+---------------------+----------------+-------------------------------+
| Expression syntax       | CodeQL class        | Superclasses   | Remarks                       |
+=========================+=====================+================+===============================+
| Expr_ ``[`` Expr_ ``]`` | ElementReference_   | MethodCall_    |                               |
| MethodName_ (, Expr_)   | MethodCall_         | Call_          |                               |
| LhsExpr_ ``=`` Expr_    | SetterMethodCall_   | MethodCall_    |                               |
| ``super``               | SuperCall_          | MethodCall_    |                               |
| ``yield`` (, Expr_)     | YieldCall_          | Call_          |                               |
| ``&IDENTIFIER``         | BlockArgument_      | Expr_          | Used as an argument to a call |
| ``...``                 | ForwardedArguments_ | Expr_          | Used as an argument to a call |
+-------------------------+---------------------+----------------+-------------------------------+

Constant accesses
~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of ConstantAccess_.

+----------------------------------------+----------------------+----------------------+-------------------+
| Expression syntax                      | CodeQL class         | Superclasses         | Remarks           |
+========================================+======================+======================+===================+
| CNAME                                  | ConstantReadAccess_  | ConstantAccess_      |                   |
| ``class`` CNAME StmtSequence_ ``end``  | ConstantWriteAccess_ | ConstantAccess_      | class definition  |
| ``module`` CNAME StmtSequence_ ``end`` | ConstantWriteAccess_ | ConstantAccess_      | module definition |
| CNAME ``=`` Expr_                      | ConstantAssignment_  | ConstantWriteAccess_ |                   |
+----------------------------------------+----------------------+----------------------+-------------------+

Control expressions
~~~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of ControlExpr_.

+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Expression syntax                                                                                                             | CodeQL class        | Superclasses                   | Remarks |
+===============================================================================================================================+=====================+================================+=========+
| ``if`` Expr_ ``then`` StmtSequence_ {``elsif`` Expr_ ``then`` StmtSequence_} [``else`` StmtSequence_] ``end``                 | IfExpr_             | ConditionalExpr_, ControlExpr_ |         |
| ``while`` Expr_ ``do`` StmtSequence_ ``end``                                                                                  | WhileExpr_          | ConditionalLoop_               |         |
| ``until`` Expr_ ``do`` StmtSequence_ ``end``                                                                                  | UntilExpr_          | ConditionalLoop_               |         |
| ``for`` LhsExpr_ ``in`` Expr_ ``do`` StmtSequence_ ``end``                                                                    | ForExpr_            | Loop_                          |         |
| Stmt_ ``while`` Expr_                                                                                                         | WhileModifierExpr_  | ConditionalLoop_               |         |
| Stmt_ ``until`` Expr_                                                                                                         | UntilModifierExpr_  | ConditionalLoop_               |         |
| Stmt_ ``if`` Expr_                                                                                                            | IfModifierExpr_     | ConditionalExpr_, ControlExpr_ |         |
| Stmt_ ``unless`` Expr_                                                                                                        | UnlessModifierExpr_ | ConditionalExpr_, ControlExpr_ |         |
| Expr_ ``?`` Stmt_ ``:`` Stmt_                                                                                                 | TernaryIfExpr_      | ConditionalExpr_, ControlExpr_ |         |
| ``case`` Expr_ ``when`` Expr_ ``then`` StmtSequence_ {``when`` Expr_ ``then`` StmtSequence_} [``else`` StmtSequence_] ``end`` | CaseExpr_           | ControlExpr_                   |         |
| ``case when`` Expr_ ``then`` StmtSequence_ [``else`` StmtSequence_] ``end``                                                   | CaseExpr_           | ControlExpr_                   |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+


Unary operations
~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of UnaryOperation_.

+--------------------+----------------+----------------------------+-------------------+
| Expression syntax  |  CodeQL class  | Superclasses               | Remarks           |
+====================+================+============================+===================+
| ``~`` Expr_        | ComplementExpr_ | UnaryBitwiseOperation_    |                   |
| ``defined?`` Expr_ | DefinedExpr_    | UnaryOperation_           |                   |
| ``**`` Expr_       | HashSplatExpr_  | UnaryOperation_           |                   |
| ``!`` Expr_        | NotExpr_        | UnaryOperation_           |                   |
| ``not`` Expr_      | NotExpr_        | UnaryOperation_           |                   |
| ``*`` Expr_        | SplatExpr_      | UnaryOperation_           |                   |
| ``-`` Expr_        | UnaryMinusExpr_ | UnaryArithmeticOperation_ |                   |
| ``+`` Expr_        | UnaryPlusExpr_  | UnaryArithmeticOperation_ |                   |
+--------------------+----------------+----------------------------+-------------------+

Binary operations
~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of BinaryOperation_.

+------------------------+--------------------------+----------------------------+-------------------+
| Expression syntax      |  CodeQL class            | Superclasses               | Remarks           |
+========================+==========================+============================+===================+
| Expr_ ``+`` Expr_      | AddExpr_                 | BinaryArithmeticOperation_ |                   |
| LhsExpr_ ``+=`` Expr_  | AssignAddExpr_           | AssignArithmeticOperation_ |                   |
| LhsExpr_ ``&=`` Expr_  | AssignBitwiseAndExpr_    | AssignBitwiseOperation_    |                   |
| LhsExpr_ ``|=`` Expr_  | AssignBitwiseOrExpr_     | AssignBitwiseOperation_    |                   |
| LhsExpr_ ``^=`` Expr_  | AssignBitwiseXorExpr_    | AssignBitwiseOperation_    |                   |
| LhsExpr_ ``/=`` Expr_  | AssignDivExpr_           | AssignArithmeticOperation_ |                   |
| LhsExpr_ ``**=`` Expr_ | AssignExponentExpr_      | AssignArithmeticOperation_ |                   |
| LhsExpr_ ``<<=`` Expr_ | AssignBitwiseLShiftExpr_ | AssignBitwiseOperation_    |                   |
| LhsExpr_ ``&&=`` Expr_ | AssignLogicalAndExpr_    | BinaryLogicalOperation_    |                   |
| LhsExpr_ ``||=`` Expr_ | AssignLogicalOrExpr_     | BinaryLogicalOperation_    |                   |
| LhsExpr_ ``%=`` Expr_  | AssignModuloExpr_        | AssignArithmeticOperation_ |                   |
| LhsExpr_ ``*=`` Expr_  | AssignMulExpr_           | AssignArithmeticOperation_ |                   |
| LhsExpr_ ``>>=`` Expr_ | AssignBitwiseRShiftExpr_ | AssignBitwiseOperation_    |                   |
| LhsExpr_ ``-=`` Expr_  | AssignSubExpr_           | AssignArithmeticOperation_ |                   |
| Expr_ ``&`` Expr_      | BitwiseAndExpr_          | BinaryBitwiseOperation_    |                   |
| Expr_ ``|`` Expr_      | BitwiseOrExpr_           | BinaryBitwiseOperation_    |                   |
| Expr_ ``^`` Expr_      | BitwiseXorExpr_          | BinaryBitwiseOperation_    |                   |
| Expr_ ``===`` Expr_    | CaseEqExpr_              | EqualityOperation_         |                   |
| Expr_ ``/`` Expr_      | DivExpr_                 | BinaryArithmeticOperation_ |                   |
| Expr_ ``===`` Expr_    | EqExpr_                  | EqualityOperation_         |                   |
| Expr_ ``^`` Expr_      | ExponentExpr_            | BinaryArithmeticOperation_ |                   |
| Expr_ ``>=`` Expr_     | GEExpr_                  | RelationalOperation_       |                   |
| Expr_ ``>`` Expr_      | GTExpr_                  | RelationalOperation_       |                   |
| Expr_ ``<=`` Expr_     | LEExpr_                  | RelationalOperation_       |                   |
| Expr_ ``<<`` Expr_     | LShiftExpr_              | BinaryBitwiseOperation_    |                   |
| Expr_ ``<`` Expr_      | LTExpr_                  | RelationalOperation_       |                   |
| Expr_ ``&&`` Expr_     | LogicalAndExpr_          | BinaryLogicalOperation_    |                   |
| Expr_ ``and`` Expr_    | LogicalAndExpr_          | BinaryLogicalOperation_    |                   |
| Expr_ ``||`` Expr_     | LogicalOrExpr_           | BinaryLogicalOperation_    |                   |
| Expr_ ``or`` Expr_     | LogicalOrExpr_           | BinaryLogicalOperation_    |                   |
| Expr_ ``%`` Expr_      | ModuloExpr_              | BinaryArithmeticOperation_ |                   |
| Expr_ ``*`` Expr_      | MulExpr_                 | BinaryArithmeticOperation_ |                   |
| Expr_ ``!=`` Expr_     | NEExpr_                  | RelationalOperation_       |                   |
| Expr_ ``!~`` Expr_     | NoRegExpMatchExpr_       | BinaryOperation_           |                   |
| Expr_ ``>>`` Expr_     | RShiftExpr_              | BinaryBitwiseOperation_    |                   |
| Expr_ ``=~`` Expr_     | RegExpMatchExpr_         | BinaryOperation_           |                   |
| Expr_ ``<=>`` Expr_    | SpaceshipExpr_           | BinaryOperation_           |                   |
| Expr_ ``-`` Expr_      | SubExpr_                 | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+

Literals
~~~~~~~~

All classes in this subsection are subclasses of Literal_.

+----------------------------+-------------------+----------------------------+-------------------+
| Example expression syntax  |  CodeQL class     | Superclasses               | Remarks           |
+============================+===================+============================+===================+
| ``[1, 2]``                 | ArrayLiteral_     | Literal_                   |                   |
| ``true``                   | BooleanLiteral_   | Literal_                   |                   |
| ``?a``                     | CharacterLiteral_ | Literal_                   |                   |
| ``__ENCODING__``           | EncodingLiteral_  | Literal_                   |                   |
| ``__FILE__``               | FileLiteral_      | Literal_                   |                   |
| ``{ foo: 123, bar: 456 }`` | HashLiteral_      | Literal_                   |                   |
| ``<<FOO``                  | HereDoc_          | StringlikeLiteral_         |                   |
| ``hello world``            |                   |                            |                   |
| ``FOO``                    |                   |                            |                   |
| ``23``                     | IntegerLiteral_   | NumericLiteral_            |                   |
| ``3.1``                    | FloatLiteral_     | NumericLiteral_            |                   |
| ``3+2i``                   | ComplexLiteral_   | NumericLiteral_            |                   |
| ``2/3r``                   | RationalLiteral_  | NumericLiteral_            |                   |
| ``__LINE__``               | LineLiteral_      | Literal_                   |                   |
| ``nil``                    | NilLiteral_       | Literal_                   |                   |
| ``(1..10)``                | RangeLiteral_     | Literal_                   |                   |
| ``/[a-z]+/``               | RegExpLiteral_    | StringlikeLiteral_         |                   |
| ``"hello world"``          | StringLiteral_    | StringlikeLiteral_         |                   |
| ```ls -l```                | SubshellLiteral_  | StringlikeLiteral_         |                   |
| ``%x(/bin/sh foo.sh)``     | SubshellLiteral_  | StringlikeLiteral_         |                   |
| ``:foo``                   | SymbolLiteral_    | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+

Method classes
~~~~~~~~~~~~~~

All classes in this subsection are subclasses of Callable_.
+----------------------------------------+----------------------+----------------------+-------------------+
| Expression syntax                      | CodeQL class         | Superclasses         | Remarks           |
+========================================+======================+======================+===================+
| | BraceBlock_ | Block_ | |
| | Callable_ | | |
| | DoBlock_ | Block_ | |
| | Lambda_ | | |
| | Method_ | | |
| | MethodBase_ | | |
| | SingletonMethod_ | | |

..
  Expr.qll
| TODO | ArgumentList_ | Expr_ | The right-hand side of an assignment or a ``return``, ``break``, or ``next`` statement |
| StmtSequence_ TODO   | BodyStmt_ | StmtSequence_ | |
| TODO | DestructuredLhsExpr_ | LhsExpr_ | |
| TODO | LhsExpr_ | Expr_ | |<commit_msg>Ruby: AST ref docs - fix table formatting and some misnamed classes<commit_after>.. _abstract-syntax-tree-classes-for-working-with-ruby-programs:

Abstract syntax tree classes for working with Ruby programs
===========================================================

CodeQL has a large selection of classes for representing the abstract syntax tree of Ruby programs.

.. include:: ../reusables/abstract-syntax-tree.rst

An ``IDENTIFIER`` should match the regular expression ``/[a-zA-Z_][a-zA-Z0-9_]*/``. A ``CNAME`` should match ``/[A-Z][a-zA-Z0-9_]*/``.

Statement classes
~~~~~~~~~~~~~~~~~

This table lists subclasses of Stmt_ representing Ruby statements.

..
  TODO: FNAME definition

+------------------------------------------------+--------------+----------------+---------+
| Statement syntax                               | CodeQL class | Superclasses   | Remarks |
+================================================+==============+================+=========+
| ``alias`` FNAME FNAME                          | AliasStmt_   | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+
| ``BEGIN {`` StmtSequence_ ``}``                | BeginBlock_  | StmtSequence_  |         |
+------------------------------------------------+--------------+----------------+---------+
| ``begin`` StmtSequence_ ``end``                | BeginExpr_   | StmtSequence_  |         |
+------------------------------------------------+--------------+----------------+---------+
| ``break`` [Expr_]                              | BreakStmt_   | ReturningStmt_ |         |
+------------------------------------------------+--------------+----------------+---------+
| ``;``                                          | EmptyStmt_   | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+
| ``END {`` StmtSequence_ ``}``                  | EndBlock_    | StmtSequence_  |         |
+------------------------------------------------+--------------+----------------+---------+
| ``next`` [Expr_]                               | NextStmt_    | ReturningStmt_ |         |
+------------------------------------------------+--------------+----------------+---------+
| ``redo``                                       | RedoStmt_    | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+
| ``retry``                                      | RetryStmt_   | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+
| ``return`` [Expr_]                             | ReturnStmt_  | ReturningStmt_ |         |
+------------------------------------------------+--------------+----------------+---------+
| ``undef`` FNAME (, FNAME)                      | UndefStmt_   | Stmt_          |         |
+------------------------------------------------+--------------+----------------+---------+

Calls
~~~~~

+-------------------------+---------------------+----------------+-------------------------------+
| Expression syntax       | CodeQL class        | Superclasses   | Remarks                       |
+=========================+=====================+================+===============================+
| Expr_ ``[`` Expr_ ``]`` | ElementReference_   | MethodCall_    |                               |
+-------------------------+---------------------+----------------+-------------------------------+
| MethodName_ (, Expr_)   | MethodCall_         | Call_          |                               |
+-------------------------+---------------------+----------------+-------------------------------+
| LhsExpr_ ``=`` Expr_    | SetterMethodCall_   | MethodCall_    |                               |
+-------------------------+---------------------+----------------+-------------------------------+
| ``super``               | SuperCall_          | MethodCall_    |                               |
+-------------------------+---------------------+----------------+-------------------------------+
| ``yield`` (, Expr_)     | YieldCall_          | Call_          |                               |
+-------------------------+---------------------+----------------+-------------------------------+
| ``&IDENTIFIER``         | BlockArgument_      | Expr_          | Used as an argument to a call |
+-------------------------+---------------------+----------------+-------------------------------+
| ``...``                 | ForwardedArguments_ | Expr_          | Used as an argument to a call |
+-------------------------+---------------------+----------------+-------------------------------+

Constant accesses
~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of ConstantAccess_.

+----------------------------------------+----------------------+----------------------+-------------------+
| Expression syntax                      | CodeQL class         | Superclasses         | Remarks           |
+========================================+======================+======================+===================+
| CNAME                                  | ConstantReadAccess_  | ConstantAccess_      |                   |
+----------------------------------------+----------------------+----------------------+-------------------+
| ``class`` CNAME StmtSequence_ ``end``  | ConstantWriteAccess_ | ConstantAccess_      | class definition  |
+----------------------------------------+----------------------+----------------------+-------------------+
| ``module`` CNAME StmtSequence_ ``end`` | ConstantWriteAccess_ | ConstantAccess_      | module definition |
+----------------------------------------+----------------------+----------------------+-------------------+
| CNAME ``=`` Expr_                      | ConstantAssignment_  | ConstantWriteAccess_ |                   |
+----------------------------------------+----------------------+----------------------+-------------------+

Control expressions
~~~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of ControlExpr_.

+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Expression syntax                                                                                                             | CodeQL class        | Superclasses                   | Remarks |
+===============================================================================================================================+=====================+================================+=========+
| ``if`` Expr_ ``then`` StmtSequence_ {``elsif`` Expr_ ``then`` StmtSequence_} [``else`` StmtSequence_] ``end``                 | IfExpr_             | ConditionalExpr_, ControlExpr_ |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| ``while`` Expr_ ``do`` StmtSequence_ ``end``                                                                                  | WhileExpr_          | ConditionalLoop_               |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| ``until`` Expr_ ``do`` StmtSequence_ ``end``                                                                                  | UntilExpr_          | ConditionalLoop_               |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| ``for`` LhsExpr_ ``in`` Expr_ ``do`` StmtSequence_ ``end``                                                                    | ForExpr_            | Loop_                          |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Stmt_ ``while`` Expr_                                                                                                         | WhileModifierExpr_  | ConditionalLoop_               |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Stmt_ ``until`` Expr_                                                                                                         | UntilModifierExpr_  | ConditionalLoop_               |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Stmt_ ``if`` Expr_                                                                                                            | IfModifierExpr_     | ConditionalExpr_, ControlExpr_ |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Stmt_ ``unless`` Expr_                                                                                                        | UnlessModifierExpr_ | ConditionalExpr_, ControlExpr_ |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| Expr_ ``?`` Stmt_ ``:`` Stmt_                                                                                                 | TernaryIfExpr_      | ConditionalExpr_, ControlExpr_ |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| ``case`` Expr_ ``when`` Expr_ ``then`` StmtSequence_ {``when`` Expr_ ``then`` StmtSequence_} [``else`` StmtSequence_] ``end`` | CaseExpr_           | ControlExpr_                   |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
| ``case when`` Expr_ ``then`` StmtSequence_ [``else`` StmtSequence_] ``end``                                                   | CaseExpr_           | ControlExpr_                   |         |
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+


Unary operations
~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of UnaryOperation_.

+--------------------+----------------+----------------------------+-------------------+
| Expression syntax  |  CodeQL class  | Superclasses               | Remarks           |
+====================+================+============================+===================+
| ``~`` Expr_        | ComplementExpr_ | UnaryBitwiseOperation_    |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``defined?`` Expr_ | DefinedExpr_    | UnaryOperation_           |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``**`` Expr_       | HashSplatExpr_  | UnaryOperation_           |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``!`` Expr_        | NotExpr_        | UnaryOperation_           |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``not`` Expr_      | NotExpr_        | UnaryOperation_           |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``*`` Expr_        | SplatExpr_      | UnaryOperation_           |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``-`` Expr_        | UnaryMinusExpr_ | UnaryArithmeticOperation_ |                   |
+--------------------+----------------+----------------------------+-------------------+
| ``+`` Expr_        | UnaryPlusExpr_  | UnaryArithmeticOperation_ |                   |
+--------------------+----------------+----------------------------+-------------------+

Binary operations
~~~~~~~~~~~~~~~~~

All classes in this subsection are subclasses of BinaryOperation_.

+------------------------+--------------------------+----------------------------+-------------------+
| Expression syntax      |  CodeQL class            | Superclasses               | Remarks           |
+========================+==========================+============================+===================+
| Expr_ ``+`` Expr_      | AddExpr_                 | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``+=`` Expr_  | AssignAddExpr_           | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``&=`` Expr_  | AssignBitwiseAndExpr_    | AssignBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``|=`` Expr_  | AssignBitwiseOrExpr_     | AssignBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``^=`` Expr_  | AssignBitwiseXorExpr_    | AssignBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``/=`` Expr_  | AssignDivExpr_           | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``**=`` Expr_ | AssignExponentExpr_      | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``<<=`` Expr_ | AssignLShiftExpr_        | AssignBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``&&=`` Expr_ | AssignLogicalAndExpr_    | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``||=`` Expr_ | AssignLogicalOrExpr_     | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``%=`` Expr_  | AssignModuloExpr_        | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``*=`` Expr_  | AssignMulExpr_           | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``>>=`` Expr_ | AssignRShiftExpr_        | AssignBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| LhsExpr_ ``-=`` Expr_  | AssignSubExpr_           | AssignArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``&`` Expr_      | BitwiseAndExpr_          | BinaryBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``|`` Expr_      | BitwiseOrExpr_           | BinaryBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``^`` Expr_      | BitwiseXorExpr_          | BinaryBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``===`` Expr_    | CaseEqExpr_              | EqualityOperation_         |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``/`` Expr_      | DivExpr_                 | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``===`` Expr_    | EqExpr_                  | EqualityOperation_         |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``^`` Expr_      | ExponentExpr_            | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``>=`` Expr_     | GEExpr_                  | RelationalOperation_       |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``>`` Expr_      | GTExpr_                  | RelationalOperation_       |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``<=`` Expr_     | LEExpr_                  | RelationalOperation_       |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``<<`` Expr_     | LShiftExpr_              | BinaryBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``<`` Expr_      | LTExpr_                  | RelationalOperation_       |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``&&`` Expr_     | LogicalAndExpr_          | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``and`` Expr_    | LogicalAndExpr_          | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``||`` Expr_     | LogicalOrExpr_           | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``or`` Expr_     | LogicalOrExpr_           | BinaryLogicalOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``%`` Expr_      | ModuloExpr_              | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``*`` Expr_      | MulExpr_                 | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``!=`` Expr_     | NEExpr_                  | RelationalOperation_       |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``!~`` Expr_     | NoRegExpMatchExpr_       | BinaryOperation_           |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``>>`` Expr_     | RShiftExpr_              | BinaryBitwiseOperation_    |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``=~`` Expr_     | RegExpMatchExpr_         | BinaryOperation_           |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``<=>`` Expr_    | SpaceshipExpr_           | BinaryOperation_           |                   |
+------------------------+--------------------------+----------------------------+-------------------+
| Expr_ ``-`` Expr_      | SubExpr_                 | BinaryArithmeticOperation_ |                   |
+------------------------+--------------------------+----------------------------+-------------------+

Literals
~~~~~~~~

All classes in this subsection are subclasses of Literal_.

+----------------------------+-------------------+----------------------------+-------------------+
| Example expression syntax  |  CodeQL class     | Superclasses               | Remarks           |
+============================+===================+============================+===================+
| ``[1, 2]``                 | ArrayLiteral_     | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``true``                   | BooleanLiteral_   | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``?a``                     | CharacterLiteral_ | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``__ENCODING__``           | EncodingLiteral_  | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``__FILE__``               | FileLiteral_      | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``{ foo: 123, bar: 456 }`` | HashLiteral_      | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| | ``<<FOO``                | HereDoc_          | StringlikeLiteral_         |                   |
| | ``hello world``          |                   |                            |                   |
| | ``FOO``                  |                   |                            |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``23``                     | IntegerLiteral_   | NumericLiteral_            |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``3.1``                    | FloatLiteral_     | NumericLiteral_            |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``3+2i``                   | ComplexLiteral_   | NumericLiteral_            |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``2/3r``                   | RationalLiteral_  | NumericLiteral_            |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``__LINE__``               | LineLiteral_      | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``nil``                    | NilLiteral_       | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``(1..10)``                | RangeLiteral_     | Literal_                   |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``/[a-z]+/``               | RegExpLiteral_    | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``"hello world"``          | StringLiteral_    | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ```ls -l```                | SubshellLiteral_  | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``%x(/bin/sh foo.sh)``     | SubshellLiteral_  | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+
| ``:foo``                   | SymbolLiteral_    | StringlikeLiteral_         |                   |
+----------------------------+-------------------+----------------------------+-------------------+

Method classes
~~~~~~~~~~~~~~

All classes in this subsection are subclasses of Callable_.
+----------------------------------------+----------------------+----------------------+-------------------+
| Expression syntax                      | CodeQL class         | Superclasses         | Remarks           |
+========================================+======================+======================+===================+
| | BraceBlock_ | Block_ | |
| | Callable_ | | |
| | DoBlock_ | Block_ | |
| | Lambda_ | | |
| | Method_ | | |
| | MethodBase_ | | |
| | SingletonMethod_ | | |

..
  Expr.qll
| TODO | ArgumentList_ | Expr_ | The right-hand side of an assignment or a ``return``, ``break``, or ``next`` statement |
| StmtSequence_ TODO   | BodyStmt_ | StmtSequence_ | |
| TODO | DestructuredLhsExpr_ | LhsExpr_ | |
| TODO | LhsExpr_ | Expr_ | |
{'fraction_non_alphanumeric': 0.4268712292609351, 'fraction_numerical': 0.0010840874811463047, 'mean_word_length': 0.6543724901555616, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 139, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '22982', 'n_tokens_mistral': 8121, 'n_tokens_neox': 7467, 'n_words': 1306}