4i: Parsing (Useful Idioms)
+alf
+alfAlphabetic 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
+alnAlphanumeric characters.
Parse alphanumeric characters - both alphabetic characters and numbers.
Source
Examples
+alp
+alpAlphanumeric and -.
Parse alphanumeric strings and hep, -.
Source
Examples
+bet
+betAxis syntax -, +.
Parse the hep and lus axis syntax.
Source
Examples
+bin
+binBinary to $atom.
Parse a tape of binary (0s and 1s) and produce its atomic representation.
Source
Examples
+but
+butBinary digit.
Parse a single binary digit.
Source
Examples
+cit
+citOctal digit.
Parse a single octal digit.
Source
Examples
+dem
+demDecimal to $atom.
Parse a decimal number to an $atom.
Source
Examples
+dit
+ditDecimal digit.
Parse a single decimal digit.
Source
Examples
+dog
+dog. optional gap.
Dot followed by an optional gap, used with numbers.
Source
Examples
+dof
+dof- optional gap.
Hep followed by an optional gap, used with @p & @q syntax.
Source
Examples
+doh
+doh@p separator.
Phonetic base phrase separator
Source
Examples
+dun
+dun-- to ~.
Parse phep, --, to null, ~.
Source
Examples
+duz
+duz== to ~.
Parse stet, ==, to null ~.
Source
Examples
+gah
+gahNewline or ' '.
Whitespace component, either newline or space.
Source
Examples
+gap
+gapPlural whitespace.
Separates tall runes.
Source
Examples
+gaq
+gaqEnd of line.
Two spaces, a newline, or comment.
Source
Examples
+gaw
+gawNormal whitespace.
Source
Examples
+gay
+gayOptional gap.
Source
Examples
+gon
+gonLong numbers.
Parse long numbers - Numbers which wrap around the shell with the line
Source
Examples
+gul
+gulAxis syntax < or >.
Parse the axis gal and gar axis syntax.
Source
Examples
+hex
+hexHex to $atom.
Parse any hexadecimal number to an $atom.
Source
Examples
+hig
+higUppercase.
Parse a single uppercase letter.
Source
Examples
+hit
+hitHex digits.
Parse a single hexadecimal digit.
Source
Examples
+iny
+inyIndentation 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
+lowLowercase.
Parse a single lowercase letter.
Source
Examples
+mes
+mesHexbyte.
Parse a hexbyte.
Source
Examples
+nix
+nixLetters and underscore.
Parse Letters and _.
Source
Examples
+nud
+nudNumeric.
Parse a numeric character - A number.
Source
Examples
+prn
+prnPrintable character.
Parse any printable character.
Source
Examples
+qat
+qatChars in blockcord.
Parse a single character contained in a multi-line cord block.
Source
Examples
+qit
+qitChars in cord.
Parse an individual character to its cord $atom representation. Escaped characters are converted to the value they represent.
Source
Examples
+qut
+qutCord.
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
+sozDelimiting '''.
Parse a triple-single quote, used for multiline strings.
Source
Examples
+sym
+symTerm.
A term: a lowercase letter, followed by letters, numbers, or -.
Source
Examples
+mixed-case-symbol
+mixed-case-symbolMixed-case term.
The same as +sym but allowing uppercase letters.
Source
Examples
+ven
+ven+>- axis syntax.
Axis syntax parser
Source
Examples
+vit
+vitBase64 digit.
Parse a standard base64 digit.
Source
Examples
+vul
+vulComments to null.
Parse comments and produce a null. Note that a comment must be ended with a newline character.
Source
Examples
Last updated