"http://www.w3.org/TR/html4/loose.dtd"> >
The lexer produces a list of tokens (see 6.3). The parser save the number of the current token. Each time a token is matched (_eat method), the current token number is incremented. This counter does not appear in the generated code. It is handled by the _eat method.
There is nothing particular about sequences (see 7.6). A sequence of expressions is translated into a sequence of Python statements (see 14.3.3).
Alternatives (see 7.8) are tried in the order of their declaration. The first match will stop the search. When a branch fails (i.e. a call to the _eat method raises a TPGWrongMatch exception) the alternative control structure catches the exception and tries the next branch. On the last branch the exception is not catched in order to be handled by an outer choice point (see 14.3.5).
Repetitions (see 7.9) use the same scheme as alternatives. The TPGWrongMatch exception stops the loop when raised (see 14.3.6).