Common functions for building and using parsers.
Common functions for building and using parsers.
(antlr-input-stream s)
Constructs an ANTLRInputStream out of a String, Reader, or InputStream.
Constructs an ANTLRInputStream out of a String, Reader, or InputStream.
(case-insensitive-input-stream input)
Constructs an ANTLRInputStream out of a string. Presents all characters to the lexer as lowercase, but getText methods will return the original string. Adapted from https://gist.github.com/sharwell/9424666. Consumes memory proportional to the input string.
Constructs an ANTLRInputStream out of a string. Presents all characters to the lexer as lowercase, but getText methods will return the original string. Adapted from https://gist.github.com/sharwell/9424666. Consumes memory proportional to the input string.
(child node i)
Get a specific child in a tree.
Get a specific child in a tree.
(child-count node)
How many children does a node have?
How many children does a node have?
(children node)
Returns the children of a RuleNode.
Returns the children of a RuleNode.
(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.
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 s)
Like (keyword str), but faster.
Like (keyword str), but faster.
A map of strings to keywords.
A map of strings to keywords.
(first-rule grammar)
The name of the first rule in a grammar.
The name of the first rule in a grammar.
(input-stream s)
(input-stream s opts)
Constructs an inputstream. With no options, calls antlr-input-stream. With options:
:case-sensitive? true calls antlr-input-stream, false calls case-insensitive-input-stream
Constructs an inputstream. With no options, calls antlr-input-stream. With options: :case-sensitive? true calls antlr-input-stream, false calls case-insensitive-input-stream
(multi-hinted-let [name expr classes] & body)
A let expression which expands into multiple type-hinted bodies with runtime type dispatch provided by instanceof. Thanks to amalloy, as usual!
A let expression which expands into multiple type-hinted bodies with runtime type dispatch provided by instanceof. Thanks to amalloy, as usual!
(parse-error errors tree)
Constructs a new ParseError exception with a list of errors.
Constructs a new ParseError exception with a list of errors.
(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.
Given a parser and an integer rule index, returns the string name of that rule. Negative indexes map to nil.
(recognition-exception->map e)
Converts a RecognitionException to a nice readable map.
Converts a RecognitionException to a nice readable map.
(rule-index grammar rule-name)
Given a grammar and the name of a rule, returns the integer index of that rule.
Given a grammar and the name of a rule, returns the integer index of that rule.
(token-name parser index)
Given a parser and a token index, returns the string name of that token. Negative indexes map to nil.
Given a parser and a token index, returns the string name of that token. Negative indexes map to nil.
(tokens lexer)
A token stream taken from a lexer.
A token stream taken from a lexer.
(visit visitor node)
Visits a node with a visitor.
Visits a node with a visitor.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close