self
, which refers
to the lexer class (eg. pyggy.lexer.lexer
). When the code is called,
the self.value
variable contains a string of the characters that
were matched by the pattern. The action code may alter this variable
as it sees fit.
If the action code returns None
, lexing is continued, otherwise the
returned token is returned from the lexer to its caller.
The action code may make use of several methods in the lexer class:
Method | Description |
---|---|
PUSHSTATE(statenum) |
When lexing continues, start in the specified start state. |
POPSTATE() |
When lexing continues, start in the previous start state. |
PUSHBACK(str) |
take the characters in str and
push them back on the input stream so that they may be
matched against when lexing continues. |
ENQUEUE(tok, val) |
push a token onto the lexer queue.
The next time a token is retrieved, it will be retrieved from
the lexer queue prior to matching patterns from the input
stream. The lexer's value variable will be set from
val when tok is returned. |
See the PyGgy Home Page.