|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cesta.util.antlr.java.ANTLRJavaHelper
public class ANTLRJavaHelper
ANTLRJavaHelper provides some helper functions for simplified access to JavaLexer and JavaParser, which are part of the framework.
Constructor Summary | |
---|---|
ANTLRJavaHelper()
|
Method Summary | |
---|---|
static java.util.List<org.antlr.runtime.Token> |
getIndent(org.antlr.runtime.TokenRewriteStream tokenStream,
org.antlr.runtime.Token baseToken)
Returns indent tokens, which are before baseToken in tokenStream. |
static java.lang.String |
getTypeDefaultValue(java.lang.String type)
Helper function, that returns default value for given type |
static void |
checkSyntax(org.antlr.runtime.TokenStream tokens)
Try to parse source code and check for errors in transformations |
static org.antlr.runtime.tree.CommonTree |
parseStream(org.antlr.runtime.TokenStream tokens)
Instantiates JavaParser on provided tokens, parses the code
and returns parsed abstract syntax tree (AST) |
static JavaLexer |
tokenizeStream(org.antlr.runtime.CharStream stream)
Instantiates JavaLexer on provided stream - it will
try to tokenize the input. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ANTLRJavaHelper()
Method Detail |
---|
public static JavaLexer tokenizeStream(org.antlr.runtime.CharStream stream) throws TransformationException
JavaLexer
on provided stream - it will
try to tokenize the input.
stream
- string stream which should be tokenized
TransformationException
public static org.antlr.runtime.tree.CommonTree parseStream(org.antlr.runtime.TokenStream tokens) throws TransformationException
JavaParser
on provided tokens, parses the code
and returns parsed abstract syntax tree (AST)
tokens
-
TransformationException
- in case that source code could not be parsedpublic static void checkSyntax(org.antlr.runtime.TokenStream tokens) throws TransformationException
tokens
- Tokens to be parsed
TransformationException
- in case that tokens couldn't be parsedpublic static java.util.List<org.antlr.runtime.Token> getIndent(org.antlr.runtime.TokenRewriteStream tokenStream, org.antlr.runtime.Token baseToken)
public static java.lang.String getTypeDefaultValue(java.lang.String type)
type
- type of return value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |