Class XmlDirectConstructorTranslation
java.lang.Object
org.rumbledb.compiler.translation.xml.XmlDirectConstructorTranslation
Translation logic for XML direct constructors (elements, comments, processing instructions, attributes, and content).
Operates on parser-agnostic context adapters so that direct constructor AST construction is shared between JSONiq and
XQuery.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <ExprCtx extends org.antlr.v4.runtime.ParserRuleContext>
ExpressioncommonContent(CommonContentContext<ExprCtx> ctx, TranslationContext translationContext, Function<ExprCtx, Expression> visitExpr) Translates direct constructor common content (enclosed expression or literal content) into anExpression.static <QnameCtx extends org.antlr.v4.runtime.ParserRuleContext,DirElemContentCtx extends org.antlr.v4.runtime.ParserRuleContext, ExprCtx extends org.antlr.v4.runtime.ParserRuleContext>
ExpressiondirectConstructor(DirectConstructorContext<QnameCtx, ExprCtx, DirElemContentCtx> ctx, org.antlr.v4.runtime.CommonTokenStream tokenStream, TranslationContext translationContext, BiFunction<QnameCtx, TranslationNameResolver.NameRole, Name> parseName, Function<DirElemContentCtx, Expression> visitDirElemContent, Function<ExprCtx, Expression> visitExpr) Translates a direct constructor (element, comment, or processing instruction) into anExpression.static <DirectConstructorCtx extends org.antlr.v4.runtime.ParserRuleContext,CommonContentCtx extends org.antlr.v4.runtime.ParserRuleContext>
ExpressiondirElemContent(DirElemContentContext<DirectConstructorCtx, CommonContentCtx> ctx, org.antlr.v4.runtime.CommonTokenStream tokenStream, TranslationContext translationContext, Function<DirectConstructorCtx, Expression> visitDirectConstructor, Function<CommonContentCtx, Expression> visitCommonContent) Translates direct element content (nested direct constructor, common content, CDATA, or literal text) into anExpression.
-
Method Details
-
directConstructor
public static <QnameCtx extends org.antlr.v4.runtime.ParserRuleContext,DirElemContentCtx extends org.antlr.v4.runtime.ParserRuleContext, Expression directConstructorExprCtx extends org.antlr.v4.runtime.ParserRuleContext> (DirectConstructorContext<QnameCtx, ExprCtx, DirElemContentCtx> ctx, org.antlr.v4.runtime.CommonTokenStream tokenStream, TranslationContext translationContext, BiFunction<QnameCtx, TranslationNameResolver.NameRole, Name> parseName, Function<DirElemContentCtx, Expression> visitDirElemContent, Function<ExprCtx, Expression> visitExpr) Translates a direct constructor (element, comment, or processing instruction) into anExpression.- Type Parameters:
QnameCtx- the parse-tree context type for QNamesDirElemContentCtx- the parse-tree context type for direct element contentExprCtx- the parse-tree context type for expressions- Parameters:
ctx- the direct constructor context adaptertokenStream- the common token streamtranslationContext- the current translation contextparseName- function resolving a QName to aNamevisitDirElemContent- visitor function for direct element contentvisitExpr- visitor function for general expressions- Returns:
- the translated direct constructor expression
-
dirElemContent
public static <DirectConstructorCtx extends org.antlr.v4.runtime.ParserRuleContext,CommonContentCtx extends org.antlr.v4.runtime.ParserRuleContext> Expression dirElemContent(DirElemContentContext<DirectConstructorCtx, CommonContentCtx> ctx, org.antlr.v4.runtime.CommonTokenStream tokenStream, TranslationContext translationContext, Function<DirectConstructorCtx, Expression> visitDirectConstructor, Function<CommonContentCtx, Expression> visitCommonContent) Translates direct element content (nested direct constructor, common content, CDATA, or literal text) into anExpression.- Type Parameters:
DirectConstructorCtx- the parse-tree context type for direct constructorsCommonContentCtx- the parse-tree context type for common content- Parameters:
ctx- the element content context adaptertokenStream- the common token streamtranslationContext- the current translation contextvisitDirectConstructor- visitor function for nested direct constructorsvisitCommonContent- visitor function for common content- Returns:
- the translated element content expression
-
commonContent
public static <ExprCtx extends org.antlr.v4.runtime.ParserRuleContext> Expression commonContent(CommonContentContext<ExprCtx> ctx, TranslationContext translationContext, Function<ExprCtx, Expression> visitExpr) Translates direct constructor common content (enclosed expression or literal content) into anExpression.- Type Parameters:
ExprCtx- the parse-tree context type for expressions- Parameters:
ctx- the common content context adaptertranslationContext- the current translation contextvisitExpr- visitor function for expressions- Returns:
- the translated common content expression
-