Description Usage Arguments Value See Also Examples
Creates an instance of a new PEG parser.
1 | new.parser(peg.data.frame = NULL, record.mode = FALSE, action.exe = FALSE)
|
peg.data.frame, |
a data frame with rules to populate the parser. (default is NULL) A peg.data.frame consists of the following fields:
|
record.mode, |
when set to TRUE, will keep a record
to display with |
action.exe, |
when set to TRUE, all actions will be executed unless overridden by command line. (default is FALSE) |
Returns a new instance of a PEG parser
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Create an empty parser
parser<-new.parser()
peg<-add_rule(parser, "Any<-.")
rule_ids(parser) # returns "Any"
#Create a parser from a data.frame
fn<-function(x){list()}
df<-data.frame(
rule.id=c('A','B'),
rule.source=c("A<-'a'", "B<-'b'"),
rule.description=c("aaa",NA),
action.type=c("Inline","External"),
action.specification=c("list()", "fn"),
stringsAsFactors=FALSE)
peg<-new.parser(df)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.