Package dev.cel.parser
Class CelMacroExprFactory
- java.lang.Object
-
- dev.cel.common.ast.CelExprFactory
-
- dev.cel.parser.CelMacroExprFactory
-
public abstract class CelMacroExprFactory extends CelExprFactory
Assists with the expansion ofCelMacroin a manner which is consistent with the source position and expression ID generation code leveraged by both the parser and type-checker.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description dev.cel.common.ast.CelExprcopy(dev.cel.common.ast.CelExpr expr)DuplicatesCelExprwith a brand new set of identifiers.protected abstract longcopyExprId(long id)Returns the next unique expression ID which is associated with the same metadata (i.e.protected abstract dev.cel.common.CelSourceLocationcurrentSourceLocationForMacro()Returns the current (last known) source location.abstract java.lang.StringgetAccumulatorVarName()Returns the default accumulator variable name used by macros implementing comprehensions.protected abstract dev.cel.common.CelSourceLocationgetSourceLocation(long exprId)Retrieves the source location for the givenCelExprID.dev.cel.common.CelSourceLocationgetSourceLocation(dev.cel.common.ast.CelExpr expr)Retrieves the source location for the givenCelExprID.abstract dev.cel.common.ast.CelExprreportError(CelIssue error)Reports aCelIssueand returns a sentinelCelExprthat indicates an error.dev.cel.common.ast.CelExprreportError(java.lang.String message)Creates aCelIssueand reports it, returning a sentinelCelExprthat indicates an error.dev.cel.common.ast.CelExprreportError(java.lang.String format, java.lang.Object... args)Creates aCelIssueand reports it, returning a sentinelCelExprthat indicates an error.-
Methods inherited from class dev.cel.common.ast.CelExprFactory
fold, fold, newBoolLiteral, newBytesLiteral, newBytesLiteral, newBytesLiteral, newConstant, newDoubleLiteral, newGlobalCall, newGlobalCall, newIdentifier, newInstance, newIntLiteral, newList, newList, newMap, newMap, newMapEntry, newMessage, newMessage, newMessageField, newReceiverCall, newReceiverCall, newSelect, newStringLiteral, newUintLiteral, nextExprId
-
-
-
-
Method Detail
-
reportError
@FormatMethod public final dev.cel.common.ast.CelExpr reportError(@FormatString java.lang.String format, java.lang.Object... args)Creates aCelIssueand reports it, returning a sentinelCelExprthat indicates an error.
-
reportError
public final dev.cel.common.ast.CelExpr reportError(java.lang.String message)
Creates aCelIssueand reports it, returning a sentinelCelExprthat indicates an error.
-
reportError
public abstract dev.cel.common.ast.CelExpr reportError(CelIssue error)
Reports aCelIssueand returns a sentinelCelExprthat indicates an error.
-
getAccumulatorVarName
public abstract java.lang.String getAccumulatorVarName()
Returns the default accumulator variable name used by macros implementing comprehensions.
-
getSourceLocation
public final dev.cel.common.CelSourceLocation getSourceLocation(dev.cel.common.ast.CelExpr expr)
Retrieves the source location for the givenCelExprID.
-
copy
public final dev.cel.common.ast.CelExpr copy(dev.cel.common.ast.CelExpr expr)
DuplicatesCelExprwith a brand new set of identifiers.
-
copyExprId
protected abstract long copyExprId(long id)
Returns the next unique expression ID which is associated with the same metadata (i.e. source location, types, references, etc.) as `id`.
-
getSourceLocation
protected abstract dev.cel.common.CelSourceLocation getSourceLocation(long exprId)
Retrieves the source location for the givenCelExprID.
-
currentSourceLocationForMacro
protected abstract dev.cel.common.CelSourceLocation currentSourceLocationForMacro()
Returns the current (last known) source location. This should only be used for macros.
-
-