Convert a function to look for pd object in the parent.frame()
,
and the id to extract from the pd unless overwritten.
These functions are for internal use but are documented here for reference.
internal(fun, id = pd$id)token(id = pd$id, pd = get("pd", parent.frame()))
text(id = pd$id, pd = get("pd", parent.frame()))
nodes(id, pd = get("pd", parent.frame()))
start_line(id, pd = get("pd", parent.frame()))
start_col(id, pd = get("pd", parent.frame()))
end_line(id, pd = get("pd", parent.frame()))
end_col(id, pd = get("pd", parent.frame()))
filename(pd = get("pd", parent.frame()))
lines(id, pd = get("pd", parent.frame()))
is_terminal(id, pd = get("pd", parent.frame()))
is_first_on_line(id, pd = get("pd", parent.frame()))
is_last_on_line(id, pd = get("pd", parent.frame()))
spans_multiple_lines(id, pd = get("pd", parent.frame()))
terminal_ids_on_line(line, pd = get("pd", parent.frame()))
ids_starting_on_line(line, pd = get("pd", parent.frame()))
ids_ending_on_line(line, pd = get("pd", parent.frame()))
prev_terminal(id = pd$id, pd = get("pd", parent.frame()))
expr_text(id, pd = get("pd", parent.frame()))
The function to make internal
the ID of the expression
the parse data.
a line number
token
: Extract the token
text
: Extract the text
nodes
: Extract only the specified node(s).
start_line
: Get the line the expression starts on.
start_col
: Get the column the expression starts on.
end_line
: Get the line the expression ends on.
end_col
: Get the column the expression ends on.
filename
: Extract the filename if available, otherwise return "<UNKNOWN>".
lines
: Extract the lines of text.
is_terminal
: does id represent a terminal node.
is_first_on_line
: is an expression the first one on a line?
is_last_on_line
: Is expression the last terminal node on the line?
spans_multiple_lines
: does the expression span multiple lines?
terminal_ids_on_line
: Get the ids on a given line that are terminal nodes.
ids_starting_on_line
: Get ids for nodes that start on the given line
ids_ending_on_line
: Get ids for nodes that end on the given line
prev_terminal
: Get the id for the terminal expression that is immediately prior to the one given.
expr_text
: If id represents an expr
token reiterate on the firstborn.
Throws an error if anything but an expression or text if found.