/** * Returns the type for the specified symbol/keyword text. Returns UNKNOWN * if the text isn't found. You can filter finds on a type. */ public static int lookup( String text, int filter ) { int type = UNKNOWN; if( LOOKUP.containsKey(text) ) { type = LOOKUP.get(text); if( filter != UNKNOWN && !ofType(type, filter) ) { type = UNKNOWN; } } return type; }
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Returns a description of the node. */ public String getDescription() { return Types.getDescription( getMeaning() ); }
/** * Returns the type for the specified symbol text. Returns UNKNOWN * if the text isn't found. */ public static int lookupSymbol( String text ) { return lookup( text, SYMBOL ); }
/** * Creates a token that represents a symbol, using a library for the type. */ public static Token newSymbol( String type, int startLine, int startColumn ) { return new Token( Types.lookupSymbol(type), type, startLine, startColumn ); }
/** * Creates a token that represents a symbol, using a library for the text. */ public static Token newSymbol( int type, int startLine, int startColumn ) { return new Token( type, Types.getText(type), startLine, startColumn ); }
/** * Creates a token that represents a keyword. Returns null if the * specified text isn't a keyword. */ public static Token newKeyword( String text, int startLine, int startColumn ) { int type = Types.lookupKeyword( text ); if( type != Types.UNKNOWN ) { return new Token( type, text, startLine, startColumn ); } return null; }
/** * Adds a description to the set. */ private static void addDescription(int type, String description) { addDescription(Integer.valueOf(type), description); }
/** * Returns the type for the specified keyword text. Returns UNKNOWN * if the text isn't found. */ public static int lookupKeyword( String text ) { return lookup( text, KEYWORD ); }
/** * Creates a token that represents a symbol, using a library for the type. */ public static Token newSymbol( String type, int startLine, int startColumn ) { return new Token( Types.lookupSymbol(type), type, startLine, startColumn ); }
/** * Creates a token that represents a symbol, using a library for the text. */ public static Token newSymbol( int type, int startLine, int startColumn ) { return new Token( type, Types.getText(type), startLine, startColumn ); }
/** * Creates a token that represents a keyword. Returns null if the * specified text isn't a keyword. */ public static Token newKeyword( String text, int startLine, int startColumn ) { int type = Types.lookupKeyword( text ); if( type != Types.UNKNOWN ) { return new Token( type, text, startLine, startColumn ); } return null; }
/** * Adds a description to the set. */ private static void addDescription(int type, String description) { addDescription(new Integer(type), description); }
/** * Returns true if the node's meaning matches the specified type. */ public boolean isA( int type ) { return Types.ofType( getMeaning(), type ); }
/** * Returns the type for the specified keyword text. Returns UNKNOWN * if the text isn't found. */ public static int lookupKeyword( String text ) { return lookup( text, KEYWORD ); }
writer.print( Types.getDescription(type) ); writer.print( Types.getDescription(meaning) );
/** * Returns true if the node can be coerced to the specified type. */ public boolean canMean( int type ) { return Types.canMean( getMeaning(), type ); }
/** * Creates a token that represents a symbol, using a library for the type. */ public static Token newSymbol( String type, int startLine, int startColumn ) { return new Token( Types.lookupSymbol(type), type, startLine, startColumn ); }
/** * Creates a token that represents a symbol, using a library for the text. */ public static Token newSymbol( int type, int startLine, int startColumn ) { return new Token( type, Types.getText(type), startLine, startColumn ); }
/** * Creates a token that represents a keyword. Returns null if the * specified text isn't a keyword. */ public static Token newKeyword( String text, int startLine, int startColumn ) { int type = Types.lookupKeyword( text ); if( type != Types.UNKNOWN ) { return new Token( type, text, startLine, startColumn ); } return null; }