com.walmartlabs.lacinia.parser.antlr

Mostly excerpted from clj-antlr.common

AntlrParser

protocol

members

lexer

(lexer _ chars)

parser

(parser _ lexer)

tree

(tree _ parser)

child-count

(child-count node)

How many children does a node have?

children

(children node)

Returns the children of a RuleNode.

error-listener

(error-listener)

A stateful error listener which accretes parse errors in a deref-able structure. Deref returns nil if there are no errors; else a sequence of heterogenous maps, depending on what debugging information is available.

fast-keyword

(fast-keyword s)

Like (keyword str), but faster.

fast-keyword-cache

A map of strings to keywords.

parse

(parse ap input)

parse-error

(parse-error errors tree)

Constructs a new ParseError exception with a list of errors.

parser-rule-name

(parser-rule-name parser index)

Given a parser and an integer rule index, returns the string name of that rule. Negative indexes map to nil.

recognition-exception->map

(recognition-exception->map e)

Converts a RecognitionException to a nice readable map.