std.block
block
added in 3.0
(block elem)creates a block
(base/block-info (block 1)) => {:type :token, :tag :long, :string “1”, :height 0, :width 1}
(str (block 1 (newline) (void) 2)) => “1\n 2”
block-children
added in 3.0
(block-children block)returns the children in the block
(->> (block-children (parse/parse-string “1 2”)) (apply str)) => “1␣␣␣2”
block-height
added in 3.0
(block-height block)returns the height of a block
(block-height (construct/block ^:list (construct/newline) (construct/newline))) => 2
block-info
added in 3.0
(block-info block)returns the data associated with the block
(block-info (construct/token true)) => {:type :token, :tag :boolean, :string “true”, :height 0, :width 4} => {:type :token, :tag :boolean, :string “true”}
(block-info (construct/void \tab)) => {:type :void, :tag :linetab, :string “\t”, :height 0, :width 4}
block-length
added in 3.0
(block-length block)return the length of the string
(block-length (construct/void)) => 1
(block-length (construct/block 1 2 3 4)) => 9
block-prefixed
added in 3.0
(block-prefixed block)returns the length of the starting characters
(block-prefixed (construct/block #{})) => 2
block-string
added in 3.0
(block-string block)returns block string as representated in the file
(block-string (construct/token 3/4)) => “3/4”
(block-string (construct/void \space)) => ""
block-suffixed
added in 3.0
(block-suffixed block)returns the length of the ending characters
(block-suffixed (construct/block #{})) => 1
block-tag
added in 3.0
(block-tag block)returns block tag as keyword
(block-tag (construct/void nil)) => :eof
(block-tag (construct/void \space)) => :linespace
block-type
added in 3.0
(block-type block)returns block type as keyword
(block-type (construct/void nil)) => :void
(block-type (construct/token “hello”)) => :token
block-value
added in 3.0
(block-value block)returns the value of the block
(block-value (construct/token 1.2)) => 1.2
block-value-string
added in 3.0
(block-value-string block)returns the string for which a value will be generated
(block-value-string (parse/parse-string “#(+ 1 ::2)”)) => “#(+ 1 (keyword ":2"))”
block-width
added in 3.0
(block-width block)returns the width of a block
(block-width (construct/token ’hello)) => 5
block?
added in 3.0
(block? obj)check whether an object is a block
(block? (construct/void nil)) => true
(block? (construct/token “hello”)) => true
code-block?
added in 4.0
(code-block? block)checks if a block can be representated as code
comment
added in 3.0
(comment s)creates a comment block
(str (comment “;hello”)) => “;hello”
comment-block?
added in 3.0
(comment-block? block)checks if the block is a token block
(comment-block? (construct/comment “;;hello”)) => true
container
added in 3.0
(container tag children)creates a container
(str (container :list (void) (void))) => “( )”
container-block?
added in 3.0
(container-block? block)checks if block is a container block
(container-block? (construct/block [])) => true
contents
added in 3.0
(contents block)eof-block?
added in 3.0
(eof-block? block)checks if input is an eof block
(eof-block? (construct/void nil)) => true
expression?
added in 3.0
(expression? block)checks if the block has a value associated with it
(expression? (construct/token 1.2)) => true
heal-content
added in 4.0
(heal-content content)allow multiple passes to heal the delimiter
linebreak-block?
added in 3.0
(linebreak-block? block)checks if block is of type :linebreak
(linebreak-block? (construct/newline)) => true
linespace-block?
added in 3.0
(linespace-block? block)checks if block is of type :linespace
(linespace-block? (construct/space)) => true
max-width
added in 3.0
(max-width block)(max-width block offset)gets the max width of given block, along with starting offset
modifier-block?
added in 3.0
(modifier-block? block)checks if block is a modifier block
(modifier-block? (construct/uneval)) => true
newlines
added in 3.0
(newlines n)creates multiple newlines
(apply str (newlines 5)) => "
"
parse-first
added in 4.0
(parse-first string)gets the first element in root
(str (parse-first “a b c”)) => “a”
parse-string
added in 3.0
(parse-string s)space-block?
added in 3.0
(space-block? block)checks if block is of type \space
(space-block? (construct/space)) => true
spaces
added in 3.0
(spaces n)creates multiple space blocks
(apply str (spaces 5)) => “␣␣␣␣␣”
token-block?
added in 3.0
(token-block? block)checks if the block is a token block
(token-block? (construct/token “hello”)) => true
void-block?
added in 3.0
(void-block? block)checks if the block is a void block
(void-block? (construct/void)) => true