Next: , Previous: , Up: silex syntax   [Index]


53.5.6 Markers

The remaining “expressions” would better be called markers. They all match the empty lexeme but require certain conditions to be respected in the input. They cannot be used in all regular expressions. Suppose that r is a regular expression without markers.

^r
r$

Beginning and end of line. These markers require that the lexeme is found at the beginning or at the end of the line, respectively. The markers lose their special meaning if they are not placed at the beginning or end of the regular expression, or if they are used in the first part of the specification. In those cases, they are treated as regular characters.

<<EOF>>

End of file. This marker is matched only when the input system is at the end of input. The marker must be used alone in its pattern, and only in the second part of the specification. There can be at most one rule with this particular pattern.

<<ERROR>>

Error. This marker is matched only when there is a parsing error. It can be used under the same conditions as <<EOF>>.