public interface ParseTree
This represents a parse tree which is the result of preprocessing and parsing
a source in various languages, such as CIVL-C, Fortran, C, etc. It will be
used as the input for the AST generation module
ASTBuilder.-
Method Summary
Modifier and TypeMethodDescriptiongets the Civlc token source associating with this parse tree, i.e., the CToken source that was used to produce this parse tree.returns the language that associates with this Parse treeorg.antlr.runtime.tree.CommonTreegetRoot()Gets the root of the tree.The source files from which this parse tree was derived.gets the token factory associating with this parse tree.getTokenSourceProducer(org.antlr.runtime.tree.CommonTree tokenListNode) Returns a token source consisting of the tokens from the children of the given node in the tree.newSyntaxException(String message, org.antlr.runtime.tree.CommonTree tree) Creates a new syntax exception.source(org.antlr.runtime.tree.CommonTree tree) Given a node in the parse tree, returns a source object for it.
-
Method Details
-
getLanguage
Configurations.Language getLanguage()returns the language that associates with this Parse tree- Returns:
-
getRoot
org.antlr.runtime.tree.CommonTree getRoot()Gets the root of the tree.- Returns:
- the root
-
source
Given a node in the parse tree, returns a source object for it.- Parameters:
tree- node in tree returned by method getTree()- Returns:
- a source object describing the origin of that node in the source code
-
getSourceFiles
Collection<SourceFile> getSourceFiles()The source files from which this parse tree was derived.- Returns:
- the set of source files
-
newSyntaxException
Creates a new syntax exception.- Parameters:
message- the message to print out when this exception is reported to the usertree- the node in the ANTLR tree that led to this exception- Returns:
- the new syntax exception
-
getTokenSourceProducer
Returns a token source consisting of the tokens from the children of the given node in the tree. This is useful, for example, to obtain the token source from the body of a pragma node. Child number 1 of the pragma node would be passed as the argument to this method.- Parameters:
tokenListNode- a node in the ANTLR tree whose children are all leaf nodes- Returns:
- a token source comprising the sequence of tokens obtained from the children of the given node
-
getCivlcTokenSource
CivlcTokenSource getCivlcTokenSource()gets the Civlc token source associating with this parse tree, i.e., the CToken source that was used to produce this parse tree. It contains all tokens, including those hidden for the parser- Returns:
-
getTokenFactory
TokenFactory getTokenFactory()gets the token factory associating with this parse tree.- Returns:
-