When we are doing a normal parse, the various alternatives in the MuSyntax graph are explored until either there is a successful parse (consuming all tokens), or we run out of alternatives. The latter case results in an exception and a failed parse.
When we are doing a completion parse, all alternatives are explored irrespective of parse success.
A MuSyntax may contain "infinite" loops, or other pathologies that trigger excessive backtracking. To avoid problems, the 'parse' method takes a 'stepLimit' parameter that causes the parse to fail if it has not terminated soon enough.
The MuParser uses the SharedStack class to record syntax stacks for backtracking. This is a special purpose Deque that avoids unnecessary copying of the stack state. If you suspect that this is causing problems, replace {@code new SharedStack(...)}with {@code new LinkedList(...)}. @author crawley@jnode.org
|
|
|
|
|
|
|
|