RTF::Lexer - Rich Text Format lexical analyzer. |
RTF::Lexer - Rich Text Format (RTF) lexical analyzer.
use RTF::Lexer qw(:all);
my $parser = RTF::Lexer->new(in => 'text.rtf'); my $token; do { $token = $parser->get_token(); } until $parser->is_stop_token($token);
RTF::Lexer is a low-level RTF format lexical analyzer. It splits the input stream into separate tokens, which can be handled by other high-level modules.
in
which must be an input
file handle or a file name. In the latter case if there is a failure
while opening the file method new
throws an exception. By default
the input is read from STDIN
.
The following token types are recognized by RTF::Lexer, that are declared as constants in this module:
\rtf1
, \trowd
).
{
).
}
).
}
that turns off destination mode).
\'
control symbol.
\bin
control word).
These constants are not exported by default. Any of them may be exported by request.
All of them may be exported by the use of :all
export tag.
unget_token($token)
$token
so the next call to get_token
will return it.
RTF::Tokenizer, Rich Text Format (RTF) Specification.
It is impossible to have more then one RTF::Lexer objects in a single process.
Vadim O. Ustiansky <ustiansky@cpan.org>
RTF::Lexer - Rich Text Format lexical analyzer. |