<<O>> Difference Topic TWikiInfixParserDotPm (2 - 2008-12-06 - TWikiContributor) |
Package =TWiki::Infix::ParserA simple stack-based parser that parses infix expressions with nonary, unary and binary operators specified using an operator table. Escapes are supported in strings, using backslash.
On this page:
new($client_class, \%options) -> parser objectCreates a new infix parser. Operators must be added for it to be useful. The tokeniser matches tokens in the following order: operators, quotes (" and '), numbers, words, brackets. If you have any overlaps (e.g. an operator '<' and a bracket operator '<<') then the first choice will match.
The remaining parameters are named, and specify options that affect the behaviour of the parser:
| ||||||||
Changed: | ||||||||
< < | ObjectMethod addOperator (%oper) | |||||||
> > | ObjectMethod addOperator (\%oper) | |||||||
Add an operator to the parser. | ||||||||
Changed: | ||||||||
< < | %oper is a hash, containing the following fields: | |||||||
> > | \%oper is a hash (or an object), containing the following fields: | |||||||
Field names in the hash starting with
ObjectMethod parse ($string) -> $parseTreeParses$string , calling newLeaf and newNode in the client class
as necessary to create a parse tree. Returns the result of calling newNode
on the root of the parse.
Throws TWiki::Infix::Error in the event of parse errors. |
<<O>> Difference Topic TWikiInfixParserDotPm (1 - 2008-01-22 - TWikiContributor) |
Package =TWiki::Infix::ParserA simple stack-based parser that parses infix expressions with nonary, unary and binary operators specified using an operator table. Escapes are supported in strings, using backslash.
On this page:
new($client_class, \%options) -> parser objectCreates a new infix parser. Operators must be added for it to be useful. The tokeniser matches tokens in the following order: operators, quotes (" and '), numbers, words, brackets. If you have any overlaps (e.g. an operator '<' and a bracket operator '<<') then the first choice will match.
The remaining parameters are named, and specify options that affect the behaviour of the parser:
ObjectMethod addOperator (%oper)Add an operator to the parser.
Field names in the hash starting with
ObjectMethod parse ($string) -> $parseTreeParses$string , calling newLeaf and newNode in the client class
as necessary to create a parse tree. Returns the result of calling newNode
on the root of the parse.
Throws TWiki::Infix::Error in the event of parse errors. |