net.sf.jga.parser
Class JFXGParser

java.lang.Object
  extended by net.sf.jga.parser.JFXGParser
All Implemented Interfaces:
FunctorParser, JFXGParserConstants
Direct Known Subclasses:
ScriptParser

public class JFXGParser
extends java.lang.Object
implements FunctorParser, JFXGParserConstants

Parser that converts JFXG strings into functors. The parser is not safe to be used concurrently by multiple threads.

Copyright © 2004-2005 David A. Hall


Field Summary
static java.lang.String[] ARG_NAME
           
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 JFXGParserTokenManager token_source
           
 
Fields inherited from interface net.sf.jga.parser.JFXGParserConstants
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
JFXGParser()
           
JFXGParser(java.io.InputStream stream)
           
JFXGParser(java.io.InputStream stream, java.lang.String encoding)
           
JFXGParser(JFXGParserTokenManager tm)
           
JFXGParser(java.io.Reader stream)
           
 
Method Summary
 FunctorRef AdditiveExpression(net.sf.jga.parser.ParserContext context)
           
 void addPromotionRule(java.lang.Class<?> fromType, java.lang.Class<?> toType, UnaryFunctor converter)
          Registers a type-coercion rule that will promote values of the from type to values of the to type for use in expressions.
 FunctorRef AllocationExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef AndExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef[] ArgumentList(net.sf.jga.parser.ParserContext context, FunctorRef[] args)
           
 FunctorRef[] Arguments(net.sf.jga.parser.ParserContext context)
           
 FunctorRef AssignmentExpression(net.sf.jga.parser.ParserContext context)
           
 net.sf.jga.parser.AssignmentOperator AssignmentOperator()
           
 void bindThis(java.lang.Object thisBinding)
          Binds the object to which 'this' refers
 FunctorRef Boolean()
           
protected
<R> FunctorRef
boxUnboxFunctor(java.lang.Class<R> reqType, FunctorRef<?,?> ref)
          When the class that we need is the boxed (or unboxed) form of the return type of the given functor, then wrap the functor in a boxing/unboxing functor to make the change at runtime.
 FunctorRef CastExpression(net.sf.jga.parser.ParserContext context)
           
 void CastLookahead(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Character()
           
 FunctorRef CompoundExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef ConditionalAndExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef ConditionalExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef ConditionalOrExpression(net.sf.jga.parser.ParserContext context)
           
protected  FunctorRef demote(FunctorRef ref, java.lang.Class type)
           
protected
<R> FunctorRef<R,Functor<R>>
demoteExt(FunctorRef<?,Functor<?>> ref, java.lang.Class<R> type)
          Return a functor that performs promotion on the functor (if necessary and possible) to the given type.
 void deportClass(java.lang.String alias)
          Removes information about the class imported under the given name.
 void deportPackage(java.lang.String pkgName)
          Removes information about the given package.
 void disable_tracing()
           
 void enable_tracing()
           
 FunctorRef EqualityExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Expression(net.sf.jga.parser.ParserContext context)
           
protected  java.lang.Class<?> findCommonPromotion(java.lang.Class<?> root, java.lang.Class<?> ltype, java.lang.Class<?> rtype)
          Find and return a class to which both arguments of a binary operation may be promoted, if any.
 FunctorRef Float(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Functor(net.sf.jga.parser.ParserContext context)
           
 ParseException generateParseException()
           
protected  java.lang.Object getBoundObject()
          Returns the current object to which 'this' refers
static UnaryFunctor<?,?> getBoxFunctor(java.lang.Class<?> primitive)
          Returns a Functor that 'boxes' the given primitive type, or null if the given type is not a primitive.
 java.lang.Class<?> getImportedClass(java.lang.String alias)
          Returns the Class object that represents the given name.
 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 JFXGParser getInstance()
          Returns a globally accessible default instance of a JFXGParser.
 Token getNextToken()
           
protected  java.lang.Class<?> getReferencedClass(FunctorRef ref)
          returns the specific class to which the given class refers.
 java.lang.Class<?> getReturnType()
          Returns the type of object returned by the last functor parsed.
 Token getToken(int index)
           
static UnaryFunctor<?,?> getUnboxFunctor(java.lang.Class<?> reference)
          Returns a Functor that 'unboxes' the given reference type, or null if the given type is not a reference to a primitive
 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(net.sf.jga.parser.ParserContext context)
           
 FunctorRef ImportedStaticMethodCall(net.sf.jga.parser.ParserContext context)
           
 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 importJGA()
          Imports the static methods of the jga algorithm and functor builder classes.
 void importJGA(java.lang.String className)
          Imports the static methods of the specified jga class.
 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 importPackage(java.lang.String pkgName)
          Imports the given package (by name) into the parser.
 void importStatics(java.lang.Class<?> clasz)
          Imports all of the static public methods and members in the given class.
 FunctorRef InstanceOfExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Integer()
           
 boolean isClassImported(java.lang.Class<?> clasz)
          Returns true if the class is imported into the default parser context.
protected  boolean isClassReference(FunctorRef ref)
          returns true if the functor reference is one that returns a specific class object.
 boolean isUndecoratedDecimal()
          When true, an undecorated number containing a decimal, for example 1.50 is interpreted as a BigDecimal literal.
 FunctorRef Literal(net.sf.jga.parser.ParserContext context)
           
 FunctorRef LocalVariableDeclaration(net.sf.jga.parser.ParserContext context)
           
static void main(java.lang.String[] args)
           
 FunctorRef MultiplicativeExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Name(net.sf.jga.parser.ParserContext context)
           
 FunctorRef Null()
           
 FunctorRef OrExpression(net.sf.jga.parser.ParserContext context)
           
static Generator<?> parse(java.lang.String str)
          Parses the string to create a Generator.
static
<T> UnaryFunctor<T,?>
parse(java.lang.String str, java.lang.Class<T> argType)
          Parses the string to create a UnaryFunctor that takes an argument of the given type.
static
<T1,T2> BinaryFunctor<T1,T2,?>
parse(java.lang.String str, java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type)
          Parses the string to create a BinaryFunctor that takes arguments of the given types.
<T1,T2> BinaryFunctor<T1,T2,?>
parseBinary(java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type)
          Parses the current input to create a BinaryFunctor that takes arguments of the given types.
<T1,T2> BinaryFunctor<T1,T2,?>
parseBinary(java.lang.String str, java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type)
          Parses the string to create a BinaryFunctor that takes arguments of the given types.
protected
<T1,T2> BinaryFunctorRef<T1,T2,?>
parseBinaryRef(java.lang.Class<T1> arg1Type, java.lang.Class<T2> arg2Type)
          Parses the current input to create a BinaryFunctor that takes arguments of the given types.
protected  FunctorRef<?,?> parseFunctor(net.sf.jga.parser.ParserContext context)
          Parses a functor from the input stream, ensuring that it returns an Object (ie, if the expression would generally return a primitive, the functor will be bound within a boxing functor).
 Functor<?> parseFunctor(java.lang.String str)
          Parses the string to create a Generator.
 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.
protected  GeneratorRef<?> parseGeneratorRef()
          Parses the contents of the current input to create a Generator
<T> UnaryFunctor<T,?>
parseUnary(java.lang.Class<T> argType)
          Parses the current input to create a UnaryFunctor that takes an argument of the given type.
<T> UnaryFunctor<T,?>
parseUnary(java.lang.String str, java.lang.Class<T> argType)
          Parses the string to create a UnaryFunctor that takes an argument of the given type.
protected
<T> UnaryFunctorRef<T,?>
parseUnaryRef(java.lang.Class<T> argType)
          Parses the current input to create a UnaryFunctor that takes an argument of the given type.
 FunctorRef PositionalArgument(net.sf.jga.parser.ParserContext context)
           
 FunctorRef PrimaryExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef PrimaryPrefix(net.sf.jga.parser.ParserContext context)
           
 FunctorRef PrimarySuffix(net.sf.jga.parser.ParserContext context, FunctorRef prefix)
           
protected  FunctorRef promote(FunctorRef ref, java.lang.Class type)
          Return a functor that performs promotion on the functor (if necessary and possible) to the given type.
protected
<R> FunctorRef<R,Functor<R>>
promoteExt(FunctorRef<?,Functor<?>> ref, java.lang.Class<R> type)
          Return a functor that performs promotion on the functor (if necessary and possible) to the given type.
 void ReInit(java.io.InputStream stream)
           
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
           
 void ReInit(JFXGParserTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
 FunctorRef RelationalExpression(net.sf.jga.parser.ParserContext context)
           
 void removePromotionRule(java.lang.Class<?> fromType, java.lang.Class<?> toType)
          Removes the type-coercion rule (if any) that would have promoted values of the from type to values of the to type for use in expressions.
protected  FunctorRef<?,?> reservedField(FunctorRef<?,?> prefix, java.lang.String name)
          Allows for (not necessarily constant) predefined fields to be added to the grammar
protected  FunctorRef<?,?> reservedFunction(java.lang.String name, FunctorRef<?,?>[] args)
          Allows for function-style names to be added to the grammar.
protected  BinaryFunctorRef<?,?,?> reservedMethod(FunctorRef<?,?> prefix, java.lang.String name, java.lang.Class<?>[] types)
          Allows for alternate strategies for resolving methods
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(net.sf.jga.parser.ParserContext context)
           
 FunctorRef String()
           
 FunctorRef Type(net.sf.jga.parser.ParserContext context)
           
 FunctorRef UnaryExpression(net.sf.jga.parser.ParserContext context)
           
 FunctorRef VariableDeclarator(net.sf.jga.parser.ParserContext context, java.lang.Class<?> type)
           
 VariableRef<?> VariableDeclaratorId(net.sf.jga.parser.ParserContext context, java.lang.Class<?> type)
           
 FunctorRef VariableInitializer(net.sf.jga.parser.ParserContext context, java.lang.Class<?> type)
           
 FunctorRef XorExpression(net.sf.jga.parser.ParserContext context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARG_NAME

public static final java.lang.String[] ARG_NAME

token_source

public JFXGParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

JFXGParser

public JFXGParser()

JFXGParser

public JFXGParser(java.io.InputStream stream)

JFXGParser

public JFXGParser(java.io.InputStream stream,
                  java.lang.String encoding)

JFXGParser

public JFXGParser(java.io.Reader stream)

JFXGParser

public JFXGParser(JFXGParserTokenManager tm)
Method Detail

main

public static void main(java.lang.String[] args)

importPackage

public void importPackage(java.lang.String pkgName)
Imports the given package (by name) into the parser.


deportPackage

public void deportPackage(java.lang.String pkgName)
Removes information about the given package.


importClass

public void importClass(java.lang.Class<?> clasz)
Imports the given class into the parser. The class will not need to be fully qualified for use in expressions. This will replace any existing imported class that happens to have the same name.


importClass

public void importClass(java.lang.String alias,
                        java.lang.Class<?> clasz)
Imports the given class into the parser under the given alias. The alias may be used in place of the fully qualified name of the class hereafter. This will replace any existing imported class associated with the alias.


deportClass

public void deportClass(java.lang.String alias)
Removes information about the class imported under the given name.


getImportedClass

public java.lang.Class<?> getImportedClass(java.lang.String alias)
Returns the Class object that represents the given name.


isClassImported

public boolean isClassImported(java.lang.Class<?> clasz)
Returns true if the class is imported into the default parser context.


importStatics

public void importStatics(java.lang.Class<?> clasz)
Imports all of the static public methods and members in the given class.


importField

public void importField(java.lang.Class<?> clasz,
                        java.lang.String name)
                 throws java.lang.NoSuchFieldException
Imports the given static member. The member will not need to be qualified with its classname for use in expressions.

Throws:
java.lang.NoSuchFieldException - if the named field does not exist
java.lang.IllegalArgumentException - if the named field is not static

importField

public void importField(java.lang.reflect.Field field)
                 throws java.lang.IllegalArgumentException
Imports the given static member. The member will not need to be qualified with its classname for use in expressions.

Throws:
java.lang.IllegalArgumentException - if the field is not static

getImportedField

public 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.


importMethod

public void importMethod(java.lang.Class<?> clasz,
                         java.lang.String name)
                  throws java.lang.NoSuchMethodException
Imports the given static method(s).

Throws:
java.lang.NoSuchMethodException - if the named method does not exist, or if it/they is/are not static

importMethod

public void importMethod(java.lang.reflect.Method meth)
Imports a static method into the parser. The method will not need to be qualified with its classname for use in expressions. Multiple methods may be imported with the same name: the first best fit will be used when the method name is used.

Throws:
java.lang.NoSuchMethodException - if the named method does not exist
java.lang.IllegalArgumentException - if the named method is not static

importMethod

public void importMethod(java.lang.String name,
                         java.lang.reflect.Method meth)
Imports a static method into the parser under the given name. The method will not need to be qualified with its classname for use in expressions. Multiple methods may be imported with the same name: the first best fit will be used when the method name is used.

Throws:
java.lang.IllegalArgumentException - if the method is not static

getImportedMethods

public java.lang.reflect.Method[] getImportedMethods(java.lang.String name)
Returns a list of methods with the given name


importJGA

public void importJGA()
Imports the static methods of the jga algorithm and functor builder classes. The following classes are statically imported, as if specified via a wildcard static import statement:


importJGA

public void importJGA(java.lang.String className)
Imports the static methods of the specified jga class. It isn't necessary to fully qualify the classname (although it works fine if you do).


bindThis

public void bindThis(java.lang.Object thisBinding)
Binds the object to which 'this' refers


getBoundObject

protected java.lang.Object getBoundObject()
Returns the current object to which 'this' refers


setUndecoratedDecimal

public void setUndecoratedDecimal(boolean flag)
Enables/Disables the interpretation of undecorated decimal literals as BigDecimals. When true, an undecorated number containing a decimal, for example 1.50 is interpreted as a BigDecimal literal. When false, the same token is interpreted as a Double, as is the case in standard java


isUndecoratedDecimal

public boolean isUndecoratedDecimal()
When true, an undecorated number containing a decimal, for example 1.50 is interpreted as a BigDecimal literal. When false, the same token is interpreted as a Double, as is the case in standard java


addPromotionRule

public void addPromotionRule(java.lang.Class<?> fromType,
                             java.lang.Class<?> toType,
                             UnaryFunctor converter)
Registers a type-coercion rule that will promote values of the from type to values of the to type for use in expressions.


removePromotionRule

public void removePromotionRule(java.lang.Class<?> fromType,
                                java.lang.Class<?> toType)
Removes the type-coercion rule (if any) that would have promoted values of the from type to values of the to type for use in expressions.


parseFunctor

public Functor<?> parseFunctor(java.lang.String str)
                        throws ParseException
Parses the string to create a Generator.

Throws:
ParseException

parseGenerator

public Generator<?> parseGenerator(java.lang.String str)
                            throws ParseException
Parses the string to create a Generator.

Specified by:
parseGenerator in interface FunctorParser
Throws:
ParseException

parseGenerator

public Generator<?> parseGenerator()
                            throws ParseException
Parses the contents of the current input to create a Generator

Throws:
ParseException

parseGeneratorRef

protected GeneratorRef<?> parseGeneratorRef()
                                     throws ParseException
Parses the contents of the current input to create a Generator

Throws:
ParseException

parseUnary

public <T> UnaryFunctor<T,?> parseUnary(java.lang.String str,
                                        java.lang.Class<T> argType)
                             throws ParseException
Parses the string to create a UnaryFunctor that takes an argument of the given type.

Specified by:
parseUnary in interface FunctorParser
Throws:
ParseException

parseUnary

public <T> UnaryFunctor<T,?> parseUnary(java.lang.Class<T> argType)
                             throws ParseException
Parses the current input to create a UnaryFunctor that takes an argument of the given type.

Throws:
ParseException

parseUnaryRef

protected <T> UnaryFunctorRef<T,?> parseUnaryRef(java.lang.Class<T> argType)
                                      throws ParseException
Parses the current input to create a UnaryFunctor that takes an argument of the given type.

Throws:
ParseException

parseBinary

public <T1,T2> BinaryFunctor<T1,T2,?> parseBinary(java.lang.String str,
                                                  java.lang.Class<T1> arg1Type,
                                                  java.lang.Class<T2> arg2Type)
                                   throws ParseException
Parses the string to create a BinaryFunctor that takes arguments of the given types.

Specified by:
parseBinary in interface FunctorParser
Throws:
ParseException

parseBinary

public <T1,T2> BinaryFunctor<T1,T2,?> parseBinary(java.lang.Class<T1> arg1Type,
                                                  java.lang.Class<T2> arg2Type)
                                   throws ParseException
Parses the current input to create a BinaryFunctor that takes arguments of the given types.

Throws:
ParseException

parseBinaryRef

protected <T1,T2> BinaryFunctorRef<T1,T2,?> parseBinaryRef(java.lang.Class<T1> arg1Type,
                                                           java.lang.Class<T2> arg2Type)
                                            throws ParseException
Parses the current input to create a BinaryFunctor that takes arguments of the given types.

Throws:
ParseException

parseFunctor

protected FunctorRef<?,?> parseFunctor(net.sf.jga.parser.ParserContext context)
                                throws ParseException
Parses a functor from the input stream, ensuring that it returns an Object (ie, if the expression would generally return a primitive, the functor will be bound within a boxing functor).

Throws:
ParseException

getReturnType

public java.lang.Class<?> getReturnType()
Returns the type of object returned by the last functor parsed.

Specified by:
getReturnType in interface FunctorParser
Throws:
java.lang.IllegalStateException - if the parser has not been used or if parsing the last functor resulted in an exception being thrown.

getInstance

public static JFXGParser getInstance()
Returns a globally accessible default instance of a JFXGParser. Settings of this instance cannot be changed from their defaults: attempts to change any of the default settings of configurable values will be silently ignored.


parse

public static Generator<?> parse(java.lang.String str)
                          throws UncheckedParseException
Parses the string to create a Generator.

Throws:
UncheckedParseException

parse

public static <T> UnaryFunctor<T,?> parse(java.lang.String str,
                                          java.lang.Class<T> argType)
                               throws UncheckedParseException
Parses the string to create a UnaryFunctor that takes an argument of the given type.

Throws:
UncheckedParseException

parse

public static <T1,T2> BinaryFunctor<T1,T2,?> parse(java.lang.String str,
                                                   java.lang.Class<T1> arg1Type,
                                                   java.lang.Class<T2> arg2Type)
                                    throws UncheckedParseException
Parses the string to create a BinaryFunctor that takes arguments of the given types.

Throws:
UncheckedParseException

reservedWord

protected FunctorRef<?,?> reservedWord(java.lang.String name)
                                throws ParseException
Allows for (not necessarily constant) values to be added to the grammar

Throws:
ParseException

reservedField

protected FunctorRef<?,?> reservedField(FunctorRef<?,?> prefix,
                                        java.lang.String name)
                                 throws ParseException
Allows for (not necessarily constant) predefined fields to be added to the grammar

Throws:
ParseException

reservedFunction

protected FunctorRef<?,?> reservedFunction(java.lang.String name,
                                           FunctorRef<?,?>[] args)
                                    throws ParseException
Allows for function-style names to be added to the grammar.

Throws:
ParseException

reservedMethod

protected BinaryFunctorRef<?,?,?> reservedMethod(FunctorRef<?,?> prefix,
                                                 java.lang.String name,
                                                 java.lang.Class<?>[] types)
                                          throws ParseException
Allows for alternate strategies for resolving methods

Throws:
ParseException

promote

protected FunctorRef promote(FunctorRef ref,
                             java.lang.Class type)
                      throws ParseException
Return a functor that performs promotion on the functor (if necessary and possible) to the given type. If the functor is already of the same type, it is returned. If the conversion is not possible, returns null.

Throws:
ParseException

promoteExt

protected <R> FunctorRef<R,Functor<R>> promoteExt(FunctorRef<?,Functor<?>> ref,
                                                  java.lang.Class<R> type)
Return a functor that performs promotion on the functor (if necessary and possible) to the given type. If the conversion is not possible, returns null.


demote

protected FunctorRef demote(FunctorRef ref,
                            java.lang.Class type)
                     throws ParseException
Throws:
ParseException

demoteExt

protected <R> FunctorRef<R,Functor<R>> demoteExt(FunctorRef<?,Functor<?>> ref,
                                                 java.lang.Class<R> type)
Return a functor that performs promotion on the functor (if necessary and possible) to the given type. If the conversion is not possible, returns null.


findCommonPromotion

protected java.lang.Class<?> findCommonPromotion(java.lang.Class<?> root,
                                                 java.lang.Class<?> ltype,
                                                 java.lang.Class<?> rtype)
Find and return a class to which both arguments of a binary operation may be promoted, if any. If no such class exists, return null.


getBoxFunctor

public static UnaryFunctor<?,?> getBoxFunctor(java.lang.Class<?> primitive)
Returns a Functor that 'boxes' the given primitive type, or null if the given type is not a primitive.


getUnboxFunctor

public static UnaryFunctor<?,?> getUnboxFunctor(java.lang.Class<?> reference)
Returns a Functor that 'unboxes' the given reference type, or null if the given type is not a reference to a primitive


boxUnboxFunctor

protected <R> FunctorRef boxUnboxFunctor(java.lang.Class<R> reqType,
                                         FunctorRef<?,?> ref)
                              throws ParseException
When the class that we need is the boxed (or unboxed) form of the return type of the given functor, then wrap the functor in a boxing/unboxing functor to make the change at runtime. If the class that we need is not the class that were given nor is it a boxed/unboxed form, return null;

Throws:
ParseException

resolveMethodName

protected FunctorRef<?,?> resolveMethodName(FunctorRef<?,?> prefix,
                                            java.lang.String name,
                                            FunctorRef<?,?>[] args)
                                     throws ParseException
Returns a functor ref containing a functor that corresponds to a call to the named method with the given args.

Throws:
ParseException

isClassReference

protected boolean isClassReference(FunctorRef ref)
returns true if the functor reference is one that returns a specific class object.


getReferencedClass

protected java.lang.Class<?> getReferencedClass(FunctorRef ref)
returns the specific class to which the given class refers. Assumes isClassReference(ref), will throw ClassCastException if not


Functor

public final FunctorRef Functor(net.sf.jga.parser.ParserContext context)
                         throws ParseException
Throws:
ParseException

CompoundExpression

public final FunctorRef CompoundExpression(net.sf.jga.parser.ParserContext context)
                                    throws ParseException
Throws:
ParseException

Expression

public final FunctorRef Expression(net.sf.jga.parser.ParserContext context)
                            throws ParseException
Throws:
ParseException

LocalVariableDeclaration

public final FunctorRef LocalVariableDeclaration(net.sf.jga.parser.ParserContext context)
                                          throws ParseException
Throws:
ParseException

VariableDeclarator

public final FunctorRef VariableDeclarator(net.sf.jga.parser.ParserContext context,
                                           java.lang.Class<?> type)
                                    throws ParseException
Throws:
ParseException

VariableDeclaratorId

public final VariableRef<?> VariableDeclaratorId(net.sf.jga.parser.ParserContext context,
                                                 java.lang.Class<?> type)
                                          throws ParseException
Throws:
ParseException

VariableInitializer

public final FunctorRef VariableInitializer(net.sf.jga.parser.ParserContext context,
                                            java.lang.Class<?> type)
                                     throws ParseException
Throws:
ParseException

AssignmentExpression

public final FunctorRef AssignmentExpression(net.sf.jga.parser.ParserContext context)
                                      throws ParseException
Throws:
ParseException

AssignmentOperator

public final net.sf.jga.parser.AssignmentOperator AssignmentOperator()
                                                              throws ParseException
Throws:
ParseException

ConditionalExpression

public final FunctorRef ConditionalExpression(net.sf.jga.parser.ParserContext context)
                                       throws ParseException
Throws:
ParseException

ConditionalOrExpression

public final FunctorRef ConditionalOrExpression(net.sf.jga.parser.ParserContext context)
                                         throws ParseException
Throws:
ParseException

ConditionalAndExpression

public final FunctorRef ConditionalAndExpression(net.sf.jga.parser.ParserContext context)
                                          throws ParseException
Throws:
ParseException

OrExpression

public final FunctorRef OrExpression(net.sf.jga.parser.ParserContext context)
                              throws ParseException
Throws:
ParseException

XorExpression

public final FunctorRef XorExpression(net.sf.jga.parser.ParserContext context)
                               throws ParseException
Throws:
ParseException

AndExpression

public final FunctorRef AndExpression(net.sf.jga.parser.ParserContext context)
                               throws ParseException
Throws:
ParseException

EqualityExpression

public final FunctorRef EqualityExpression(net.sf.jga.parser.ParserContext context)
                                    throws ParseException
Throws:
ParseException

InstanceOfExpression

public final FunctorRef InstanceOfExpression(net.sf.jga.parser.ParserContext context)
                                      throws ParseException
Throws:
ParseException

RelationalExpression

public final FunctorRef RelationalExpression(net.sf.jga.parser.ParserContext context)
                                      throws ParseException
Throws:
ParseException

ShiftExpression

public final FunctorRef ShiftExpression(net.sf.jga.parser.ParserContext context)
                                 throws ParseException
Throws:
ParseException

AdditiveExpression

public final FunctorRef AdditiveExpression(net.sf.jga.parser.ParserContext context)
                                    throws ParseException
Throws:
ParseException

MultiplicativeExpression

public final FunctorRef MultiplicativeExpression(net.sf.jga.parser.ParserContext context)
                                          throws ParseException
Throws:
ParseException

UnaryExpression

public final FunctorRef UnaryExpression(net.sf.jga.parser.ParserContext context)
                                 throws ParseException
Throws:
ParseException

CastLookahead

public final void CastLookahead(net.sf.jga.parser.ParserContext context)
                         throws ParseException
Throws:
ParseException

CastExpression

public final FunctorRef CastExpression(net.sf.jga.parser.ParserContext context)
                                throws ParseException
Throws:
ParseException

PrimaryExpression

public final FunctorRef PrimaryExpression(net.sf.jga.parser.ParserContext context)
                                   throws ParseException
Throws:
ParseException

PrimaryPrefix

public final FunctorRef PrimaryPrefix(net.sf.jga.parser.ParserContext context)
                               throws ParseException
Throws:
ParseException

AllocationExpression

public final FunctorRef AllocationExpression(net.sf.jga.parser.ParserContext context)
                                      throws ParseException
Throws:
ParseException

Type

public final FunctorRef Type(net.sf.jga.parser.ParserContext context)
                      throws ParseException
Throws:
ParseException

PrimarySuffix

public final FunctorRef PrimarySuffix(net.sf.jga.parser.ParserContext context,
                                      FunctorRef prefix)
                               throws ParseException
Throws:
ParseException

ImportedMethodLookahead

public final void ImportedMethodLookahead(net.sf.jga.parser.ParserContext context)
                                   throws ParseException
Throws:
ParseException

ImportedStaticMethodCall

public final FunctorRef ImportedStaticMethodCall(net.sf.jga.parser.ParserContext context)
                                          throws ParseException
Throws:
ParseException

PositionalArgument

public final FunctorRef PositionalArgument(net.sf.jga.parser.ParserContext context)
                                    throws ParseException
Throws:
ParseException

Name

public final FunctorRef Name(net.sf.jga.parser.ParserContext context)
                      throws ParseException
Throws:
ParseException

Arguments

public final FunctorRef[] Arguments(net.sf.jga.parser.ParserContext context)
                             throws ParseException
Throws:
ParseException

ArgumentList

public final FunctorRef[] ArgumentList(net.sf.jga.parser.ParserContext context,
                                       FunctorRef[] args)
                                throws ParseException
Throws:
ParseException

Literal

public final FunctorRef Literal(net.sf.jga.parser.ParserContext context)
                         throws ParseException
Throws:
ParseException

Integer

public final FunctorRef Integer()
                         throws ParseException
Throws:
ParseException

Float

public final FunctorRef Float(net.sf.jga.parser.ParserContext context)
                       throws ParseException
Throws:
ParseException

Boolean

public final FunctorRef Boolean()
                         throws ParseException
Throws:
ParseException

Character

public final FunctorRef Character()
                           throws ParseException
Throws:
ParseException

String

public final FunctorRef String()
                        throws ParseException
Throws:
ParseException

Null

public final FunctorRef Null()
                      throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(JFXGParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()


Copyright © 2002-2006 David A. Hall. All Rights Reserved.