set_rule_stack_limit: Sets restriction on the maximum call depth of rules

Description Usage Arguments Details See Also Examples

View source: R/rule_stack.R

Description

Sets restriction on the maximum call depth of rules

Usage

1
set_rule_stack_limit(pegR, stop.level.limit)

Arguments

parser,

a peg parser produced by new.parser

stop.level.limit,

a restriction on the number of calls (levels) before stopping a parse

Details

Since a rule can call other rules or even itself, the depth of a calling sequence can grow and potentially be infinited. By setting the stop level one is restricting that depth, and hence can detect possible infinite recursive calls. To inspect the calling sequence of those rules when the max depth of the rule stack is exceed, use get_rule_stack

See Also

get_rule_stack, unset_rule_stack_limit

Examples

1
2
3
4
5
6
7
## Not run: 
peg<-new.parser()
set_rule_stack_limit(peg, 10)
peg<-add_rule(peg, "A<-A" ) #an infinite recursive call
apply_rule(peg, "A", "x") #the input is irrevelant, throws error

## End(Not run)

mslegrand/pegr documentation built on May 23, 2019, 7:53 a.m.