Description Usage Value Examples
Returns the value of a parsing result
1 | value(res)
|
A list containing the values computed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Select the matching pair of from the alternatives
peg<-new.parser()
peg<-add_rule(peg, "R<-('a'/'c') ('b' / 'd')")
apply_rule(peg, "R", 'ad')->res
value(res)
# double all occurances of all vowels
peg<-new.parser()
peg<-add_rule(peg, "V<-'a' / 'e' / 'i' / 'o' / 'u' ")
peg<-add_rule(peg, "C<-(!V .)")
peg<-add_rule(peg, "A<- (V / C)+" )
peg<-set_action(peg, "V", "c(v[1],v[1])" )
peg<-set_action(peg, "A", "list(paste0(v,collapse=''))" )
apply_rule(peg, "A", "the big bad wolf", exe=TRUE)->res
value(res)[1]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.