An alternative to apply_rule
1 2 | ## S3 method for class 'pegR'
parser[[rule.id]]
|
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.