Package apg
Class Ast.AstCallback
- java.lang.Object
-
- apg.Ast.AstCallback
-
- Enclosing class:
- Ast
public abstract static class Ast.AstCallback extends java.lang.Object
The base class for all AST callback functions. It is very similar to the callback functions used for semantic actions called by the Parser.
-
-
Field Summary
Fields Modifier and Type Field Description Ast.CallbackData
callbackData
Provides user access to the sentence being parsed, as well as any user-defined data that may be necessary.
-
Constructor Summary
Constructors Constructor Description AstCallback(Ast ast)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
postBranch(int offset, int length)
This function is called when this AST node is reached the second and final time and after the AST branch below this node has been traversed.boolean
preBranch(int offset, int length)
This function is called when this AST node is reached the first time and before the AST branch below this node is traversed.
-
-
-
Field Detail
-
callbackData
public final Ast.CallbackData callbackData
Provides user access to the sentence being parsed, as well as any user-defined data that may be necessary.
-
-
Constructor Detail
-
AstCallback
public AstCallback(Ast ast)
- Parameters:
ast
- an instance of the AST this callback function is to be attached to.
-
-
Method Detail
-
preBranch
public boolean preBranch(int offset, int length)
This function is called when this AST node is reached the first time and before the AST branch below this node is traversed.- Parameters:
offset
- offset into the input string of the first character of the phrase matched by this node.length
- the number of characters in the matched phrase.- Returns:
- if
true
AST traversal will skip processing of all nodes in the AST branch below this node. iffalse
AST traversal continues normally.
-
postBranch
public abstract void postBranch(int offset, int length)
This function is called when this AST node is reached the second and final time and after the AST branch below this node has been traversed.- Parameters:
offset
- offset into the input string of the first character of the phrase matched by this node.length
- the number of characters in the matched phrase.
-
-