LanguageFrontend

The main task of the language frontend is to translate the programming language-specific files to the common CPG nodes. It further fills the scopeManager. The language frontend must not be used after having processed the files, i.e., it won't be available in passes.

More information can be found in the GitHub wiki page.

Constructors

Link copied to clipboard
constructor(language: Language<out LanguageFrontend<AstNode, TypeNode>>, ctx: TranslationContext)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
override var ctx: TranslationContext

The translation context, which contains all necessary managers used in this frontend parsing process. Note, that different contexts could passed to frontends, e.g., in parallel parsing to supply different managers to different frontends.

Link copied to clipboard
Link copied to clipboard

The language this frontend works for.

Link copied to clipboard
open override val namespace: Name?
Link copied to clipboard
open override val scope: Scope?
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
Link copied to clipboard
fun LanguageFrontend<*, *>.block(needsScope: Boolean = true, init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the FunctionDeclaration.body of the nearest enclosing FunctionDeclaration. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.body(needsScope: Boolean = true, init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the FunctionDeclaration.body of the nearest enclosing FunctionDeclaration. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.breakStmt(label: String? = null): BreakStatement

Creates a new BreakStatement in the Fluent Node DSL and adds it to the nearest enclosing Holder, but only if it is an StatementHolder.

Link copied to clipboard

This function returns a TranslationResult, but rather than parsing source code, the function init is used to build nodes in the Node Fluent DSL.

Link copied to clipboard
fun LanguageFrontend<*, *>.call(name: CharSequence, isStatic: Boolean = false, init: CallExpression.() -> Unit? = null): CallExpression

Creates a new CallExpression (or MemberCallExpression) in the Fluent Node DSL with the given name and adds it to the nearest enclosing Holder. Depending on whether it is a StatementHolder it is added to the list of StatementHolder.statements or in case of an ArgumentHolder, the function ArgumentHolder.addArgument is invoked.

Link copied to clipboard
fun LanguageFrontend<*, *>.case(caseExpression: Expression? = null): CaseStatement

Creates a new CaseStatement in the Fluent Node DSL and adds it to the nearest enclosing Holder, but only if it is an StatementHolder.

Link copied to clipboard
fun LanguageFrontend<*, *>.cast(castType: Type, init: CastExpression.() -> Unit? = null): CastExpression
Link copied to clipboard
open fun cleanup()
Link copied to clipboard
Link copied to clipboard
abstract override fun codeOf(astNode: AstNode): String?

Returns the raw code of the ast node, generic for java or c++ ast nodes.

Link copied to clipboard
Link copied to clipboard

Configures the IfStatement.condition in the Fluent Node DSL of the nearest enclosing IfStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new ConstructExpression in the Fluent Node DSL for the translation record/type with the given name and adds it to the nearest enclosing Holder. Depending on whether it is a StatementHolder it is added to the list of StatementHolder.statements or in case of an ArgumentHolder, the function ArgumentHolder.addArgument is invoked. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new ConstructorDeclaration in the Fluent Node DSL for the enclosing RecordDeclaration. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new ContinueStatement in the Fluent Node DSL and adds it to the nearest enclosing StatementHolder.

Link copied to clipboard

Creates a new DeclarationStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new DeclarationStatement in the Fluent Node DSL. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new DefaultStatement in the Fluent Node DSL and adds it to the nearest enclosing StatementHolder.

Link copied to clipboard

Configures the DoStatement.condition in the Fluent Node DSL of the nearest enclosing DoStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.doStmt(needsScope: Boolean = true, init: DoStatement.() -> Unit): DoStatement

Creates a new DoStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new IfStatement in the Fluent Node DSL and sets it to the IfStatement.elseStatement of the nearest enclosing IfStatement. This simulates an else-if scenario. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.elseStmt(needsScope: Boolean = true, init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the IfStatement.elseStatement of the nearest enclosing IfStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.field(name: CharSequence, type: Type = unknownType(), init: FieldDeclaration.() -> Unit? = null): FieldDeclaration

Creates a new FieldDeclaration in the Fluent Node DSL with the given name and optional type. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new ForEachStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.forStmt(initializer: DeclarationStatement, condition: Expression, iteration: Statement, elseStmt: Statement? = null, init: Block.() -> Unit): ForStatement

Creates a new ForStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun NamespaceProvider.fqn(localName: String): Name

Returns a new Name based on the localName and the current namespace as parent.

Link copied to clipboard
fun LanguageFrontend<*, *>.function(name: CharSequence, returnType: Type = unknownType(), returnTypes: List<Type>? = null, init: FunctionDeclaration.() -> Unit? = null): FunctionDeclaration

Creates a new FunctionDeclaration in the Fluent Node DSL with the given name and optional returnType. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new IfStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.ile(targetType: Type = unknownType(), init: InitializerListExpression.() -> Unit? = null): InitializerListExpression

Creates a new InitializerListExpression in the Fluent Node DSL and invokes ArgumentHolder.addArgument of the nearest enclosing Holder, but only if it is an ArgumentHolder.

Link copied to clipboard

Creates a new IncludeDeclaration and adds it to the surrounding TranslationUnitDeclaration.

Link copied to clipboard
Link copied to clipboard

Configures the ForStatement.initializerStatement in the Fluent Node DSL of the nearest enclosing ForStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Checks, whether the given Type is a primitive in the language specified in the LanguageProvider.

Link copied to clipboard

Configures the ForEachStatement.iterable in the Fluent Node DSL of the nearest enclosing ForEachStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.label(label: String, init: LabelStatement.() -> Statement? = null): LabelStatement

Creates a new LabelStatement in the Fluent Node DSL and adds it to the nearest enclosing StatementHolder.

Link copied to clipboard
Link copied to clipboard
fun <N> LanguageFrontend<*, *>.literal(value: N, type: Type = unknownType()): Literal<N>

Creates a new Literal in the Fluent Node DSL and invokes ArgumentHolder.addArgument of the nearest enclosing Holder, but only if it is an ArgumentHolder.

Link copied to clipboard
abstract override fun locationOf(astNode: AstNode): PhysicalLocation?

Returns the Region of the code with line and column, index starting at 1, generic for java or c++ ast nodes.

Link copied to clipboard
fun LanguageFrontend<*, *>.loopBody(init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the LoopStatement.statement of the nearest enclosing LoopStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.loopElseStmt(needsScope: Boolean = true, init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the LoopStatement.elseStatement of the nearest enclosing LoopStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.member(name: CharSequence, base: Expression? = null, operatorCode: String = "."): MemberExpression

Creates a new MemberExpression in the Fluent Node DSL and invokes ArgumentHolder.addArgument of the nearest enclosing Holder, but only if it is an ArgumentHolder. If the name doesn't already contain a fqn, we add an implicit "this" as base.

Link copied to clipboard
fun LanguageFrontend<*, *>.memberCall(localName: CharSequence, base: Expression, isStatic: Boolean = false, init: MemberCallExpression.() -> Unit? = null): MemberCallExpression

Creates a new CallExpression (or MemberCallExpression) in the Fluent Node DSL with the given localName and adds it to the nearest enclosing Holder. Depending on whether it is a StatementHolder it is added to the list of StatementHolder.statements or in case of an ArgumentHolder, the function ArgumentHolder.addArgument is invoked.

Link copied to clipboard
fun LanguageFrontend<*, *>.memberOrRef(name: Name, type: Type = unknownType()): Expression
Link copied to clipboard
fun LanguageFrontend<*, *>.method(name: CharSequence, returnType: Type = unknownType(), init: MethodDeclaration.() -> Unit? = null): MethodDeclaration

Creates a new MethodDeclaration in the Fluent Node DSL with the given name and optional returnType. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new NamespaceDeclaration in the Fluent Node DSL with the given name. The declaration will be set to the ScopeManager.globalScope. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.new(init: NewExpression.() -> Unit? = null): NewExpression
Link copied to clipboard

Creates a new Annotation. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new AnnotationMember. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new AssertStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newAssignExpression(operatorCode: String = "=", lhs: List<Expression> = listOf(), rhs: List<Expression> = listOf(), rawNode: Any? = null): AssignExpression

Creates a new AssignExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new BinaryOperator or a ShortCircuitOperator if the language implements HasShortCircuitOperators and if the operatorCode is contained in HasShortCircuitOperators.operatorCodes. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new Block. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new BreakStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newCallExpression(callee: Expression? = null, fqn: CharSequence? = null, template: Boolean = false, rawNode: Any? = null): CallExpression

Creates a new CallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CaseStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CastExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new CatchClause. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newConditionalExpression(condition: Expression, thenExpression: Expression? = null, elseExpression: Expression? = null, type: Type = unknownType(), rawNode: Any? = null): ConditionalExpression

Creates a new ConditionalExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ConstructExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ConstructorDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ContinueStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DeclarationStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DefaultStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DeleteExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DistinctLanguageBlock. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new DoStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EmptyStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EnumConstantDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new EnumDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ExpressionList. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newFieldDeclaration(name: CharSequence?, type: Type = unknownType(), modifiers: List<String>? = listOf(), initializer: Expression? = null, implicitInitializerAllowed: Boolean = false, rawNode: Any? = null): FieldDeclaration

Creates a new FieldDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ForEachStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ForStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newFunctionDeclaration(name: CharSequence?, localNameOnly: Boolean = false, rawNode: Any? = null): FunctionDeclaration

Creates a new FunctionDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new FunctionTemplateDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new GotoStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new IfStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newImportDeclaration(import: Name, wildcardImport: Boolean = false, alias: Name? = null, rawNode: Any? = null): ImportDeclaration

Creates a new ImportDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new IncludeDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new InitializerListExpression. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new KeyValueExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LabelStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LambdaExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun <T, V> RawNodeTypeProvider<T>.newLiteral(value: V, type: Type = unknownType(), rawNode: Any? = null): Literal<V>

Creates a new Literal. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new LookupScopeStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new MemberCallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newMemberExpression(name: CharSequence?, base: Expression, memberType: Type = unknownType(), operatorCode: String? = ".", rawNode: Any? = null): MemberExpression

Creates a new MemberExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newMethodDeclaration(name: CharSequence?, isStatic: Boolean = false, recordDeclaration: RecordDeclaration? = null, rawNode: Any? = null): MethodDeclaration

Creates a new MethodDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun LanguageProvider.newName(name: CharSequence, localNameOnly: Boolean = false, namespace: Name? = null): Name

Generates a Name object from the given name. If localNameOnly is set, only the localName is used, otherwise the namespace is added to generate a fqn if the name is not a fqn anyway.

Link copied to clipboard

Creates a new NamespaceDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new NewArrayExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newNewExpression(type: Type = unknownType(), rawNode: Any? = null): NewExpression

Creates a new NewExpression. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new MemberCallExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newOperatorDeclaration(name: CharSequence, operatorCode: String, recordDeclaration: RecordDeclaration? = null, rawNode: Any? = null): OperatorDeclaration

Creates a new OperatorDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newParameterDeclaration(name: CharSequence?, type: Type = unknownType(), variadic: Boolean = false, rawNode: Any? = null): ParameterDeclaration

Creates a new ParameterDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newProblemDeclaration(problem: String = "", problemType: ProblemNode.ProblemType = ProblemNode.ProblemType.PARSING, rawNode: Any? = null): ProblemDeclaration

Creates a new ProblemDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newProblemExpression(problem: String = "", type: ProblemNode.ProblemType = ProblemNode.ProblemType.PARSING, rawNode: Any? = null): ProblemExpression

Creates a new ProblemExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
Link copied to clipboard
fun MetadataProvider.newRangeExpression(floor: Expression? = null, ceiling: Expression? = null, rawNode: Any? = null): RangeExpression

Creates a new RangeExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new RecordDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new RecordTemplateDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newReference(name: CharSequence?, type: Type = unknownType(), rawNode: Any? = null): Reference

Creates a new Reference. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ReturnStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SubscriptExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SwitchStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new SynchronizedStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new ThrowExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TranslationUnitDeclaration. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TryStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TupleDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TypedefDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newTypeExpression(name: CharSequence?, type: Type = unknownType(), rawNode: Any? = null): TypeExpression

Creates a new TypeExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newTypeIdExpression(operatorCode: String, type: Type = unknownType(), referencedType: Type = unknownType(), rawNode: Any? = null): TypeIdExpression

Creates a new TypeIdExpression. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new TypeParameterDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newUnaryOperator(operatorCode: String, postfix: Boolean, prefix: Boolean, rawNode: Any? = null): UnaryOperator

Creates a new UnaryOperator. This is the top-most Node that a LanguageFrontend or Handler should create. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun MetadataProvider.newVariableDeclaration(name: CharSequence?, type: Type = unknownType(), implicitInitializerAllowed: Boolean = false, rawNode: Any? = null): VariableDeclaration

Creates a new VariableDeclaration. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard

Creates a new WhileStatement. The MetadataProvider receiver will be used to fill different meta-data using Node.applyMetadata. Calling this extension function outside of Kotlin requires an appropriate MetadataProvider, such as a LanguageFrontend as an additional prepended argument.

Link copied to clipboard
fun LanguageProvider.objectType(name: CharSequence, generics: List<Type> = listOf(), rawNode: Any? = null): Type

This function returns an ObjectType with the given name. If a respective Type does not yet exist (in the current scope), it will be created. In order to avoid unnecessary allocation of simple types, we do a pre-check within this function, whether a built-in type exist with the particular name.

Link copied to clipboard
fun LanguageFrontend<*, *>.param(name: CharSequence, type: Type = unknownType(), init: ParameterDeclaration.() -> Unit? = null): ParameterDeclaration

Creates a new ParameterDeclaration in the Fluent Node DSL and adds it to the FunctionDeclaration.parameters of the nearest enclosing FunctionDeclaration. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A small utility extension function that uses the language information in a LanguageProvider (such as a Node, a Language, a LanguageFrontend or a Handler) to parse a fully qualified name.

Link copied to clipboard

This function constructs a new primitive Type. Primitive or built-in types are defined in Language.builtInTypes. This function will look up the type by its name, if it fails to find an appropriate build-in type, a TranslationException is thrown. Therefore, this function should primarily be called by language frontends if they are sure that this type is a built-in type, e.g., when constructing literals. It can be useful, if frontends want to check, whether all literal types are correctly registered as built-in types.

Link copied to clipboard
fun LanguageFrontend<*, *>.problemDecl(description: String, type: ProblemNode.ProblemType = ProblemNode.ProblemType.TRANSLATION, init: ProblemDeclaration.() -> Unit? = null): ProblemDeclaration

Creates a new ProblemDeclaration in the Fluent Node DSL and adds it to the DeclarationStatement.declarations of the nearest enclosing DeclarationStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
open fun process(from: Any, to: Node)

This function should be called by anything that implements this processed listener to indicate that a new Node has been processed from the raw node in from.

Link copied to clipboard
Link copied to clipboard
fun LanguageFrontend<*, *>.record(name: CharSequence, kind: String = "class", init: RecordDeclaration.() -> Unit): RecordDeclaration

Creates a new RecordDeclaration in the Fluent Node DSL with the given name. The declaration will be set to the ScopeManager.currentRecord. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.ref(name: CharSequence, type: Type = unknownType(), makeMagic: Boolean = true, init: Reference.() -> Unit? = null): Reference

Creates a new Reference in the Fluent Node DSL and invokes ArgumentHolder.addArgument of the nearest enclosing Holder, but only if it is an ArgumentHolder.

Link copied to clipboard
open fun registerObjectListener(from: Any, biConsumer: BiConsumer<Any, Node>)

Registers a new listener (biConsumer), that gets called if the raw node specified in from gets processed.

Link copied to clipboard
open fun registerPredicateListener(predicate: BiPredicate<Any, Node>, biConsumer: BiConsumer<Any, Node>)
Link copied to clipboard

Creates a new ReturnStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
abstract fun setComment(node: Node, astNode: AstNode)
Link copied to clipboard
Link copied to clipboard
fun LanguageFrontend<*, *>.switchBody(init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the SwitchStatement.statement of the nearest enclosing SwitchStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.switchStmt(selector: Expression, needsScope: Boolean = true, init: SwitchStatement.() -> Unit): SwitchStatement

Creates a new SwitchStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.t(name: CharSequence, generics: List<Type> = listOf()): Type

Creates a new Type with the given name in the Fluent Node DSL.

Link copied to clipboard
fun LanguageFrontend<*, *>.thenStmt(needsScope: Boolean = true, init: Block.() -> Unit): Block

Creates a new Block in the Fluent Node DSL and sets it to the IfStatement.thenStatement of the nearest enclosing IfStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new TranslationUnitDeclaration in the Fluent Node DSL with the given name. The declaration will be set to the ScopeManager.globalScope. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
abstract fun typeOf(type: TypeNode): Type

This function serves as an entry-point to type parsing in the language frontend. It needs to return a Type object based on the ast type object used by the language frontend, e.g., the parser.

Link copied to clipboard

Creates a new UnknownType and sets the appropriate language, if this MetadataProvider includes a LanguageProvider.

Link copied to clipboard

Configures the ForEachStatement.variable in the Fluent Node DSL of the nearest enclosing ForEachStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

fun LanguageFrontend<*, *>.variable(name: String, type: Type = unknownType(), init: VariableDeclaration.() -> Unit? = null): VariableDeclaration

Creates a new VariableDeclaration in the Fluent Node DSL and adds it to the DeclarationStatement.declarations of the nearest enclosing DeclarationStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard

Creates a new IncompleteType in the Fluent Node DSL.

Link copied to clipboard

Configures the WhileStatement.condition in the Fluent Node DSL of the nearest enclosing WhileStatement. The init block can be used to create further sub-nodes as well as configuring the created node itself.

Link copied to clipboard
fun LanguageFrontend<*, *>.whileStmt(needsScope: Boolean = true, init: WhileStatement.() -> Unit): WhileStatement

Creates a new WhileStatement in the Fluent Node DSL and adds it to the StatementHolder.statements of the nearest enclosing StatementHolder. The init block can be used to create further sub-nodes as well as configuring the created node itself.