AstCreator

io.joern.rubysrc2cpg.astcreation.AstCreator
class AstCreator(filename: String, global: Global) extends AstCreatorBase, AstNodeBuilder[ParserRuleContext, AstCreator], AstForPrimitivesCreator

Attributes

Graph
Supertypes
trait AstNodeBuilder[ParserRuleContext, AstCreator]
class AstCreatorBase
class Object
trait Matchable
class Any
Show all

Members list

Type members

Classlikes

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def astForAdditiveExpressionContext(ctx: AdditiveExpressionContext): Seq[Ast]
def astForAliasStatementContext(ctx: AliasStatementContext): Seq[Ast]
def astForArgumentsContext(ctx: ArgumentsContext): Seq[Ast]
def astForArgumentsWithParenthesesContext(ctx: ArgumentsWithParenthesesContext): Seq[Ast]
def astForArgumentsWithoutParenthesesContext(ctx: ArgumentsWithoutParenthesesContext): Seq[Ast]
def astForArrayConstructorPrimaryContext(ctx: ArrayConstructorPrimaryContext): Seq[Ast]
def astForAssignmentLikeMethodIdentifierContext(ctx: AssignmentLikeMethodIdentifierContext): Seq[Ast]
def astForAssociationContext(ctx: AssociationContext): Seq[Ast]
def astForAssociationsContext(ctx: AssociationsContext): Seq[Ast]
def astForBeginExpressionPrimaryContext(ctx: BeginExpressionPrimaryContext): Seq[Ast]
def astForBeginStatementContext(ctx: BeginStatementContext): Seq[Ast]
def astForBinaryExpression(lhs: ExpressionContext, rhs: ExpressionContext, operatorToken: Token): Seq[Ast]
def astForBitwiseAndExpressionContext(ctx: BitwiseAndExpressionContext): Seq[Ast]
def astForBitwiseOrExpressionContext(ctx: BitwiseOrExpressionContext): Seq[Ast]
def astForBitwiseShiftExpressionContext(ctx: BitwiseShiftExpressionContext): Seq[Ast]
def astForBlock(ctxStmt: StatementsContext, ctxParam: BlockParameterContext): Seq[Ast]
def astForBlockArgumentContext(ctx: BlockArgumentContext): Seq[Ast]
def astForBlockArgumentTypeArgumentsContext(ctx: BlockArgumentTypeArgumentsContext): Seq[Ast]
def astForBlockContext(ctx: BlockContext): Seq[Ast]
def astForBlockExprAssocTypeArgumentsContext(ctx: BlockExprAssocTypeArgumentsContext): Seq[Ast]
def astForBlockParameterContext(ctx: BlockParameterContext): Seq[Ast]
def astForBlockParametersContext(ctx: BlockParametersContext): Seq[Ast]
def astForBlockSplattingExprAssocTypeArgumentsContext(ctx: BlockSplattingExprAssocTypeArgumentsContext): Seq[Ast]
def astForBlockSplattingTypeArgumentsContext(ctx: BlockSplattingTypeArgumentsContext): Seq[Ast]
def astForBodyStatementContext(ctx: BodyStatementContext): Seq[Ast]
def astForBraceBlockContext(ctx: BraceBlockContext): Seq[Ast]
def astForCallNode(localIdentifier: TerminalNode, code: String): Seq[Ast]
def astForCaseExpressionPrimaryContext(ctx: CaseExpressionPrimaryContext): Seq[Ast]
def astForChainedCommandWithDoBlockContext(ctx: ChainedCommandWithDoBlockContext): Seq[Ast]
def astForChainedInvocationPrimaryContext(ctx: ChainedInvocationPrimaryContext): Seq[Ast]
def astForChainedInvocationWithoutArgumentsPrimaryContext(ctx: ChainedInvocationWithoutArgumentsPrimaryContext): Seq[Ast]
def astForChainedScopedConstantReferencePrimaryContext(ctx: ChainedScopedConstantReferencePrimaryContext): Seq[Ast]
def astForClassDefinitionPrimaryContext(ctx: ClassDefinitionPrimaryContext): Seq[Ast]
def astForClassOrModuleReferenceContext(ctx: ClassOrModuleReferenceContext, baseClassName: Option[String]): Seq[Ast]
def astForCommandContext(ctx: CommandContext): Seq[Ast]
def astForCommandTypeArgumentsContext(ctx: CommandTypeArgumentsContext): Seq[Ast]
def astForCommandWithDoBlockContext(ctx: CommandWithDoBlockContext): Seq[Ast]
def astForConditionalOperatorExpressionContext(ctx: ConditionalOperatorExpressionContext): Seq[Ast]
def astForDefinedMethodNameContext(ctx: DefinedMethodNameContext): Seq[Ast]
def astForDefinedMethodNameOrSymbolContext(ctx: DefinedMethodNameOrSymbolContext): Seq[Ast]
def astForDoBlockContext(ctx: DoBlockContext): Seq[Ast]
def astForDoClauseContext(ctx: DoClauseContext): Seq[Ast]
def astForElseClauseContext(ctx: ElseClauseContext): Seq[Ast]
def astForElsifClauseContext(ctx: List[ElsifClauseContext]): Seq[Ast]
def astForEndStatementContext(ctx: EndStatementContext): Seq[Ast]
def astForEqualityExpressionContext(ctx: EqualityExpressionContext): Seq[Ast]
def astForExpressionContext(ctx: ExpressionContext): Seq[Ast]
def astForExpressionOrCommandContext(ctx: ExpressionOrCommandContext): Seq[Ast]
def astForExpressionOrCommandsContext(ctx: ExpressionOrCommandsContext): Seq[Ast]
def astForForExpressionContext(ctx: ForExpressionContext): Seq[Ast]
def astForForVariableContext(ctx: ForVariableContext): Seq[Ast]
def astForGroupedLeftHandSideContext(ctx: GroupedLeftHandSideContext): Seq[Ast]
def astForGroupingExpressionPrimaryContext(ctx: GroupingExpressionPrimaryContext): Seq[Ast]
def astForHashConstructorPrimaryContext(ctx: HashConstructorPrimaryContext): Seq[Ast]
def astForIfExpressionContext(ctx: IfExpressionContext): Seq[Ast]
def astForIfExpressionPrimaryContext(ctx: IfExpressionPrimaryContext): Seq[Ast]
def astForIndexingArgumentsContext(ctx: IndexingArgumentsContext): Seq[Ast]
def astForIndexingExpressionPrimaryContext(ctx: IndexingExpressionPrimaryContext): Seq[Ast]
def astForInvocationExpressionOrCommandContext(ctx: InvocationExpressionOrCommandContext): Seq[Ast]
def astForInvocationWithBlockOnlyPrimaryContext(ctx: InvocationWithBlockOnlyPrimaryContext): Seq[Ast]
def astForInvocationWithParenthesesPrimaryContext(ctx: InvocationWithParenthesesPrimaryContext): Seq[Ast]
def astForInvocationWithoutParenthesesContext(ctx: InvocationWithoutParenthesesContext): Seq[Ast]
def astForIsDefinedExpressionContext(ctx: IsDefinedExpressionContext): Seq[Ast]
def astForIsDefinedPrimaryContext(ctx: IsDefinedPrimaryContext): Seq[Ast]
def astForJumpExpressionPrimaryContext(ctx: JumpExpressionPrimaryContext): Seq[Ast]
def astForLiteralPrimaryContext(ctx: LiteralPrimaryContext): Seq[Ast]
def astForMethodDefinitionContext(ctx: MethodDefinitionContext): Seq[Ast]
def astForMethodIdentifierContext(ctx: MethodIdentifierContext, code: String): Seq[Ast]
def astForMethodNameContext(ctx: MethodNameContext): Seq[Ast]
def astForMethodNamePartContext(ctx: MethodNamePartContext): Seq[Ast]
def astForMethodOnlyIdentifier(ctx: MethodOnlyIdentifierContext): Seq[Ast]
def astForMethodOnlyIdentifierPrimaryContext(ctx: MethodOnlyIdentifierPrimaryContext): Seq[Ast]
def astForMethodParameterPartContext(ctx: MethodParameterPartContext): Seq[Ast]
def astForModifierStatementContext(ctx: ModifierStatementContext): Seq[Ast]
def astForModuleDefinitionPrimaryContext(ctx: ModuleDefinitionPrimaryContext): Seq[Ast]
def astForMultipleAssignmentExpressionContext(ctx: MultipleAssignmentExpressionContext): Seq[Ast]
def astForMultipleLeftHandSideContext(ctx: MultipleLeftHandSideContext): Seq[Ast]
def astForMultipleRightHandSideContext(ctx: MultipleRightHandSideContext): Seq[Ast]
def astForMultiplicativeExpressionContext(ctx: MultiplicativeExpressionContext): Seq[Ast]
def astForNotExpressionOrCommandContext(ctx: NotExpressionOrCommandContext): Seq[Ast]
def astForOperatorAndExpressionContext(ctx: OperatorAndExpressionContext): Seq[Ast]
def astForOperatorMethodNameContext(ctx: OperatorMethodNameContext): Seq[Ast]
def astForOperatorOrExpressionContext(ctx: OperatorOrExpressionContext): Seq[Ast]
def astForOrAndExpressionOrCommandContext(ctx: OrAndExpressionOrCommandContext): Seq[Ast]
def astForPackingLeftHandSideContext(ctx: PackingLeftHandSideContext): Seq[Ast]
def astForPowerExpressionContext(ctx: PowerExpressionContext): Seq[Ast]
def astForPrimaryContext(ctx: PrimaryContext): Seq[Ast]
def astForRangeExpressionContext(ctx: RangeExpressionContext): Seq[Ast]
def astForRelationalExpressionContext(ctx: RelationalExpressionContext): Seq[Ast]
def astForSimpleMethodNamePartContext(ctx: SimpleMethodNamePartContext): Seq[Ast]
def astForSimpleScopedConstantReferencePrimaryContext(ctx: SimpleScopedConstantReferencePrimaryContext): Seq[Ast]
def astForSingleAssignmentExpressionContext(ctx: SingleAssignmentExpressionContext): Seq[Ast]
def astForSingleLeftHandSideContext(ctx: SingleLeftHandSideContext): Seq[Ast]
def astForSingletonMethodNamePartContext(ctx: SingletonMethodNamePartContext): Seq[Ast]
def astForSingletonObjextContext(ctx: SingletonObjectContext): Seq[Ast]
def astForSplattingArgumentContext(ctx: SplattingArgumentContext): Seq[Ast]
def astForStatementContext(ctx: StatementContext): Seq[Ast]
def astForStatementsContext(ctx: StatementsContext): Seq[Ast]
def astForStringInterpolationPrimaryContext(ctx: StringInterpolationPrimaryContext): Seq[Ast]
def astForSuperExpressionPrimaryContext(ctx: SuperExpressionPrimaryContext): Seq[Ast]
def astForSymbolContext(ctx: SymbolContext): Seq[Ast]
def astForThenClauseContext(ctx: ThenClauseContext): Seq[Ast]
def astForUnaryExpressionContext(ctx: UnaryExpressionContext): Seq[Ast]
def astForUnaryMinusExpressionContext(ctx: UnaryMinusExpressionContext): Seq[Ast]
def astForUndefStatementContext(ctx: UndefStatementContext): Seq[Ast]
def astForUnlessExpressionPrimaryContext(ctx: UnlessExpressionPrimaryContext): Seq[Ast]
def astForUntilExpressionContext(ctx: UntilExpressionContext): Seq[Ast]
def astForVariableIdentifierContext(ctx: VariableIdentifierContext): Seq[Ast]
def astForVariableRefenceContext(ctx: VariableReferenceContext): Seq[Ast]
def astForVariableReferencePrimaryContext(ctx: VariableReferencePrimaryContext): Seq[Ast]
def astForWhenArgumentContext(ctx: WhenArgumentContext): Seq[Ast]
def astForWhileExpressionContext(ctx: WhileExpressionContext): Seq[Ast]
def astForYieldWithOptionalArgumentContext(ctx: YieldWithOptionalArgumentContext): Seq[Ast]
def astForYieldWithOptionalArgumentPrimaryContext(ctx: YieldWithOptionalArgumentPrimaryContext): Seq[Ast]
protected def column(ctx: ParserRuleContext): Option[Integer]
protected def columnEnd(ctx: ParserRuleContext): Option[Integer]
override def createAst(): DiffGraphBuilder

Attributes

Definition Classes
AstCreatorBase
protected def createIdentifierWithScope(ctx: ParserRuleContext, name: String, code: String, typeFullName: String, dynamicTypeHints: Seq[String]): NewIdentifier
protected def line(ctx: ParserRuleContext): Option[Integer]
protected def lineEnd(ctx: ParserRuleContext): Option[Integer]

Inherited methods

def absolutePath(filename: String): String

Absolute path for the given file name

Absolute path for the given file name

Attributes

Inherited from:
AstCreatorBase
def annotationAssignmentAst(assignmentValueName: String, code: String, assignmentAst: Ast): Ast

Creates an AST that represents an annotation assignment with a name for the assigned value, its overall code, and the respective assignment AST.

Creates an AST that represents an annotation assignment with a name for the assigned value, its overall code, and the respective assignment AST.

Attributes

Inherited from:
AstCreatorBase
def annotationAst(annotation: NewAnnotation, children: Seq[Ast]): Ast

Creates an AST that represents an annotation, including its content (annotation parameter assignments).

Creates an AST that represents an annotation, including its content (annotation parameter assignments).

Attributes

Inherited from:
AstCreatorBase
protected def annotationNode(node: ParserRuleContext, code: String, name: String, fullName: String): NewAnnotation

Attributes

Inherited from:
AstNodeBuilder
protected def astForEncodingPseudoIdentifier(ctx: EncodingPseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForFalseLiteral(ctx: FalsePseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForFilePseudoIdentifier(ctx: FilePseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForLinePseudoIdentifier(ctx: LinePseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForNilLiteral(ctx: NilPseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForSelfPseudoIdentifier(ctx: SelfPseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
protected def astForTrueLiteral(ctx: TruePseudoVariableIdentifierContext): Ast

Attributes

Inherited from:
AstForPrimitivesCreator
def blockAst(blockNode: NewBlock, statements: List[Ast]): Ast

For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.

For a given block node and statement ASTs, create an AST that represents the block. The main purpose of this method is to increase the readability of the code which creates block asts.

Attributes

Inherited from:
AstCreatorBase
protected def blockNode(node: ParserRuleContext, code: String, typeFullName: String): NewBlock

Attributes

Inherited from:
AstNodeBuilder
protected def blockNode(node: ParserRuleContext): NewBlock

Attributes

Inherited from:
AstNodeBuilder
def callAst(callNode: NewCall, arguments: Seq[Ast], base: Option[Ast], receiver: Option[Ast]): Ast

Create an abstract syntax tree for a call, including CPG-specific edges required for arguments and the receiver.

Create an abstract syntax tree for a call, including CPG-specific edges required for arguments and the receiver.

Our call representation is inspired by ECMAScript, that is, in addition to arguments, a call has a base and a receiver. For languages other than Javascript, leave receiver empty for now.

Value parameters

arguments

arguments (without the base argument (instance))

base

the value to use as this in the method call.

callNode

the node that represents the entire call

receiver

the object in which the property lookup is performed

Attributes

Inherited from:
AstCreatorBase
def callNode(node: ParserRuleContext, code: String, name: String, methodFullName: String, dispatchType: String, signature: Option[String], typeFullName: Option[String]): NewCall

Attributes

Inherited from:
AstNodeBuilder
def callNode(node: ParserRuleContext, code: String, name: String, methodFullName: String, dispatchType: String): NewCall

Attributes

Inherited from:
AstNodeBuilder
def controlStructureAst(controlStructureNode: NewControlStructure, condition: Option[Ast], children: Seq[Ast], placeConditionLast: Boolean): Ast

For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.

For a given node, condition AST and children ASTs, create an AST that represents the control structure. The main purpose of this method is to automatically assign the correct condition edges.

Attributes

Inherited from:
AstCreatorBase
protected def controlStructureNode(node: ParserRuleContext, controlStructureType: String, code: String): NewControlStructure

Attributes

Inherited from:
AstNodeBuilder
def doWhileAst(condition: Option[Ast], body: Seq[Ast], code: Option[String], lineNumber: Option[Integer], columnNumber: Option[Integer]): Ast

Attributes

Inherited from:
AstCreatorBase
protected def fieldIdentifierNode(node: ParserRuleContext, name: String, code: String): NewFieldIdentifier

Attributes

Inherited from:
AstNodeBuilder
def forAst(forNode: NewControlStructure, locals: Seq[Ast], initAsts: Seq[Ast], conditionAsts: Seq[Ast], updateAsts: Seq[Ast], bodyAsts: Seq[Ast]): Ast

Attributes

Inherited from:
AstCreatorBase
def forAst(forNode: NewControlStructure, locals: Seq[Ast], initAsts: Seq[Ast], conditionAsts: Seq[Ast], updateAsts: Seq[Ast], bodyAst: Ast): Ast

Attributes

Inherited from:
AstCreatorBase
def globalNamespaceBlock(): NewNamespaceBlock

Create a global namespace block for the given filename

Create a global namespace block for the given filename

Attributes

Inherited from:
AstCreatorBase
protected def identifierNode(node: ParserRuleContext, name: String, code: String, typeFullName: String, dynamicTypeHints: Seq[String]): NewIdentifier

Attributes

Inherited from:
AstNodeBuilder
protected def literalNode(node: ParserRuleContext, code: String, typeFullName: String, dynamicTypeHints: Seq[String]): NewLiteral

Attributes

Inherited from:
AstNodeBuilder
protected def localNode(node: ParserRuleContext, name: String, code: String, typeFullName: String, closureBindingId: Option[String]): NewLocal

Attributes

Inherited from:
AstNodeBuilder
protected def memberNode(node: ParserRuleContext, name: String, code: String, typeFullName: String, dynamicTypeHints: Seq[String]): NewMember

Attributes

Inherited from:
AstNodeBuilder
protected def memberNode(node: ParserRuleContext, name: String, code: String, typeFullName: String): NewMember

Attributes

Inherited from:
AstNodeBuilder
def methodAst(method: NewMethod, parameters: Seq[Ast], body: Ast, methodReturn: NewMethodReturn, modifiers: Seq[NewModifier]): Ast

Creates an AST that represents an entire method, including its content.

Creates an AST that represents an entire method, including its content.

Attributes

Inherited from:
AstCreatorBase
def methodAstWithAnnotations(method: NewMethod, parameters: Seq[Ast], body: Ast, methodReturn: NewMethodReturn, modifiers: Seq[NewModifier], annotations: Seq[Ast]): Ast

Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.

Creates an AST that represents an entire method, including its content and with support for both method and parameter annotations.

Attributes

Inherited from:
AstCreatorBase
protected def methodNode(node: ParserRuleContext, name: String, code: String, fullName: String, signature: Option[String], fileName: String, astParentType: Option[String], astParentFullName: Option[String]): NewMethod

Attributes

Inherited from:
AstNodeBuilder
def methodNode(node: ParserRuleContext, name: String, fullName: String, signature: String, fileName: String): NewMethod

Attributes

Inherited from:
AstNodeBuilder
protected def methodRefNode(node: ParserRuleContext, code: String, methodFullName: String, typeFullName: String): NewMethodRef

Attributes

Inherited from:
AstNodeBuilder
def methodStubAst(method: NewMethod, parameters: Seq[NewMethodParameterIn], methodReturn: NewMethodReturn, modifiers: Seq[NewModifier]): Ast

Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.

Creates an AST that represents a method stub, containing information about the method, its parameters, and the return type.

Attributes

Inherited from:
AstCreatorBase
protected def parameterInNode(node: ParserRuleContext, name: String, code: String, index: Int, isVariadic: Boolean, evaluationStrategy: String, typeFullName: Option[String]): NewMethodParameterIn

Attributes

Inherited from:
AstNodeBuilder
protected def parameterInNode(node: ParserRuleContext, name: String, code: String, index: Int, isVariadic: Boolean, evaluationStrategy: String, typeFullName: String): NewMethodParameterIn

Attributes

Inherited from:
AstNodeBuilder
def returnAst(returnNode: NewReturn, arguments: Seq[Ast]): Ast

For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.

For a given return node and arguments, create an AST that represents the return instruction. The main purpose of this method is to automatically assign the correct argument indices.

Attributes

Inherited from:
AstCreatorBase
protected def returnNode(node: ParserRuleContext, code: String): NewReturn

Attributes

Inherited from:
AstNodeBuilder
def setArgumentIndices(arguments: Seq[Ast]): Unit

Attributes

Inherited from:
AstCreatorBase
def staticInitMethodAst(initAsts: List[Ast], fullName: String, signature: Option[String], returnType: String, fileName: Option[String], lineNumber: Option[Integer], columnNumber: Option[Integer]): Ast

Attributes

Inherited from:
AstCreatorBase
def tryCatchAst(tryNode: NewControlStructure, tryBodyAst: Ast, catchAsts: Seq[Ast], finallyAst: Option[Ast]): Ast

For the given try body, catch ASTs and finally AST, create a try-catch-finally AST with orders set correctly for the ossdataflow engine.

For the given try body, catch ASTs and finally AST, create a try-catch-finally AST with orders set correctly for the ossdataflow engine.

Attributes

Inherited from:
AstCreatorBase
protected def typeDeclNode(node: ParserRuleContext, name: String, fullName: String, filename: String, code: String, astParentType: String, astParentFullName: String, inherits: Seq[String], alias: Option[String]): NewTypeDecl

Attributes

Inherited from:
AstNodeBuilder
def typeDeclNode(node: ParserRuleContext, name: String, fullName: String, fileName: String, inheritsFrom: Seq[String], alias: Option[String]): NewTypeDecl

Attributes

Inherited from:
AstNodeBuilder
protected def typeRefNode(node: ParserRuleContext, code: String, typeFullName: String): NewTypeRef

Attributes

Inherited from:
AstNodeBuilder
protected def unknownNode(node: ParserRuleContext, code: String): NewUnknown

Attributes

Inherited from:
AstNodeBuilder
def whileAst(condition: Option[Ast], body: Seq[Ast], code: Option[String], lineNumber: Option[Integer], columnNumber: Option[Integer]): Ast

Attributes

Inherited from:
AstCreatorBase
def withArgumentIndex[T <: ExpressionNew](node: T, argIdxOpt: Option[Int]): T

Attributes

Inherited from:
AstCreatorBase
def withArgumentName[T <: ExpressionNew](node: T, argNameOpt: Option[String]): T

Attributes

Inherited from:
AstCreatorBase
def withIndex[T, X](nodes: Array[T])(f: (T, Int) => X): Seq[X]

Attributes

Inherited from:
AstCreatorBase
def withIndex[T, X](nodes: Seq[T])(f: (T, Int) => X): Seq[X]

Attributes

Inherited from:
AstCreatorBase
def wrapMultipleInBlock(asts: Seq[Ast], lineNumber: Option[Integer]): Ast

Attributes

Inherited from:
AstCreatorBase

Inherited fields

val diffGraph: DiffGraphBuilder

Attributes

Inherited from:
AstCreatorBase