4i: Parsing (Useful Idioms)

+alf

Alphabetic characters.

Parse alphabetic characters, both upper and lowercase.

Source

++  alf  ;~(pose low hig)

Examples

> (scan "a" alf)
'a'
> (scan "A" alf)
'A'
> `tape`(scan "AaBbCc" (star alf))
"AaBbCc"

+aln

Alphanumeric characters.

Parse alphanumeric characters - both alphabetic characters and numbers.

Source

Examples


+alp

Alphanumeric and -.

Parse alphanumeric strings and hep, -.

Source

Examples


+bet

Axis syntax -, +.

Parse the hep and lus axis syntax.

Source

Examples


+bin

Binary to $atom.

Parse a tape of binary (0s and 1s) and produce its atomic representation.

Source

Examples


+but

Binary digit.

Parse a single binary digit.

Source

Examples


+cit

Octal digit.

Parse a single octal digit.

Source

Examples


+dem

Decimal to $atom.

Parse a decimal number to an $atom.

Source

Examples


+dit

Decimal digit.

Parse a single decimal digit.

Source

Examples


+dog

. optional gap.

Dot followed by an optional gap, used with numbers.

Source

Examples


+dof

- optional gap.

Hep followed by an optional gap, used with @p & @q syntax.

Source

Examples


+doh

@p separator.

Phonetic base phrase separator

Source

Examples


+dun

-- to ~.

Parse phep, --, to null, ~.

Source

Examples


+duz

== to ~.

Parse stet, ==, to null ~.

Source

Examples


+gah

Newline or ' '.

Whitespace component, either newline or space.

Source

Examples


+gap

Plural whitespace.

Separates tall runes.

Source

Examples


+gaq

End of line.

Two spaces, a newline, or comment.

Source

Examples


+gaw

Normal whitespace.

Source

Examples


+gay

Optional gap.

Source

Examples


+gon

Long numbers.

Parse long numbers - Numbers which wrap around the shell with the line

Source

Examples


+gul

Axis syntax < or >.

Parse the axis gal and gar axis syntax.

Source

Examples


+hex

Hex to $atom.

Parse any hexadecimal number to an $atom.

Source

Examples


+hig

Uppercase.

Parse a single uppercase letter.

Source

Examples


+hit

Hex digits.

Parse a single hexadecimal digit.

Source

Examples


+iny

Indentation block.

Apply $rule to indented block starting at current column number, omitting the leading whitespace.

Accepts

sef is a $rule

Produces

A $rule.

Source

Examples

Discussion

Note the amount of indentation whitespace to be stripped from the beginning of each line is determined by the value of .q (the column) in the $hair when +iny is first called. This means something like the +pfix expression in the example above is necessary to set the level of indentation. Additionally, the $rule given to +iny must consume the whole line including the line ending.


+low

Lowercase.

Parse a single lowercase letter.

Source

Examples


+mes

Hexbyte.

Parse a hexbyte.

Source

Examples


+nix

Letters and underscore.

Parse Letters and _.

Source

Examples


+nud

Numeric.

Parse a numeric character - A number.

Source

Examples


+prn

Printable character.

Parse any printable character.

Source

Examples


+qat

Chars in blockcord.

Parse a single character contained in a multi-line cord block.

Source

Examples


+qit

Chars in cord.

Parse an individual character to its cord $atom representation. Escaped characters are converted to the value they represent.

Source

Examples


+qut

Cord.

Parse single-soq cord with \{gap}/ anywhere in the middle, or triple-single quote (aka triple-soq) cord, between which must be in an indented block.

Source

Examples


+soz

Delimiting '''.

Parse a triple-single quote, used for multiline strings.

Source

Examples


+sym

Term.

A term: a lowercase letter, followed by letters, numbers, or -.

Source

Examples


+mixed-case-symbol

Mixed-case term.

The same as +sym but allowing uppercase letters.

Source

Examples


+ven

+>- axis syntax.

Axis syntax parser

Source

Examples


+vit

Base64 digit.

Parse a standard base64 digit.

Source

Examples


+vul

Comments to null.

Parse comments and produce a null. Note that a comment must be ended with a newline character.

Source

Examples


Last updated