ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.parser
Class ParseType

java.lang.Object
  extended byjavafe.parser.ParseUtil
      extended byjavafe.parser.ParseType
Direct Known Subclasses:
ParseExpr

public class ParseType
extends ParseUtil

Parses Java types. Extended by ParseExpr.

See Also:
ASTNode, ParseUtil, ParseExpr

Field Summary
private  int[] nameDotLocs
           
private  int[] nameIdLocs
          The following private ivars are used in parseName.
protected  StackVector seqIdentifier
           
 
Fields inherited from class javafe.parser.ParseUtil
modifierKeywords, modifierPragmas, seqModifierPragma
 
Constructor Summary
ParseType()
           
 
Method Summary
 boolean isPrimitiveKeywordTag(int tag)
           
 Type parseBracketPairs(Lex l, Type type)
          Parse square bracket pairs.
 Identifier parseIdentifier(Lex l)
          Parse an Identifier.
 Name parseName(Lex l)
          Parse a Name.
 PrimitiveType parsePrimitiveType(Lex l)
          Parses a PrimitiveType.
 Type parsePrimitiveTypeOrTypeName(Lex l)
          Parse a type, either a primitive type, a type name, but not an array type.
 Type parseType(Lex l)
          Parse a Type, either a primitive type, a type name, or an array type.
 TypeModifierPragmaVec parseTypeModifierPragmas(Lex l)
           
 TypeName parseTypeName(Lex l)
          Parse a TypeName.
 
Methods inherited from class javafe.parser.ParseUtil
arrayToString, error, expect, fail, getJavaModifier, isJavaModifier, operatorTokenToTag, parseModifierPragmas, parseModifiers, parseMoreModifierPragmas
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seqIdentifier

protected final StackVector seqIdentifier

nameIdLocs

private int[] nameIdLocs
The following private ivars are used in parseName. They cannot be defined inside parseName because they would be reallocated at each invocation. They cannot be defined as static variables inside parseName because then the code would not be thread-safe.


nameDotLocs

private int[] nameDotLocs
Constructor Detail

ParseType

public ParseType()
Method Detail

parseIdentifier

public Identifier parseIdentifier(Lex l)
Parse an Identifier.


parseName

public Name parseName(Lex l)
Parse a Name.
 Name:
 Identifier ( . Identifier ) *
 


parseTypeName

public TypeName parseTypeName(Lex l)
Parse a TypeName.
 TypeName:
 Name [TypeModifierPragmas]
 


parseBracketPairs

public Type parseBracketPairs(Lex l,
                              Type type)
Parse square bracket pairs. Wraps argument type in ArrayType objects accordingly.
 BracketPairs:
 (LSQBRACKET RSQBRACKET)*
 

Warning: when this method sees "{'[' ']'}* {'[' not-']'}", it returns with "l" pointing to the '[' just before the not-']'.


parseTypeModifierPragmas

public TypeModifierPragmaVec parseTypeModifierPragmas(Lex l)

isPrimitiveKeywordTag

public boolean isPrimitiveKeywordTag(int tag)
Returns:
is a tag a PrimitiveType keyword?

parsePrimitiveType

public PrimitiveType parsePrimitiveType(Lex l)
Parses a PrimitiveType. Returns null on failure.
   
 PrimitiveType: one of
 boolean byte short int long char float double void
 


parsePrimitiveTypeOrTypeName

public Type parsePrimitiveTypeOrTypeName(Lex l)
Parse a type, either a primitive type, a type name, but not an array type.
 PrimitiveTypeOrTypeName:
 PrimitiveType
 TypeName
 


parseType

public Type parseType(Lex l)
Parse a Type, either a primitive type, a type name, or an array type.
 Type:
 PrimitiveTypeOrTypeName BracketPairs
 


ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage