All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----epp.Lex
Lex.java file defines methods of the EPP preprocessor
that are used for lexical analyzation of the Java language.
Note: This class is provided for the sake of creating javadocs. It does not exist in the actual EPP source code.
The parser calls the lexical analyzer indirectly using the methods
match and matchAny.
When a new token is required by a call to methods match
or matchAny, the readToken method is called.
This method other methods if required, and cutouts a token from
EppInputStream and returns that token.
Plug-ins may extend this method to modify the behaviour of the
lexical analyzer.
For example, in standard Java, the string "**" will be analyzed as two :"*"
Symbols. If you want to extend this so that the string will be
analyzed as a single :"**" Symbol, you would write as follows.
SystemMixin NewOp {
class Epp {
extend Token readOperator(EppInputStream in){
if (in.peekc() == '*') {
int p = in.pointer();
in.getc();
if (in.getc() == '*') {
return :"**";
}
in.backtrack(p);
return original(in);
} else {
return original(in);
}
}
}
}
readOperator when the first character of
the token is a single quote and returns a string literal.
readOperator when the first character of
the token is a double quote and returns a string literal.
in.
public Lex()
public Token readTokenStart(EppInputStream in)
in.
Assumes that space characters are already skipped.
Peeks at the first character and calls readId,
readNumber, readOperator depending on
whether the the value is an alphabet, number, or symbol.
This method is call from readToken.
public Token readId(EppInputStream in)
public Token readNumber(EppInputStream in)
readTokenStart when the first character
of the token is a number.
However, in such case where the token is ".1", readTokenStart
calls readOperator, and then this method is called.
public Token readOperator(EppInputStream in)
readTraditional if required.
public Token readStringLiteral(EppInputStream in)
readOperator when the first character of
the token is a double quote and returns a string literal.
public Token readCharLiteral(EppInputStream in)
readOperator when the first character of
the token is a single quote and returns a string literal.
public void readEscapedChar(EppInputStream in,
StringBuffer buf,
char c)
readStringLiteral and readCharLiteral.
public Token readTraditionalComment(EppInputStream in)
public Token readEndOfLineComment(EppInputStream in)
public Token readSharp(EppInputStream in)
readTokenAtNextLine
method.
(In order to skip the #epp command.)
public Token readTokenAtNextLine(EppInputStream in)
readEndOfLineComment and
readSharp.
All Packages Class Hierarchy This Package Previous Next Index