plus-.pegR: Alternative to add_rule.

Description Usage Arguments Details Examples

Description

Alternative to add_rule.

Usage

1
2
## S3 method for class 'pegR'
parser + arg

Arguments

parser,

a peg parser produced by new.parser

arg,

a list or vector specififyin a rule:

Details

arg is a list or vector having 1-4 named components:

Examples

1
2
3
4
5
6
7
8
9
peg<- new.parser()
peg + "A<-'a'" + "B<-'b'" + "C<-'c'"
#to suppress the output use invisible"
invisible(peg + "A<-'a'" + "B<-'b'" + "C<-'c'")
#now add rule D with action and comment using a named character vector
peg + c("D<-'d'", des="capitalize D", act="list(atom='D')")

#now add rule E with action and comment a unnamed character
peg + c( "E<-'e'", "#double E", "{list('EE')}" )

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