1 This module provides a simple way to extend the Math::Symbolic parser with
2 arbitrary functions that return any valid Math::Symbolic tree. The return
3 value of the function call is inserted into the complete parse tree at the
4 point at which the function call is parsed. Familiarity with the
5 Math::Symbolic module will be assumed throughout the documentation.
7 This module is not object oriented. It does not export anything. You
8 should not call any subroutines directly nor should you modify any class
9 data directly. The complete interface is the call to use
10 Math::SymbolicX::ParserExtensionFactory and its arguments. The reason for
11 the long module name is that you should not have to call it multiple times
12 in your code because it modifies the parser for good. It is intended to be
15 The aim of the module is to allow for hooks into the parser without
16 modifying the parser yourself because that requires rather in-depth
17 knowledge of the module code. By specifying key => value pairs of function
18 names and function implementations (code references) as arguments to the
19 use() call of the module, this module extends the parser that is stored in
20 the $Math::Symbolic::Parser variable with the specified functions and
21 whenever "yourfunction(any argument string not containing an unescaped \)
22 )" occurs in the code, the subroutine reference is called with the
23 argument string as argument.
25 The subroutine is expected to return any Math::Symbolic tree. That means,
26 as of version 0.133, a Math::Symbolic::Operator, a
27 Math::Symbolic::Variable, or a Math::Symbolic::Constant object. The
28 returned object will be incorporated into the Math::Symbolic tree that
29 results from the parse at the exact position at which the custom function
32 Please note that the usage of this module will be quite slow at compile
33 time because it has to regenerate the complete Math::Symbolic parser the
34 first time you use this module in your code. The run time performance
35 penalty should be low, however.
37 WWW: http://search.cpan.org/dist/Math-SymbolicX-ParserExtensionFactory/