Liking cljdoc? Tell your friends :D

clj-antlr.static

Interacts with statically compiled antlr classes.

Interacts with statically compiled antlr classes.

->class

(->class sym)

Converts symbols and strings into classes.

Converts symbols and strings into classes.
sourceraw docstring

degenerate-visitor-spec

(degenerate-visitor-spec sig)

A reify spec for a particular visitor method. Returns code which, when used in a visitor, handles that node by returning a hashmap of its children. When a node has only one children, returns that child's value instead.

A reify spec for a particular visitor method. Returns code which, when
used in a visitor, handles that node by returning a hashmap of its children.
When a node has only one children, returns that child's value instead.
sourceraw docstring

lexermacro

(lexer lexer-class s)

Given a lexer class, returns a lexer over a string or stream.

Given a lexer class, returns a lexer over a string or stream.
sourceraw docstring

method-signatures

(method-signatures class)

Returns a list of method signatures for a class.

Returns a list of method signatures for a class.
sourceraw docstring

method?

(method? member)

Is a reflection member a method?

Is a reflection member a method?
sourceraw docstring

parsermacro

(parser parser-class tokens)

Constructs a parser over a token stream.

Constructs a parser over a token stream.
sourceraw docstring

signature

(signature meth)

The signature of a reflected method.

The signature of a reflected method.
sourceraw docstring

unique-methods

(unique-methods class)

Given a class, returns specs for methods which are defined in that class and are not defined in its supers.

Given a class, returns specs for methods which are defined in that class and
are *not* defined in its supers.
sourceraw docstring

visit-stringmacro

(visit-string lexer-class parser-class visitor root-node string)

Given a lexer class, parser class, a visitor, and a string, tokenizes, parses, and visits the string, returning the result of the visitor.

Example:

(visit-string JsonLexer JsonParser (JsonInitBaseVisitor.) .json "[1,2,3]"

Given a lexer class, parser class, a visitor, and a string, tokenizes,
parses, and visits the string, returning the result of the visitor.

Example:

(visit-string JsonLexer JsonParser (JsonInitBaseVisitor.) .json "[1,2,3]"
sourceraw docstring

visitormacro

(visitor interface-name & specs)

Helps compile a visitor for an antlr grammar. Takes the name of a visitor interface, followed by several method bodies. Given a grammar with a node like

json: object # JsonObject | array # JsonArray ;

Antlr will compile an interface to traverse the parse tree like:

public interface JsonVisitor<T> extends ParseTreeVisitor<T> { T visitJsonObject(JsonParser.JsonObjectContext ctx); T visitJsonArray(JsonParser.JsonArrayContext ctx); }

You might want to define a function to handle each of these branches. Here 'this refers to the visitor itself, and 'context refers to the parser context at the current node. You can traverse the tree by calling (.visit this node).

(visitor JsonVisitor (JsonObject [this context] (prn :got (.getText .object c))) (JsonArray [this context] (.visit this (.array context))))

Helps compile a visitor for an antlr grammar. Takes the name of a visitor
interface, followed by several method bodies. Given a grammar with a node
like

json:   object # JsonObject
    |   array  # JsonArray
    ;

Antlr will compile an interface to traverse the parse tree like:

public interface JsonVisitor<T> extends ParseTreeVisitor<T> {
    T visitJsonObject(JsonParser.JsonObjectContext ctx);
    T visitJsonArray(JsonParser.JsonArrayContext ctx);
}

You might want to define a function to handle each of these branches. Here
'this refers to the visitor itself, and 'context refers to the parser context
at the current node. You can traverse the tree by calling (.visit this node).

(visitor JsonVisitor
  (JsonObject [this context] (prn :got (.getText .object c)))
  (JsonArray [this context] (.visit this (.array context))))
sourceraw docstring

visitor-method-children

(visitor-method-children sig)

Given a visitor method, returns a map of children to forms which visit those children, e.g.

{:kittens (map (partial visit this (.kittens ctx)))}

Given a visitor method, returns a map of children to forms which visit
those children, e.g.

{:kittens (map (partial visit this (.kittens ctx)))}
sourceraw docstring

visitor-spec

(visitor-spec sig & args)

Helps compile reify functions pecs for a particular visitor method. In its two-arity form, generates one of a few common parse helpers. In its n-arity form, passes through user-specified code.

Helps compile reify functions pecs for a particular visitor method. In its
two-arity form, generates one of a few common parse helpers. In its n-arity
form, passes through user-specified code.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close