public static int findReservedWordID ( StringBuilder word ) { char c = word . charAt ( 0 ) ; switch ( c ) { case ' ' : if ( matches ( word , "and" ) ) return AND ; if ( matches ( word , "as" ) ) return AS ; break ; case ' ' : if ( matches ( word , "break" ) ) return BREAK ; break ; case ' ' : if ( matches ( word , "call" ) ) return CALL ; if ( matches ( word , "class___" ) ) return CLASS ; if ( matches ( word , "continue" ) ) return CONTINUE ; break ; case ' ' : if ( matches ( word , "define" ) ) return DEFINE ; break ; case ' ' : if ( matches ( word , "else" ) ) return ELSE ; break ; case ' ' : if ( matches ( word , "foreach" ) ) return FOREACH ; if ( matches ( word , "false" ) ) return FALSE ; break ; case ' ' : if ( matches ( word , "if" ) ) return IF ; if ( matches ( word , "import" ) ) return IMPORT ; if ( matches ( word , "in" ) ) return IN ; if ( matches ( word , "isa" ) ) return ISA ; break ; case ' ' : if ( matches ( word , "null" ) ) return NULL ; if ( matches ( word , "not" ) ) return NOT ; break ; case ' ' : if ( matches ( word , "or" ) ) return OR ; break ; case ' ' : if ( matches ( word , "reverse" ) ) return REVERSE ; break ; case ' ' : if ( matches ( word , "true" ) ) return TRUE ; if ( matches ( word , "template" ) ) return TEMPLATE ; break ; } return UNKNOWN ; }
If the given StringBuilder starts with a valid token type its ID is returned . Otherwise the token ID UNKNOWN is returned .