Class ThrowTarget<T>
java.lang.Object
io.github.douira.glsl_transformer.GLSLParserBaseListener
io.github.douira.glsl_transformer.transform.TransformationPhase<T>
io.github.douira.glsl_transformer.core.target.HandlerTarget<T>
io.github.douira.glsl_transformer.core.target.ThrowTarget<T>
- All Implemented Interfaces:
io.github.douira.glsl_transformer.GLSLParserListener,ParseTreeListener
A target that searches for a search string in and upon finding a match uses a
method to generate an exception which is then thrown.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.douira.glsl_transformer.transform.TransformationPhase
TransformationPhase.InjectionPoint -
Constructor Summary
ConstructorsConstructorDescriptionThrowTarget(String needle) Creates a new throw target with a given search string -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ThrowTarget<T>fromMessage(String needle, String message) Creates a new throw target with a fixed message instead of using the implemented method of a subclass to generate exceptions.abstract SemanticExceptiongetException(TreeMember node, String match) Generates the exception when this target is found.voidhandleResult(TreeMember node, String match) Handles the containing node and token that the string was found in.Methods inherited from class io.github.douira.glsl_transformer.core.target.HandlerTarget
getNeedle, setCollectorMethods inherited from class io.github.douira.glsl_transformer.transform.TransformationPhase
checkBeforeWalk, compilePath, compilePattern, createLocalRoot, findAndMatch, getCollector, getJobParameters, getLexer, getParser, getRootNode, getSiblings, init, injectDefine, injectExternalDeclaration, injectNode, injectNodes, isActive, removeNode, replaceNode, replaceNode, runAfterWalkMethods inherited from class io.github.douira.glsl_transformer.GLSLParserBaseListener
enterAdditiveExpression, enterAndExpression, enterArraySpecifier, enterAssignmentExpression, enterAssignmentOperator, enterAttribute, enterBuiltinTypeSpecifierFixed, enterBuiltinTypeSpecifierParseable, enterCallParameterList, enterCaseLabel, enterCompoundStatement, enterCondition, enterConditionalExpression, enterConstantExpression, enterDeclaration, enterDeclarationMember, enterDeclarationMemberList, enterDeclarationStatement, enterDemoteStatement, enterDoWhileStatement, enterEmptyStatement, enterEqualityExpression, enterEveryRule, enterExclusiveOrExpression, enterExpression, enterExpressionStatement, enterExtensionState, enterExtensionStatement, enterExternalDeclaration, enterForStatement, enterFullySpecifiedType, enterFunctionCall, enterFunctionDefinition, enterFunctionHeader, enterFunctionIdentifier, enterFunctionParameterList, enterFunctionPrototype, enterInclusiveOrExpression, enterInitDeclaratorList, enterInitializer, enterInterpolationQualifier, enterInvariantQualifier, enterJumpStatement, enterLayoutDefaults, enterLayoutModes, enterLayoutQualifier, enterLayoutQualifierId, enterLogicalAndExpression, enterLogicalOrExpression, enterLogicalXorExpression, enterMethodCall, enterMultiplicativeExpression, enterParameterDeclaration, enterParameterDeclarator, enterPostfixExpression, enterPragmaStatement, enterPreciseQualifier, enterPrecisionQualifier, enterPrimaryExpression, enterRelationalExpression, enterSelectionStatement, enterShiftExpression, enterSimpleStatement, enterSingleAttribute, enterStatement, enterStorageQualifier, enterStructDeclaration, enterStructDeclarationList, enterStructDeclarator, enterStructDeclaratorList, enterStructSpecifier, enterSwitchStatement, enterTranslationUnit, enterTypeNameList, enterTypeQualifier, enterTypeSpecifier, enterTypeSpecifierNonarray, enterUnaryExpression, enterUnaryOperator, enterVariableIdentifier, enterVersionStatement, enterWhileStatement, exitAdditiveExpression, exitAndExpression, exitArraySpecifier, exitAssignmentExpression, exitAssignmentOperator, exitAttribute, exitBuiltinTypeSpecifierFixed, exitBuiltinTypeSpecifierParseable, exitCallParameterList, exitCaseLabel, exitCompoundStatement, exitCondition, exitConditionalExpression, exitConstantExpression, exitDeclaration, exitDeclarationMember, exitDeclarationMemberList, exitDeclarationStatement, exitDemoteStatement, exitDoWhileStatement, exitEmptyStatement, exitEqualityExpression, exitEveryRule, exitExclusiveOrExpression, exitExpression, exitExpressionStatement, exitExtensionState, exitExtensionStatement, exitExternalDeclaration, exitForStatement, exitFullySpecifiedType, exitFunctionCall, exitFunctionDefinition, exitFunctionHeader, exitFunctionIdentifier, exitFunctionParameterList, exitFunctionPrototype, exitInclusiveOrExpression, exitInitDeclaratorList, exitInitializer, exitInterpolationQualifier, exitInvariantQualifier, exitJumpStatement, exitLayoutDefaults, exitLayoutModes, exitLayoutQualifier, exitLayoutQualifierId, exitLogicalAndExpression, exitLogicalOrExpression, exitLogicalXorExpression, exitMethodCall, exitMultiplicativeExpression, exitParameterDeclaration, exitParameterDeclarator, exitPostfixExpression, exitPragmaStatement, exitPreciseQualifier, exitPrecisionQualifier, exitPrimaryExpression, exitRelationalExpression, exitSelectionStatement, exitShiftExpression, exitSimpleStatement, exitSingleAttribute, exitStatement, exitStorageQualifier, exitStructDeclaration, exitStructDeclarationList, exitStructDeclarator, exitStructDeclaratorList, exitStructSpecifier, exitSwitchStatement, exitTranslationUnit, exitTypeNameList, exitTypeQualifier, exitTypeSpecifier, exitTypeSpecifierNonarray, exitUnaryExpression, exitUnaryOperator, exitVariableIdentifier, exitVersionStatement, exitWhileStatement, visitErrorNode, visitTerminal
-
Constructor Details
-
ThrowTarget
Creates a new throw target with a given search string- Parameters:
needle- The search string
-
-
Method Details
-
handleResult
Description copied from class:HandlerTargetHandles the containing node and token that the string was found in.- Specified by:
handleResultin classHandlerTarget<T>- Parameters:
node- The node that contains the tokenmatch- The token text that contains the needle
-
getException
Generates the exception when this target is found.- Parameters:
node- The node that contains the tokenmatch- The token text that contains the needle- Returns:
- The semantic exception to throw
-
fromMessage
Creates a new throw target with a fixed message instead of using the implemented method of a subclass to generate exceptions.- Type Parameters:
T- The job parameter type- Parameters:
needle- The search string for the throw targetmessage- The message to make the exceptions with- Returns:
- The constructed throw target
-