Parser.Stack
Parsing stack
Extract the list of full S-expressions contained in a stack.
For instance:
# to_list (Sexp (Atom "y", Sexp (Atom "x", Empty)));;
- : Stack.t list = [Atom "x"; Atom "y"]
Add a right parenthesis. Raise Parse_error
if the stack contains no opened parentheses.
For instance:
# close_paren (Sexp (Atom "y", Sexp (Atom "x", Open Empty)));;
- : Stack.t = Sexp (List [Atom "x"; Atom "y"], Empty)
Insert an atom in the parsing stack:
# add_atom "foo" Empty;;
- : Stack.t = Sexp (Atom "foo", Empty)
val add_token : [ `other ] Lexer.token -> t -> t
Add a token as returned by the lexer.