Liking cljdoc? Tell your friends :D

meme.tools.lexer

Generic scanlet builders for the Pratt parser engine.

Scanlet builders wrap language-specific consume functions into parselets that the grammar spec can reference. They bridge the gap between 'consume characters from source' and 'produce a CST node'.

Any language can use these builders with its own consume functions.

Generic scanlet builders for the Pratt parser engine.

Scanlet builders wrap language-specific consume functions into parselets
that the grammar spec can reference. They bridge the gap between
'consume characters from source' and 'produce a CST node'.

Any language can use these builders with its own consume functions.
raw docstring

atom-scanletclj/s

(atom-scanlet token-type consume-fn)

Build a scanlet that consumes chars via consume-fn, makes a token, returns atom node. consume-fn: (fn [^String source ^long len ^long pos] → end-pos)

Build a scanlet that consumes chars via consume-fn, makes a token, returns atom node.
consume-fn: (fn [^String source ^long len ^long pos] → end-pos)
sourceraw docstring

block-comment-consumerclj/s

(block-comment-consumer engine)

Consume a block comment (* ... *). Supports nesting.

Consume a block comment (* ... *). Supports nesting.
sourceraw docstring

char-codeclj/s

(char-code ch)

Character code point. Normalizes the JVM/CLJS asymmetry: on JVM ch is a Character and int returns the code point; on CLJS ch is a one-char String. The CLJS (str ch) coercion is defensive against callers passing a char-typed value in the JS world.

Character code point. Normalizes the JVM/CLJS asymmetry: on JVM `ch` is a
Character and `int` returns the code point; on CLJS `ch` is a one-char
String. The CLJS `(str ch)` coercion is defensive against callers passing
a char-typed value in the JS world.
sourceraw docstring

consume-identifierclj/s

(consume-identifier source len pos)

Consume [a-zA-Z_][a-zA-Z0-9_]*

Consume [a-zA-Z_][a-zA-Z0-9_]*
sourceraw docstring

consume-numberclj/s

(consume-number source len pos)

Consume integer or float: digits [. digits] [e/E [+/-] digits]

Consume integer or float: digits [. digits] [e/E [+/-] digits]
sourceraw docstring

consume-stringclj/s

(consume-string source len pos)

Consume double-quoted string with backslash escapes.

Consume double-quoted string with backslash escapes.
sourceraw docstring

delimited-scanletclj/s

(delimited-scanlet node-type token-type close-char close-type)

Build a scanlet for an opening delimiter that parses children until close-char.

Build a scanlet for an opening delimiter that parses children until close-char.
sourceraw docstring

digit?clj/s

(digit? ch)

True if ch is an ASCII digit (0–9). Cross-platform (normalizes JVM Character vs CLJS single-char String via char-code).

True if `ch` is an ASCII digit (0–9). Cross-platform (normalizes JVM
Character vs CLJS single-char String via `char-code`).
sourceraw docstring

ident-char?clj/s

(ident-char? ch)

Default identifier-continuation predicate: ident-start? or digit?. Override for language-specific rules.

Default identifier-continuation predicate: `ident-start?` or `digit?`.
Override for language-specific rules.
sourceraw docstring

ident-start?clj/s

(ident-start? ch)

Default identifier start: [a-zA-Z_]. Override for language-specific rules.

Default identifier start: [a-zA-Z_]. Override for language-specific rules.
sourceraw docstring

line-comment-consumerclj/s

(line-comment-consumer engine prefix-len)

Consume a line comment from current position to end of line. prefix-len: number of chars to skip (e.g. 2 for //, 1 for ;).

Consume a line comment from current position to end of line.
prefix-len: number of chars to skip (e.g. 2 for //, 1 for ;).
sourceraw docstring

newline-consumerclj/s

(newline-consumer engine)

Trivia consumer for a single newline. Advances past \r\n or \n and emits a :newline trivia token. Plug into a grammar's trivia table.

Trivia consumer for a single newline. Advances past `\r\n` or `\n` and
emits a `:newline` trivia token. Plug into a grammar's trivia table.
sourceraw docstring

single-char-scanletclj/s

(single-char-scanlet token-type factory-parselet)

Build a scanlet for a single-character token that delegates to a factory parselet. factory-parselet: (fn [engine tok] → CST node)

Build a scanlet for a single-character token that delegates to a factory parselet.
factory-parselet: (fn [engine tok] → CST node)
sourceraw docstring

ws-consumerclj/s

(ws-consumer engine)
(ws-consumer engine whitespace-pred)

Consume whitespace (space, tab). Override whitespace-pred for language-specific rules.

Consume whitespace (space, tab). Override whitespace-pred for language-specific rules.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close