|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jga.parser.FunctorParser
public class FunctorParser
Parser that converts java-like expressions into functors. The parser is not safe to be used concurrently by multiple threads.
| Field Summary | |
|---|---|
static java.lang.String[] |
ARG_NAME
|
Token |
jj_nt
|
boolean |
lookingAhead
|
Token |
token
|
FunctorParserTokenManager |
token_source
|
| Fields inherited from interface net.sf.jga.parser.FunctorParserConstants |
|---|
CHARACTER_LITERAL, CLASS, DECIMAL_LITERAL, DEFAULT, DIGIT, EOF, EXPONENT, FALSE, FLOATING_POINT_LITERAL, HEX_LITERAL, IDENTIFIER, INSTANCEOF, INTEGER_LITERAL, LETTER, LPAREN, NEW, NULL, OCTAL_LITERAL, STRING_LITERAL, THIS, tokenImage, TRUE |
| Constructor Summary | |
|---|---|
FunctorParser()
|
|
FunctorParser(CharStream stream)
|
|
FunctorParser(FunctorParserTokenManager tm)
|
|
FunctorParser(java.io.InputStream is)
|
|
FunctorParser(java.io.Reader in)
|
|
| Method Summary | |
|---|---|
FunctorRef |
AdditiveExpression()
|
FunctorRef |
AllocationExpression()
|
FunctorRef |
AndExpression()
|
FunctorRef[] |
ArgumentList(FunctorRef[] args)
|
FunctorRef[] |
Arguments()
|
void |
bindThis(java.lang.Object thisBinding)
Binds the object to which 'this' refers |
FunctorRef |
Boolean()
|
FunctorRef |
CastExpression()
|
void |
CastLookahead()
|
FunctorRef |
Character()
|
FunctorRef |
ClassOrInterfaceType()
|
FunctorRef |
ConditionalAndExpression()
|
FunctorRef |
ConditionalExpression()
|
FunctorRef |
ConditionalOrExpression()
|
void |
deportClass(java.lang.String alias)
Removes information about the class imported under the given name. |
void |
disable_tracing()
|
void |
enable_tracing()
|
FunctorRef |
EqualityExpression()
|
FunctorRef |
Expression()
|
FunctorRef |
Float()
|
FunctorRef |
Functor()
|
ParseException |
generateParseException()
|
protected java.lang.Object |
getBoundObject()
Returns the current object to which 'this' refers |
java.lang.reflect.Field |
getImportedField(java.lang.String name)
Returns the imported field with the given name, or null if no such field has been imported. |
java.lang.reflect.Method[] |
getImportedMethods(java.lang.String name)
Returns a list of methods with the given name |
static FunctorParser |
getInstance()
Returns a globally accessible default instance of a FunctorParser. |
Token |
getNextToken()
|
java.lang.Class |
getReturnType()
Returns the type of object returned by the last functor parsed. |
Token |
getToken(int index)
|
void |
importClass(java.lang.Class clasz)
Imports the given class into the parser. |
void |
importClass(java.lang.String alias,
java.lang.Class clasz)
Imports the given class into the parser under the given alias. |
void |
ImportedMethodLookahead()
|
FunctorRef |
ImportedStaticMethodCall()
|
void |
importField(java.lang.Class clasz,
java.lang.String name)
Imports the given static member. |
void |
importField(java.lang.reflect.Field field)
Imports the given static member. |
void |
importMethod(java.lang.Class clasz,
java.lang.String name)
Imports the given static method(s). |
void |
importMethod(java.lang.reflect.Method meth)
Imports a static method into the parser. |
void |
importMethod(java.lang.String name,
java.lang.reflect.Method meth)
Imports a static method into the parser under the given name. |
void |
importStatics(java.lang.Class clasz)
Imports all of the static public methods and members in the given class. |
FunctorRef |
InstanceOfExpression()
|
FunctorRef |
Integer()
|
boolean |
isUndecoratedDecimal()
When true, an undecorated number containing a decimal, for example 1.50 is interpreted as a BigDecimal literal. |
FunctorRef |
Literal()
|
static void |
main(java.lang.String[] args)
|
FunctorRef |
MultiplicativeExpression()
|
FunctorRef |
Name()
|
FunctorRef |
Null()
|
FunctorRef |
OrExpression()
|
static Generator |
parse(java.lang.String str)
Parses the string to create a Generator. |
static UnaryFunctor |
parse(java.lang.String str,
java.lang.Class argType)
Parses the string to create a UnaryFunctor that takes an argument of the given type. |
static BinaryFunctor |
parse(java.lang.String str,
java.lang.Class arg1Type,
java.lang.Class arg2Type)
Parses the string to create a BinaryFunctor that takes arguments of the given types. |
BinaryFunctor |
parseBinary(java.lang.Class arg1Type,
java.lang.Class arg2Type)
Parses the current input to create a BinaryFunctor that takes arguments of the given types. |
BinaryFunctor |
parseBinary(java.lang.String str,
java.lang.Class arg1Type,
java.lang.Class arg2Type)
Parses the string to create a BinaryFunctor that takes arguments of the given types. |
Generator |
parseGenerator()
Parses the contents of the current input to create a Generator |
Generator |
parseGenerator(java.lang.String str)
Parses the string to create a Generator. |
UnaryFunctor |
parseUnary(java.lang.Class argType)
Parses the current input to create a UnaryFunctor that takes an argument of the given type. |
UnaryFunctor |
parseUnary(java.lang.String str,
java.lang.Class argType)
Parses the string to create a UnaryFunctor that takes an argument of the given type. |
FunctorRef |
PrimaryExpression()
|
FunctorRef |
PrimaryPrefix()
|
FunctorRef |
PrimarySuffix(FunctorRef prefix)
|
void |
ReInit(CharStream stream)
|
void |
ReInit(FunctorParserTokenManager tm)
|
FunctorRef |
RelationalExpression()
|
protected FunctorRef |
reservedFunction(java.lang.String name,
FunctorRef[] args)
Allows for function-style names to be added to the grammar. |
protected FunctorRef |
reservedWord(java.lang.String name)
Allows for (not necessarily constant) values to be added to the grammar |
protected FunctorRef |
resolveMethodName(FunctorRef prefix,
java.lang.String name,
FunctorRef[] args)
Returns a functor ref containing a functor that corresponds to a call to the named method with the given args. |
void |
setUndecoratedDecimal(boolean flag)
Enables/Disables the interpretation of undecorated decimal literals as BigDecimals. |
FunctorRef |
ShiftExpression()
|
FunctorRef |
String()
|
FunctorRef |
UnaryExpression()
|
FunctorRef |
XorExpression()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String[] ARG_NAME
public FunctorParserTokenManager token_source
public Token token
public Token jj_nt
public boolean lookingAhead
| Constructor Detail |
|---|
public FunctorParser()
public FunctorParser(java.io.InputStream is)
public FunctorParser(java.io.Reader in)
public FunctorParser(CharStream stream)
public FunctorParser(FunctorParserTokenManager tm)
| Method Detail |
|---|
public static void main(java.lang.String[] args)
public void importClass(java.lang.Class clasz)
public void importClass(java.lang.String alias,
java.lang.Class clasz)
public void deportClass(java.lang.String alias)
public void importStatics(java.lang.Class clasz)
public void importField(java.lang.Class clasz,
java.lang.String name)
throws java.lang.NoSuchFieldException
java.lang.NoSuchFieldException - if the named field does not exist
java.lang.IllegalArgumentException - if the named field is not static
public void importField(java.lang.reflect.Field field)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the field is not staticpublic java.lang.reflect.Field getImportedField(java.lang.String name)
public void importMethod(java.lang.Class clasz,
java.lang.String name)
throws java.lang.NoSuchMethodException
java.lang.NoSuchMethodException - if the named method does not exist, or if
it/they is/are not staticpublic void importMethod(java.lang.reflect.Method meth)
java.lang.NoSuchMethodException - if the named method does not exist
java.lang.IllegalArgumentException - if the named method is not static
public void importMethod(java.lang.String name,
java.lang.reflect.Method meth)
java.lang.IllegalArgumentException - if the method is not staticpublic java.lang.reflect.Method[] getImportedMethods(java.lang.String name)
protected FunctorRef reservedWord(java.lang.String name)
throws ParseException
ParseException
protected FunctorRef reservedFunction(java.lang.String name,
FunctorRef[] args)
throws ParseException
ParseExceptionpublic void bindThis(java.lang.Object thisBinding)
protected java.lang.Object getBoundObject()
public void setUndecoratedDecimal(boolean flag)
public boolean isUndecoratedDecimal()
public Generator parseGenerator(java.lang.String str)
throws ParseException
ParseException
public Generator parseGenerator()
throws ParseException
ParseException
public UnaryFunctor parseUnary(java.lang.String str,
java.lang.Class argType)
throws ParseException
ParseException
public UnaryFunctor parseUnary(java.lang.Class argType)
throws ParseException
ParseException
public BinaryFunctor parseBinary(java.lang.String str,
java.lang.Class arg1Type,
java.lang.Class arg2Type)
throws ParseException
ParseException
public BinaryFunctor parseBinary(java.lang.Class arg1Type,
java.lang.Class arg2Type)
throws ParseException
ParseExceptionpublic java.lang.Class getReturnType()
java.lang.IllegalStateException - if the parser has not been used or if
parsing the last functor resulted in an exception being thrown.public static FunctorParser getInstance()
public static Generator parse(java.lang.String str)
throws UncheckedParseException
UncheckedParseException
public static UnaryFunctor parse(java.lang.String str,
java.lang.Class argType)
throws UncheckedParseException
UncheckedParseException
public static BinaryFunctor parse(java.lang.String str,
java.lang.Class arg1Type,
java.lang.Class arg2Type)
throws UncheckedParseException
UncheckedParseException
protected FunctorRef resolveMethodName(FunctorRef prefix,
java.lang.String name,
FunctorRef[] args)
throws ParseException
ParseException
public final FunctorRef Functor()
throws ParseException
ParseException
public final FunctorRef Expression()
throws ParseException
ParseException
public final FunctorRef ConditionalExpression()
throws ParseException
ParseException
public final FunctorRef ConditionalOrExpression()
throws ParseException
ParseException
public final FunctorRef ConditionalAndExpression()
throws ParseException
ParseException
public final FunctorRef OrExpression()
throws ParseException
ParseException
public final FunctorRef XorExpression()
throws ParseException
ParseException
public final FunctorRef AndExpression()
throws ParseException
ParseException
public final FunctorRef EqualityExpression()
throws ParseException
ParseException
public final FunctorRef InstanceOfExpression()
throws ParseException
ParseException
public final FunctorRef RelationalExpression()
throws ParseException
ParseException
public final FunctorRef ShiftExpression()
throws ParseException
ParseException
public final FunctorRef AdditiveExpression()
throws ParseException
ParseException
public final FunctorRef MultiplicativeExpression()
throws ParseException
ParseException
public final FunctorRef UnaryExpression()
throws ParseException
ParseException
public final void CastLookahead()
throws ParseException
ParseException
public final FunctorRef CastExpression()
throws ParseException
ParseException
public final FunctorRef PrimaryExpression()
throws ParseException
ParseException
public final FunctorRef PrimaryPrefix()
throws ParseException
ParseException
public final FunctorRef AllocationExpression()
throws ParseException
ParseException
public final FunctorRef ClassOrInterfaceType()
throws ParseException
ParseException
public final FunctorRef PrimarySuffix(FunctorRef prefix)
throws ParseException
ParseException
public final void ImportedMethodLookahead()
throws ParseException
ParseException
public final FunctorRef ImportedStaticMethodCall()
throws ParseException
ParseException
public final FunctorRef Name()
throws ParseException
ParseException
public final FunctorRef[] Arguments()
throws ParseException
ParseException
public final FunctorRef[] ArgumentList(FunctorRef[] args)
throws ParseException
ParseException
public final FunctorRef Literal()
throws ParseException
ParseException
public final FunctorRef Integer()
throws ParseException
ParseException
public final FunctorRef Float()
throws ParseException
ParseException
public final FunctorRef Boolean()
throws ParseException
ParseException
public final FunctorRef Character()
throws ParseException
ParseException
public final FunctorRef String()
throws ParseException
ParseException
public final FunctorRef Null()
throws ParseException
ParseExceptionpublic void ReInit(CharStream stream)
public void ReInit(FunctorParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||