Globbing searches in clojure.
Globbing searches in clojure.
(all-indices s pat)
Find all indices of a substring in a given string
Find all indices of a substring in a given string
(ast-type ast)
Determine if the ast can be unrolled to a string, can be exploded to a set of strings or needs to run through our algorithm.
Determine if the ast can be unrolled to a string, can be exploded to a set of strings or needs to run through our algorithm.
Yield a keyword name for the AST type
Yield a keyword name for the AST type
(char->token [prev c])
Our simple lexer, understands escaped characters.
Our simple lexer, understands escaped characters.
(close-branch branch)
We succesfuly parsed a branch, now yield the best possible AST for it.
We succesfuly parsed a branch, now yield the best possible AST for it.
(close-charclass cc nchar)
We're finished running through a class. Yield a set with some additional metadata to indicate whether the class is negated.
This also handles edge-cases (zero or single element classes).
We're finished running through a class. Yield a set with some additional metadata to indicate whether the class is negated. This also handles edge-cases (zero or single element classes).
(explode-ast ast)
Explode a non-compound AST to all its possible combinations.
Explode a non-compound AST to all its possible combinations.
(explode-compound-ast partitions)
Transform a partitioned compound AST by exploding eligible sub-ASTs
Transform a partitioned compound AST by exploding eligible sub-ASTs
(expr->tokens expr)
Looks at characters two at a time to yield a list of tokens.
Looks at characters two at a time to yield a list of tokens.
(filter-compound-ast partitions candidates)
Given a compound AST, yield the set of matching candidates.
Given a compound AST, yield the set of matching candidates.
(filter-compound-partition [eaters patterns] [pos candidate])
Match a list of candidates against a single partition of a compound AST. When a match occurs, yield a list of the new candidates this may have generated and if they are eligible as a terminal match.
Match a list of candidates against a single partition of a compound AST. When a match occurs, yield a list of the new candidates this may have generated and if they are eligible as a terminal match.
(find-pattern pos candidate s eaters pattern)
Match a string against a list of eaters and a pattern
Match a string against a list of eaters and a pattern
(glob expression candidates)
Perform globbing, matching the supplied expression
against
the list of supplied candidates
.
candidates
is a collection of strings and must be seqable.expression
adheres mostly to the bash notion of globbingGlobbing syntax:
Examples:
(glob "foobar" ["foobar"]) ;; => ("foobar")
(glob "fo[a-z]" ["foobar"]) ;; => ("foobar")
Perform globbing, matching the supplied `expression` against the list of supplied `candidates`. - `candidates` is a collection of strings and must be seqable. - `expression` adheres mostly to the bash notion of globbing Globbing syntax: - Any stray character is matched exactly - Wildcards ('*') mean any number (including zero) of arbitrary chars - Anyones ('?') mean a single arbitrary char - Character classes are enclosed in square brackets and may contain arbitrary list of characters to match. If a character class begins with a ('!') or ('^') character, the class will be negated, i.e: will only match characters absent from the class. Empty charclasses, i.e: ('[]'), ('[!]'), and ('[^]') match their representation, not their content. - Trees match any of their branches. Trees are delimited by curly brackets and content are separated by commas. Empty trees, i.e: ('{}'), ('{,}'), ('{,,}') match their representation, not their content. Examples: (glob "foobar" ["foobar"]) ;; => ("foobar") (glob "fo[a-z]" ["foobar"]) ;; => ("foobar")
(make-class beg end)
Build a list of all characters between beg
and end
Build a list of all characters between `beg` and `end`
(merge-ast)
(merge-ast left right)
Merge two non-compound ASTs by yielding all possible combinations.
Merge two non-compound ASTs by yielding all possible combinations.
(negated-cc? ast)
Is this representing a negated character class?
Is this representing a negated character class?
(partition-compound-ast tokens)
Partition a compound AST into a list of (eaters, ast) tuples where eaters is a list of eager character eaters and a potentially explodable AST
Partition a compound AST into a list of (eaters, ast) tuples where eaters is a list of eager character eaters and a potentially explodable AST
(scan-branch tokens)
Eat tokens until the end of a branch.
Eat tokens until the end of a branch.
(scan-branches tokens)
A tree has started, scan all its branches and yield the best possible AST for it.
A tree has started, scan all its branches and yield the best possible AST for it.
(scan-charclass tokens)
Eat tokens until the character class is closed.
Eat tokens until the character class is closed.
(stringify-ast ast)
Reduce a string-only AST to its equivalent string
Reduce a string-only AST to its equivalent string
(tokens->ast tokens)
Transform a list of tokens to an AST, if possible.
Transform a list of tokens to an AST, if possible.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close