on b00decd help sign in
962 lines 12 kB history raw
1+++
2title = "4h: Parsing (ASCII Glyphs)"
3weight = 35
4template = "doc.html"
5+++
7### `++ace`
9Parse space
11Parses ASCII character 32, space.
13#### Source
15```hoon
16 ++ ace (just ' ')
17```
19#### Examples
21```
22 > (scan " " ace)
23 ~~.
25 > `cord`
26 (scan " " ace)
27 ' '
29 > (ace [[1 1] " "])
30 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]]
32 > (ace [[1 1] " abc "])
33 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]]
34```
37---
38### `++bar`
40Parse vertical bar
42Parses ASCII character 124, the vertical bar.
44#### Source
46```hoon
47 ++ bar (just '|')
48```
50#### Examples
52```
53 > (scan "|" bar)
54 ~~~7c.
56 > `cord`(scan "|" bar)
57 '|'
59 > (bar [[1 1] "|"])
60 [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]]
62 > (bar [[1 1] "|="])
63 [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]]
64```
67---
68### `++bas`
70Parse backslash
72Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
73`bas` with [`++just`](/docs/hoon/reference/stdlib/4f) is to escape the escape
74character, `\`.
76#### Source
78```hoon
79 ++ bas (just '\\')
80```
82#### Examples
84```
85 > (scan "\\" bas)
86 ~~~5c.
88 > `cord`(scan "\\" bas)
89 '\'
91 > (bas [[1 1] "\"])
92 ~ <syntax error at [1 18]>
94 > (bas [[1 1] "\\"])
95 [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]]
97 > (bas [[1 1] "\""])
98 [p=[p=1 q=1] q=~]
99```
102---
103### `++buc`
105Parse dollar sign
107Parses ASCII character 36, the dollar sign.
109#### Source
111```hoon
112 ++ buc (just '$')
113```
115#### Examples
117```
118 > (scan "$" buc)
119 ~~~24.
121 > `cord`(scan "$" buc)
122 '$'
124 > (buc [[1 1] "$"])
125 [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]]
127 > (buc [[1 1] "$%"])
128 [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]]
129```
132---
133### `++cab`
135Parse underscore
137Parses ASCII character 95, the underscore.
139#### Source
141```hoon
142 ++ cab (just '_')
143```
145#### Examples
147```
148 > (scan "_" cab)
149 ~~~5f.
151 > `cord`(scan "_" cab)
152 '_'
154 > (cab [[1 1] "_"])
155 [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]]
157 > (cab [[1 1] "|_"])
158 [p=[p=1 q=1] q=~]
159```
162---
163### `++cen`
165Parses percent sign
167Parses ASCII character 37, the percent sign.
169#### Source
171```hoon
172 ++ cen (just '%')
173```
175#### Examples
177```
178 > (scan "%" cen)
179 ~~~25.
181 > `cord`(scan "%" cen)
182 '%'
184 > (cen [[1 1] "%"])
185 [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]]
187 > (cen [[1 1] "%^"])
188 [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]]
189```
192---
193### `++col`
195Parse colon
197Parses ASCII character 58, the colon
199#### Source
201```hoon
202 ++ col (just ':')
203```
205#### Examples
207```
208 > (scan ":" col)
209 ~~~3a.
211 > `cord`(scan ":" col)
212 ':'
214 > (col [[1 1] ":"])
215 [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]]
217 > (col [[1 1] ":-"])
218 [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]]
219```
221---
222### `++com`
224Parse comma
226Parses ASCII character 44, the comma.
228#### Source
230```hoon
231 ++ com (just ',')
232```
234#### Examples
236```
237 > (scan "," com)
238 ~~~2c.
240 > `cord`(scan "," com)
241 ','
243 > (com [[1 1] ","])
244 [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
246 > (com [[1 1] "not com"])
247 [p=[p=1 q=1] q=~]
248```
251---
252### `++doq`
254Parse double quote
256Parses ASCII character 34, the double quote.
258#### Source
260```hoon
261 ++ doq (just '"')
262```
264#### Examples
266```
267 > (scan "\"" doq)
268 ~~~22.
270 > `cord`(scan "\"" doq)
271 '"'
273 > (doq [[1 1] "\""])
274 [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
276 > (doq [[1 1] "not successfully parsed"])
277 [p=[p=1 q=1] q=~]
279 > (scan "see?" doq)
280 ! {1 1}
281 ! 'syntax-error'
282 ! exit
283```
286---
287### `++dot`
289Parse period
291Parses ASCII character 46, the period.
293#### Source
295```hoon
296 ++ dot (just '.')
297```
299#### Examples
301```
302 > (scan "." dot)
303 ~~~.
305 > `cord`(scan "." dot)
306 '.'
308 > (dot [[1 1] "."])
309 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
311 > (dot [[1 1] ".^"])
312 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
313```
316---
317### `++fas`
319Parse forward slash
321Parses ASCII character 47, the forward slash.
323#### Source
325```hoon
326 ++ fas (just '/')
327```
329#### Examples
331```
332 > (scan "/" fas)
333 '/'
335 > (fas [[1 1] "/"])
336 [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
338 > (fas [[1 1] "|/"])
339 [p=[p=1 q=1] q=~]
340```
343---
344### `++gal`
346Parse less-than sign
348Parses ASCII character 60, the less-than sign.
350#### Source
352```hoon
353 ++ gal (just '<')
354```
356#### Examples
358```
359 > (scan "<" gal)
360 '<'
362 > (gal [[1 1] "<"])
363 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
365 > (gal [[1 1] "<+"])
366 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
368 > (gal [[1 1] "+<"])
369 [p=[p=1 q=1] q=~]
370```
373---
374### `++gar`
376Parse greater-than sign
378Parses ASCII character 62, the greater-than sign.
380#### Source
382```hoon
383 ++ gar (just '>')
384```
386#### Examples
388```
389 > (scan ">" gar)
390 ~~~3e.
392 > `cord`(scan ">" gar)
393 '>'
395 > (gar [[1 1] ">"])
396 [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
398 > (gar [[1 1] "=>"])
399 [p=[p=1 q=1] q=~]
400```
403---
404### `++hax`
406Parse number sign
408Parses ASCII character 35, the number sign.
410#### Source
412```hoon
413 ++ hax (just '#')
414```
416#### Examples
418```
419 > (scan "#" hax)
420 '#'
422 > (hax [[1 1] "#"])
423 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
425 > (hax [[1 1] "#!"])
426 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
427```
430---
431### `++hep`
433Parse hyphen
435Parses ASCII character 45, the hyphen.
437#### Source
439```hoon
440 ++ hep (just '-')
441```
443#### Examples
445```
446 > (scan "-" hep)
447 '-'
449 > (hep [[1 1] "-"])
450 [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
452 > (hep [[1 1] ":-"])
453 [p=[p=1 q=1] q=~]
454```
457---
458### `++kel`
460Parse left curley bracket
462Parses ASCII character 123, the left curly bracket. Note that `{`
463(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
464interpolation. To parse either of them, they must be escaped.
466#### Source
468```hoon
469 ++ kel (just '{')
470```
472#### Examples
474```
475 > (scan "\{" kel)
476 '{'
478 > (kel [[1 1] "\{"])
479 [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
481 > (kel [[1 1] " \{"])
482 [p=[p=1 q=1] q=~]
483```
486---
487### `++ker`
489Parse right curley bracket
491Parses ASCII character 125, the right curly bracket. Note that `{`
492(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
493interpolation. To parse either of them, they must be escaped.
495#### Source
497```hoon
498 ++ ker (just '}')
499```
501#### Examples
503```
504 > (scan "}" ker)
505 '}'
507 > (ker [[1 1] "}"])
508 [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
510 > (ker [[1 1] "\{}"])
511 [p=[p=1 q=1] q=~]
512```
515---
516### `++ket`
518Parse caret
520Parses ASCII character 94, the caret.
522#### Source
524```hoon
525 ++ ket (just '^')
526```
528#### Examples
530```
531 > (scan "^" ket)
532 '^'
534 > (ket [[1 1] "^"])
535 [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
537 > (ket [[1 1] ".^"])
538 [p=[p=1 q=1] q=~]
539```
541---
542### `++lus`
544Parse plus sign
546Parses ASCII character 43, the plus sign.
548#### Source
550```hoon
551 ++ lus (just '+')
552```
554#### Examples
556```
557 > (scan "+" lus)
558 ~~~2b.
560 > `cord`(scan "+" lus)
561 '+'
563 > (lus [[1 1] "+"])
564 [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
566 > (lus [[1 1] ".+"])
567 [p=[p=1 q=1] q=~]
568```
571---
572### `++pam`
574Parse ampersand
576Parses ASCII character 38, the ampersand.
578#### Source
580```hoon
581 ++ pam (just '&')
582```
584#### Examples
586```
587 > (scan "&" pam)
588 ~~~26.
590 > `cord`(scan "&" pam)
591 '&'
593 > (pam [[1 1] "&"])
594 [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
596 > (pam [[1 1] "?&"])
597 [p=[p=1 q=1] q=~]
598```
601---
602### `++pat`
604Parse "at" sign
606Parses ASCII character 64, the "at" sign.
608#### Source
610```hoon
611 ++ pat (just '@')
612```
614#### Examples
616```
617 > (scan "@" pat)
618 ~~~4.
620 > `cord`(scan "@" pat)
621 '@'
623 > (pat [[1 1] "@"])
624 [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
626 > (pat [[1 1] "?@"])
627 [p=[p=1 q=1] q=~]
628```
631---
632### `++pel`
634Parse left parenthesis
636Parses ASCII character 40, the left parenthesis.
638#### Source
640```hoon
641 ++ pel (just '(')
642```
644#### Examples
646```
647 > (scan "(" pel)
648 '('
650 > (pel [[1 1] "("])
651 [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
653 > (pel [[1 1] ";("])
654 [p=[p=1 q=1] q=~]
655```
658---
659### `++per`
661Parse right parenthesis
663Parses ASCII character 41, the right parenthesis.
665#### Source
667```hoon
668 ++ per (just ')')
669```
671#### Examples
673```
674 > (scan ")" per)
675 ')'
677 > (per [[1 1] ")"])
678 [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
680 > (per [[1 1] " )"])
681 [p=[p=1 q=1] q=~]
682```
685---
686### `++sel`
688Parse left square bracket
690Parses ASCII character 91, the left square bracket.
692#### Source
694```hoon
695 ++ sel (just '[')
696```
698#### Examples
700```
701 > (scan "[" sel)
702 '['
704 > (sel [[1 1] "["])
705 [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
707 > (sel [[1 1] "-["])
708 [p=[p=1 q=1] q=~]
709```
712---
713### `++sem`
715Parse semicolon
717Parses ASCII character 59, the semicolon.
719#### Source
721```hoon
722 ++ sem (just ';')
723```
725#### Examples
727```
728 > (scan ";" sem)
729 ';'
731 > (sem [[1 1] ";"])
732 [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
734 > (sem [[1 1] " ;"])
735 [p=[p=1 q=1] q=~]
736```
739---
740### `++ser`
742Parse right square bracket
744Parses ASCII character 93, the right square bracket.
746#### Source
748```hoon
749 ++ ser (just ']')
750```
752#### Examples
754```
755 > (scan "]" ser)
756 ']'
758 > (ser [[1 1] "]"])
759 [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
761 > (ser [[1 1] "[ ]"])
762 [p=[p=1 q=1] q=~]
763```
766---
767### `++sig`
769Parse tilde
771Parses ASCII character 126, the tilde.
773#### Source
775```hoon
776 ++ sig (just '~')
777```
779#### Examples
781```
782 > (scan "~" sig)
783 '~'
785 > (sig [[1 1] "~"])
786 [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
788 > (sig [[1 1] "?~"])
789 [p=[p=1 q=1] q=~]
790```
793---
794### `++soq`
796Parse single quote
798Parses ASCII character 39, soq. Note the extra '' is to escape the first
799`soq` because soq delimits a `++cord`.
801#### Source
803```hoon
804 ++ soq (just '\'')
805```
807#### Examples
809```
810 > (scan "'" soq)
811 '\''
813 > (soq [[1 1] "'"])
814 [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
816 > (soq [[1 1] ">'"])
817 [p=[p=1 q=1] q=~]
818```
821---
822### `++tar`
824Parse asterisk
826Parses ASCII character 42, the asterisk.
828#### Source
830```hoon
831 ++ tar (just '*')
832```
834#### Examples
836```
837 > (scan "*" tar)
838 ~~~2a.
840 > `cord`(scan "*" tar)
841 '*'
843 > (tar [[1 1] "*"])
844 [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
846 > (tar [[1 1] ".*"])
847 [p=[p=1 q=1] q=~]
848```
851---
852### `++tec`
854Parse backtick
856Parses ASCII character 96, the backtick (also known as the "grave
857accent").
859#### Source
861```hoon
862 ++ tec (just '`') :: backTiCk
863```
865#### Examples
867```
868 > (scan "`" tec)
869 ~~~6.
871 > `cord`(scan "`" tec)
872 '`'
874 > (tec [[1 1] "`"])
875 [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
877 > (tec [[1 1] " `"])
878 [p=[p=1 q=1] q=~]
879```
882---
883### `++tis`
885Parse equals sign
887Parses ASCII character 61, the equals sign.
889#### Source
891```hoon
892 ++ tis (just '=')
893```
895#### Examples
897```
898 > (scan "=" tis)
899 '='
901 > (tis [[1 1] "="])
902 [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
904 > (tis [[1 1] "|="])
905 [p=[p=1 q=1] q=~]
906```
908---
909### `++wut`
911Parses question mark
913Parses ASCII character 63, the question mark.
915#### Source
917```hoon
918 ++ wut (just '?')
919```
921#### Examples
923```
924 > (scan "?" wut)
925 '?'
927 > (wut [[1 1] "?"])
928 [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
930 > (wut [[1 1] ".?"])
931 [p=[p=1 q=1] q=~]
932```
935---
936### `++zap`
938Exclamation point
940Parses ASCII character 33, the exclamation point zap.
942#### Source
944```hoon
945 ++ zap (just '!')
946```
948#### Examples
950```
951 > (scan "!" zap)
952 '!'
954 > (zap [[1 1] "!"])
955 [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
957 > (zap [[1 1] "?!"])
958 [p=[p=1 q=1] q=~]
959```
962---