sub-sub-.pegR: An alternative to apply_rule

Description Usage Examples

Description

An alternative to apply_rule

Usage

1
2
## S3 method for class 'pegR'
parser[[rule.id]]

Examples

1
2
3
4
5
6
7
8
9
# The simplest example: a parser that only accepts a single character 'a'
# First create a new pegR
peg<-new.parser()
# Next we add the rule to the peg
peg + "A<-'a'"
# Next apply the rule to the string "a"
peg[['A']]("a")->res
# to see the result  print(res)
res

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