mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Ruby: AST ref docs - fix table formatting and some misnamed classes
This commit is contained in:
@@ -13,6 +13,7 @@ Statement classes
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
This table lists subclasses of Stmt_ representing Ruby statements.
|
||||
|
||||
..
|
||||
TODO: FNAME definition
|
||||
|
||||
@@ -20,15 +21,25 @@ This table lists subclasses of Stmt_ representing Ruby statements.
|
||||
| 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_ | |
|
||||
+------------------------------------------------+--------------+----------------+---------+
|
||||
|
||||
@@ -39,11 +50,17 @@ 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 |
|
||||
+-------------------------+---------------------+----------------+-------------------------------+
|
||||
|
||||
@@ -56,8 +73,11 @@ 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_ | |
|
||||
+----------------------------------------+----------------------+----------------------+-------------------+
|
||||
|
||||
@@ -70,15 +90,25 @@ 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_ | |
|
||||
+-------------------------------------------------------------------------------------------------------------------------------+---------------------+--------------------------------+---------+
|
||||
|
||||
@@ -92,12 +122,19 @@ 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_ | |
|
||||
+--------------------+----------------+----------------------------+-------------------+
|
||||
|
||||
@@ -110,42 +147,79 @@ 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_ | AssignLShiftExpr_ | AssignBitwiseOperation_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
| LhsExpr_ ``&&=`` Expr_ | AssignLogicalAndExpr_ | BinaryLogicalOperation_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
| LhsExpr_ ``||=`` Expr_ | AssignLogicalOrExpr_ | BinaryLogicalOperation_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
| LhsExpr_ ``%=`` Expr_ | AssignModuloExpr_ | AssignArithmeticOperation_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
| LhsExpr_ ``*=`` Expr_ | AssignMulExpr_ | AssignArithmeticOperation_ | |
|
||||
| LhsExpr_ ``>>=`` Expr_ | AssignBitwiseRShiftExpr_ | AssignBitwiseOperation_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
| 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_ | |
|
||||
+------------------------+--------------------------+----------------------------+-------------------+
|
||||
|
||||
@@ -158,25 +232,43 @@ 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`` | | | |
|
||||
+----------------------------+-------------------+----------------------------+-------------------+
|
||||
| | ``<<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_ | |
|
||||
+----------------------------+-------------------+----------------------------+-------------------+
|
||||
|
||||
|
||||
Reference in New Issue
Block a user