(at? source mark)
Returns true if the source is in the state represented by mark
.
Returns true if the source is in the state represented by `mark`.
(backtrack! source mark)
Restores the source to the state represented by mark
.
Restores the source to the state represented by `mark`.
(backtrack-modified! source state)
Like backtrack!
, but does not reset the modcount
.
Like `backtrack!`, but does not reset the `modcount`.
(end? source)
Returns true if source
is at the end (drained).
Returns true if `source` is at the end (drained).
(index source)
Returns the current index in the source
.
Returns the current index in the `source`.
(mark source)
Marks the current source position, returning a mark object. The source
can subsequently be reset to this mark. The caller is responsible to
release the mark once it is no longer needed, preferrably using the
with-resource
macro.
Marks the current source position, returning a mark object. The source can subsequently be reset to this mark. The caller is responsible to release the mark once it is no longer needed, preferrably using the [[with-resource]] macro.
(matches-str-ci? source s)
Like matches-str?
, but case-insensitive.
Like `matches-str?`, but case-insensitive.
(matches-str? source s)
Returns true if the next characters in source
are equal to the ones in
string s
.
Returns true if the next characters in `source` are equal to the ones in string `s`.
(modcount source)
Returns an integer representing the number of times the source
has been
modified. This can be used to efficiently determine if the parser state
has been modified.
Returns an integer representing the number of times the `source` has been modified. This can be used to efficiently determine if the parser state has been modified.
(of input)
(of input opts)
Creates a source from input
.
Creates a source from `input`.
(peek source)
Returns the next token in the source
, without consuming it.
Returns nil
if the source is at the end.
Returns the next token in the `source`, without consuming it. Returns `nil` if the source is at the end.
(peek-str source n)
Returns a string of up to n
characters at the current source position,
without consuming them.
Returns a string of up to `n` characters at the current source position, without consuming them.
(position source)
(position source index)
Returns the position (line and column indexes) of the source
, at
the current or a previous index
.
Returns the position (line and column indexes) of the `source`, at the current or a previous `index`.
(re-groups source re)
Matches the regular expression re
at the current source position and
returns the matched string or a vector of captured groups,
like clojure.core/re-groups
.
Matches the regular expression `re` at the current source position and returns the matched string or a vector of captured groups, like `clojure.core/re-groups`.
(re-match source re)
Matches the regular expression re
at the current source position and
returns a platform-dependent match result object.
Matches the regular expression `re` at the current source position and returns a platform-dependent match result object.
(read-char-when! source pred)
Reads and returns the next character when it satisfies pred
. Returns
false
when it does not satsify pred
, and nil
at the end of the
source.
Reads and returns the next character when it satisfies `pred`. Returns `false` when it does not satsify `pred`, and `nil` at the end of the source.
(read-from source mark)
Returns a string of all characters from the marked position (inclusive) to the current position (exclusive).
Returns a string of all characters from the marked position (inclusive) to the current position (exclusive).
(read-str! source n)
Returns a string of up to n
characters and advances the source position.
Returns the number of characters read.
Returns a string of up to `n` characters and advances the source position. Returns the number of characters read.
(release! x)
Releases any resources held by x
.
Releases any resources held by `x`.
(satisfies-char-pred? source pred)
Returns true if the next character in the source
satisfies the char
predicate pred
.
Returns true if the next character in the `source` satisfies the char predicate `pred`.
(skip! source)
(skip! source n)
Skips the next token, or the next n
tokens, and advances the source.
Returns the number of tokens skipped.
Skips the next token, or the next `n` tokens, and advances the source. Returns the number of tokens skipped.
(skip-chars-while! source pred)
Skips the next chars in source
as long as they satisfy the char
predicate pred
. Returns the number of skipped characters.
Skips the next chars in `source` as long as they satisfy the char predicate `pred`. Returns the number of skipped characters.
(untracked-skip! source)
(untracked-skip! source n)
Like skip!
, but does not track line numbers. For optimisation, when we
have already determined that the next character is not a line terminator.
Like `skip!`, but does not track line numbers. For optimisation, when we have already determined that the next character is not a line terminator.
(user-state source)
Returns the current user state.
Returns the current user state.
(with-resource bindings & body)
Similar to with-open
, but works in ClojureScript and SCI.
Similar to `with-open`, but works in ClojureScript and SCI.
(with-user-state! source state)
Sets the user state to state
, and returns the source
.
Sets the user state to `state`, and returns the `source`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close