|
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 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PragmaParser
objects are called by Lex
objects to parse pragmas out of pragma-containing comments. They
are also called to see if a comment contains pragmas in the first
place. See Lex
for more details.
Pragmas are described using Token
objects. The
ttype
field of a pragma token must be one of
TagConstants.LEXICALPRAGMA
,
TagConstants.MODIFIERPRAGMA
,
TagConstants.STMTPRAGMA
, or
TagConstants.TYPEDECLELEMPRAGMA
; the
auxVal
field must be filled have a type according to
the table in Token
.
Token
,
Lex
Method Summary | |
boolean |
checkTag(int tag)
Decide whether a comment contains pragmas. |
void |
close()
Stop parsing the current reader. |
boolean |
getNextPragma(Token destination)
Parse the next pragma. |
FieldDecl |
isPragmaDecl(Token l)
|
void |
restart(CorrelatedReader in,
boolean eolComment)
Restart a pragma parser on a new input stream. |
Method Detail |
public boolean checkTag(int tag)
Lex
object passes the first character of
the comment to the checkTag
method of its
PragmaParser
. If this call returns false, the
comment is assumed to contain no pragmas and thus is discarded.
If this call returns true, the comment may contain pragmas, so it
is converted into a CorrelatedReader
and passed to
restart
. (The tag
argument is either a
char
or -1
; -1
indicates
the empty comment.)
public FieldDecl isPragmaDecl(Token l)
public void restart(CorrelatedReader in, boolean eolComment)
this
already opened on another
CorrelatedReader
, closes the old reader.
eolComment
is true to indicate that the
correlated reader stream is reading from a Java comment that
begins with "//" as opposed to a Java comment that begins with
"/*".
public boolean getNextPragma(Token destination)
false
; otherwise, returns true
and
updates fields of destination
to describe the
pragma. When false
is returned, the pragma parser
is expected to close the underlying CorrelatedReader
and in other ways clean up resources.
This method requires that the PragmaParser
is
"open;" that is, restart
has been called and, since
the last call to restart
, getNextPragma
has not returned false and close
has not been
called.
public void close()
Lex
object will be stopped before its associated
PragmaParser
has finished reading all pragmas out of
a comment (for example, when Lex.restart
is called).
In this case, the Lex
object calls
PragmaParser.close
. This method should close the
underlying CorrelatedReader
and in other ways clean
up resources.
|
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 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |