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.$client_class needs to be the name of a package that supports the
following two functions:
| ||||||||
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: | |||||||
InfixParser_ are reserved for use
by the parser.
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.
|
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.$client_class needs to be the name of a package that supports the
following two functions:
ObjectMethod addOperator (%oper)Add an operator to the parser.%oper is a hash, containing the following fields:
InfixParser_ are reserved for use
by the parser.
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.
|