| description | CodeQL AST node reference for the Ruby language |
|---|
Based on comprehensive analysis of GitHub CodeQL Ruby AST test results
- IntegerLiteral: Numeric constants (1, 2, 100, -5)
- StringLiteral: String constants with StringTextComponent and StringEscapeSequenceComponent
- BooleanLiteral: true/false values
- NilLiteral: nil value
- SymbolLiteral: :foo, :"foo bar" symbols with StringTextComponent
- ArrayLiteral: [1, 2, 3] arrays (desugared to Array.[])
- HashLiteral: {:foo => 1} hashes (desugared to Hash.[])
- RegExpLiteral: /foo.*/ regular expressions with RegExpSequence, RegExpConstant, RegExpStar, RegExpDot
- RangeLiteral: 1..10, 1...10 ranges with getBegin/getEnd
- HereDoc: <<SQL heredoc strings
- LocalVariableAccess: Local variable references
- InstanceVariableAccess: @instance_var with getReceiver
- ClassVariableAccess: @@class_var
- GlobalVariableAccess: $global_var
- SelfVariableAccess: self references
- ConstantReadAccess: Reading constants with optional getScopeExpr
- ConstantAssignment: Assigning to constants with optional getScopeExpr
- MethodCall: Method invocations with getReceiver, getArgument, getBlock
- SetterMethodCall: Setter method calls (foo=)
- SuperCall: super calls with getArgument, getBlock
- AddExpr: + addition
- SubExpr: - subtraction
- MulExpr: * multiplication
- DivExpr: / division
- ModExpr: % modulo
- PowerExpr: ** exponentiation
- EqExpr: == equality
- NeExpr: != inequality
- LTExpr: < less than
- LEExpr: <= less than or equal
- GTExpr: > greater than
- GEExpr: >= greater than or equal
- SpaceshipExpr: <=> spaceship operator
- RegExpMatchExpr: =~ regex match
- NoRegExpMatchExpr: !~ regex no match
- LogicalAndExpr: && and 'and'
- LogicalOrExpr: || and 'or'
- NotExpr: ! negation
- BitwiseAndExpr: & bitwise and
- BitwiseOrExpr: | bitwise or
- BitwiseXorExpr: ^ bitwise xor
- LeftShiftExpr: << left shift
- RightShiftExpr: >> right shift
- UnaryMinusExpr: -value
- UnaryPlusExpr: +value
- ComplementExpr: ~value
- AssignExpr: = assignment
- AssignAddExpr: += (desugared to = and +)
- AssignSubExpr: -= (desugared to = and -)
- AssignMulExpr: *= (desugared to = and *)
- AssignDivExpr: /= (desugared to = and /)
- AssignModExpr: %= (desugared to = and %)
- AssignPowerExpr: **= (desugared to = and **)
- AssignLogicalAndExpr: &&= (desugared to = and &&)
- AssignLogicalOrExpr: ||= (desugared to = and ||)
- AssignBitwiseAndExpr: &= (desugared to = and &)
- AssignBitwiseOrExpr: |= (desugared to = and |)
- AssignBitwiseXorExpr: ^= (desugared to = and ^)
- AssignLeftShiftExpr: <<= (desugared to = and <<)
- AssignRightShiftExpr: >>= (desugared to = and >>)
- TernaryIfExpr: condition ? true_val : false_val
- SplatExpr: *args splat operator
- HashSplatExpr: **kwargs hash splat
- DefinedExpr: defined? operator
- DestructuredLhsExpr: (a, b, c) destructuring assignment left side
- Method: Regular method definitions with getParameter, getStmt
- SingletonMethod: Class method definitions with getObject
- ClassDeclaration: Class definitions with optional getSuperclassExpr
- ModuleDeclaration: Module definitions
- IfExpr: if/elsif/else conditionals with getCondition, getThen, getElse
- UnlessExpr: unless conditionals with getCondition, getThen, getElse
- IfModifierExpr: statement if condition
- UnlessModifierExpr: statement unless condition
- CaseExpr: case statements with getValue, getBranch
- WhenClause: when branches with getPattern, getBody
- InClause: in pattern matching with getPattern, getCondition, getBody
- WhileExpr: while loops with getCondition, getBody
- WhileModifierExpr: statement while condition
- UntilExpr: until loops with getCondition, getBody
- UntilModifierExpr: statement until condition
- ForExpr: for loops (desugared to each with blocks)
- NextStmt: next statement
- BreakStmt: break statement
- ReturnStmt: return statement
- RedoStmt: redo statement
- RetryStmt: retry statement
- BeginExpr: begin/rescue/ensure/end blocks
- RescueClause: rescue clauses
- EnsureClause: ensure clauses
- EndBlock: END {} blocks
- UndefStmt: undef method_name
- AliasStmt: alias new_name old_name
- StmtSequence: Statement sequences
- SimpleParameter: Regular parameters with getDefiningAccess
- OptionalParameter: Parameters with default values, getDefaultValue
- KeywordParameter: Keyword parameters with optional getDefaultValue
- SplatParameter: *args parameters with getDefiningAccess
- HashSplatParameter: **kwargs parameters with getDefiningAccess
- HashSplatNilParameter: **nil parameters
- BlockParameter: &block parameters with getDefiningAccess
- DestructuredParameter: (a, b) destructured parameters with getElement
- IfExpr: Complete if/elsif/else with getBranch structure
- UnlessExpr: unless statements with conditional logic
- CaseExpr: case/when/else with pattern matching
- TernaryIfExpr: Inline conditional expressions
- WhileExpr: while condition do body end
- UntilExpr: until condition do body end
- ForExpr: for var in collection (desugared to each)
- DoBlock: do |params| body end blocks
- BraceBlock: { |params| body } blocks
- Lambda: -> { } and lambda { } constructs
- ArrayPattern: [a, b, *rest] array patterns
- AlternativePattern: pattern1 | pattern2
- AsPattern: pattern => variable
- CapturePattern: Variable capture patterns
- BeginExpr: begin/rescue/ensure structure
- RescueClause: Exception rescue clauses
- EnsureClause: Cleanup ensure clauses
- MethodName: Method name identifiers in various contexts
- Toplevel: Top-level program scope
This repo contains a variant of the open-source PrintAst.ql query for ruby language, with modifications for local testing:
The following links can be fetched to get the expected results for different unit tests of the open-source PrintAst.ql query for the ruby language: