The parser class for generating abstract syntax trees for given table formulas.
The parser class for generating abstract syntax trees for given table formulas.
R6Class
object.
input
Storage for input string of a formula
pos
The current parsing position
len
The length of the input
new()
Create a parser
Parser$new()
expect()
Specify expectation of next token from lexer
Parser$expect(id)
id
The token id expected in stream, otherwise it's an error
peek()
Peek at the next token from parser
Parser$peek()
eat_whitespace()
Remove white space to find start of next token
Parser$eat_whitespace()
next_token()
Returns next lexical token
Parser$next_token()
r_expression()
Return R expression as token from lexical stream
Parser$r_expression()
term()
Parse and return next term in stream
Parser$term()
table_formula()
Parse and return table formula from stream
Parser$table_formula()
run()
Run the parser
Parser$run(x)
x
(character,formula) The table specification to parse
clone()
The objects of this class are cloneable with this method.
Parser$clone(deep = FALSE)
deep
Whether to make a deep clone.
Parser$new()$run("col1 + col2 + col3 ~ drug*age+spiders")
Run the code above in your browser using DataLab