JanetDocsPlaygroundI'm feeling luckyGitHub sign in

parser/state



    cfunction
    src/core/parse.c on line 1234, column 1

    (parser/state parser &opt key)

    Returns a representation of the internal state of the parser. If a 
    key is passed, only that information about the state is returned. 
    Allowed keys are:

    * :delimiters - Each byte in the string represents a nested data 
      structure. For example, if the parser state is '(["', then the 
      parser is in the middle of parsing a string inside of square 
      brackets inside parentheses. Can be used to augment a REPL 
      prompt.

    * :frames - Each table in the array represents a 'frame' in the 
      parser state. Frames contain information about the start of the 
      expression being parsed as well as the type of that expression 
      and some type-specific information.


1 exampleSign in to add an example
Loading...
(let [p (parser/new)
      src ``
          (defn x
            [y]
            (+ 3 (* 4
                    (- 2 3)
          ``]
  (parser/consume p src)
  ((parser/state p) :delimiters))
# => "((("
sogaiuPlayground