on bbd4189 help sign in
964 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```
36---
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```
66---
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```
101---
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```
131---
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```
161---
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```
191---
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---
223## `++com`
225Parse comma
227Parses ASCII character 44, the comma.
229#### Source
231```hoon
232 ++ com (just ',')
233```
235#### Examples
237```
238 > (scan "," com)
239 ~~~2c.
241 > `cord`(scan "," com)
242 ','
244 > (com [[1 1] ","])
245 [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
247 > (com [[1 1] "not com"])
248 [p=[p=1 q=1] q=~]
249```
251---
253## `++doq`
255Parse double quote
257Parses ASCII character 34, the double quote.
259#### Source
261```hoon
262 ++ doq (just '"')
263```
265#### Examples
267```
268 > (scan "\"" doq)
269 ~~~22.
271 > `cord`(scan "\"" doq)
272 '"'
274 > (doq [[1 1] "\""])
275 [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
277 > (doq [[1 1] "not successfully parsed"])
278 [p=[p=1 q=1] q=~]
280 > (scan "see?" doq)
281 ! {1 1}
282 ! 'syntax-error'
283 ! exit
284```
286---
288## `++dot`
290Parse period
292Parses ASCII character 46, the period.
294#### Source
296```hoon
297 ++ dot (just '.')
298```
300#### Examples
302```
303 > (scan "." dot)
304 ~~~.
306 > `cord`(scan "." dot)
307 '.'
309 > (dot [[1 1] "."])
310 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
312 > (dot [[1 1] ".^"])
313 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
314```
316---
318## `++fas`
320Parse forward slash
322Parses ASCII character 47, the forward slash.
324#### Source
326```hoon
327 ++ fas (just '/')
328```
330#### Examples
332```
333 > (scan "/" fas)
334 '/'
336 > (fas [[1 1] "/"])
337 [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
339 > (fas [[1 1] "|/"])
340 [p=[p=1 q=1] q=~]
341```
343---
345## `++gal`
347Parse less-than sign
349Parses ASCII character 60, the less-than sign.
351#### Source
353```hoon
354 ++ gal (just '<')
355```
357#### Examples
359```
360 > (scan "<" gal)
361 '<'
363 > (gal [[1 1] "<"])
364 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
366 > (gal [[1 1] "<+"])
367 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
369 > (gal [[1 1] "+<"])
370 [p=[p=1 q=1] q=~]
371```
373---
375## `++gar`
377Parse greater-than sign
379Parses ASCII character 62, the greater-than sign.
381#### Source
383```hoon
384 ++ gar (just '>')
385```
387#### Examples
389```
390 > (scan ">" gar)
391 ~~~3e.
393 > `cord`(scan ">" gar)
394 '>'
396 > (gar [[1 1] ">"])
397 [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
399 > (gar [[1 1] "=>"])
400 [p=[p=1 q=1] q=~]
401```
403---
405## `++hax`
407Parse number sign
409Parses ASCII character 35, the number sign.
411#### Source
413```hoon
414 ++ hax (just '#')
415```
417#### Examples
419```
420 > (scan "#" hax)
421 '#'
423 > (hax [[1 1] "#"])
424 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
426 > (hax [[1 1] "#!"])
427 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
428```
430---
432## `++hep`
434Parse hyphen
436Parses ASCII character 45, the hyphen.
438#### Source
440```hoon
441 ++ hep (just '-')
442```
444#### Examples
446```
447 > (scan "-" hep)
448 '-'
450 > (hep [[1 1] "-"])
451 [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
453 > (hep [[1 1] ":-"])
454 [p=[p=1 q=1] q=~]
455```
457---
459## `++kel`
461Parse left curley bracket
463Parses ASCII character 123, the left curly bracket. Note that `{`
464(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
465interpolation. To parse either of them, they must be escaped.
467#### Source
469```hoon
470 ++ kel (just '{')
471```
473#### Examples
475```
476 > (scan "\{" kel)
477 '{'
479 > (kel [[1 1] "\{"])
480 [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
482 > (kel [[1 1] " \{"])
483 [p=[p=1 q=1] q=~]
484```
486---
488## `++ker`
490Parse right curley bracket
492Parses ASCII character 125, the right curly bracket. Note that `{`
493(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
494interpolation. To parse either of them, they must be escaped.
496#### Source
498```hoon
499 ++ ker (just '}')
500```
502#### Examples
504```
505 > (scan "}" ker)
506 '}'
508 > (ker [[1 1] "}"])
509 [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
511 > (ker [[1 1] "\{}"])
512 [p=[p=1 q=1] q=~]
513```
515---
517## `++ket`
519Parse caret
521Parses ASCII character 94, the caret.
523#### Source
525```hoon
526 ++ ket (just '^')
527```
529#### Examples
531```
532 > (scan "^" ket)
533 '^'
535 > (ket [[1 1] "^"])
536 [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
538 > (ket [[1 1] ".^"])
539 [p=[p=1 q=1] q=~]
540```
542---
544## `++lus`
546Parse plus sign
548Parses ASCII character 43, the plus sign.
550#### Source
552```hoon
553 ++ lus (just '+')
554```
556#### Examples
558```
559 > (scan "+" lus)
560 ~~~2b.
562 > `cord`(scan "+" lus)
563 '+'
565 > (lus [[1 1] "+"])
566 [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
568 > (lus [[1 1] ".+"])
569 [p=[p=1 q=1] q=~]
570```
572---
574## `++pam`
576Parse ampersand
578Parses ASCII character 38, the ampersand.
580#### Source
582```hoon
583 ++ pam (just '&')
584```
586#### Examples
588```
589 > (scan "&" pam)
590 ~~~26.
592 > `cord`(scan "&" pam)
593 '&'
595 > (pam [[1 1] "&"])
596 [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
598 > (pam [[1 1] "?&"])
599 [p=[p=1 q=1] q=~]
600```
602---
604## `++pat`
606Parse "at" sign
608Parses ASCII character 64, the "at" sign.
610#### Source
612```hoon
613 ++ pat (just '@')
614```
616#### Examples
618```
619 > (scan "@" pat)
620 ~~~4.
622 > `cord`(scan "@" pat)
623 '@'
625 > (pat [[1 1] "@"])
626 [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
628 > (pat [[1 1] "?@"])
629 [p=[p=1 q=1] q=~]
630```
632---
634## `++pel`
636Parse left parenthesis
638Parses ASCII character 40, the left parenthesis.
640#### Source
642```hoon
643 ++ pel (just '(')
644```
646#### Examples
648```
649 > (scan "(" pel)
650 '('
652 > (pel [[1 1] "("])
653 [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
655 > (pel [[1 1] ";("])
656 [p=[p=1 q=1] q=~]
657```
659---
661## `++per`
663Parse right parenthesis
665Parses ASCII character 41, the right parenthesis.
667#### Source
669```hoon
670 ++ per (just ')')
671```
673#### Examples
675```
676 > (scan ")" per)
677 ')'
679 > (per [[1 1] ")"])
680 [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
682 > (per [[1 1] " )"])
683 [p=[p=1 q=1] q=~]
684```
686---
688## `++sel`
690Parse left square bracket
692Parses ASCII character 91, the left square bracket.
694#### Source
696```hoon
697 ++ sel (just '[')
698```
700#### Examples
702```
703 > (scan "[" sel)
704 '['
706 > (sel [[1 1] "["])
707 [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
709 > (sel [[1 1] "-["])
710 [p=[p=1 q=1] q=~]
711```
713---
715## `++sem`
717Parse semicolon
719Parses ASCII character 59, the semicolon.
721#### Source
723```hoon
724 ++ sem (just ';')
725```
727#### Examples
729```
730 > (scan ";" sem)
731 ';'
733 > (sem [[1 1] ";"])
734 [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
736 > (sem [[1 1] " ;"])
737 [p=[p=1 q=1] q=~]
738```
740---
742## `++ser`
744Parse right square bracket
746Parses ASCII character 93, the right square bracket.
748#### Source
750```hoon
751 ++ ser (just ']')
752```
754#### Examples
756```
757 > (scan "]" ser)
758 ']'
760 > (ser [[1 1] "]"])
761 [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
763 > (ser [[1 1] "[ ]"])
764 [p=[p=1 q=1] q=~]
765```
767---
769## `++sig`
771Parse tilde
773Parses ASCII character 126, the tilde.
775#### Source
777```hoon
778 ++ sig (just '~')
779```
781#### Examples
783```
784 > (scan "~" sig)
785 '~'
787 > (sig [[1 1] "~"])
788 [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
790 > (sig [[1 1] "?~"])
791 [p=[p=1 q=1] q=~]
792```
794---
796## `++soq`
798Parse single quote
800Parses ASCII character 39, soq. Note the extra '' is to escape the first
801`soq` because soq delimits a `++cord`.
803#### Source
805```hoon
806 ++ soq (just '\'')
807```
809#### Examples
811```
812 > (scan "'" soq)
813 '\''
815 > (soq [[1 1] "'"])
816 [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
818 > (soq [[1 1] ">'"])
819 [p=[p=1 q=1] q=~]
820```
822---
824## `++tar`
826Parse asterisk
828Parses ASCII character 42, the asterisk.
830#### Source
832```hoon
833 ++ tar (just '*')
834```
836#### Examples
838```
839 > (scan "*" tar)
840 ~~~2a.
842 > `cord`(scan "*" tar)
843 '*'
845 > (tar [[1 1] "*"])
846 [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
848 > (tar [[1 1] ".*"])
849 [p=[p=1 q=1] q=~]
850```
852---
854## `++tec`
856Parse backtick
858Parses ASCII character 96, the backtick (also known as the "grave
859accent").
861#### Source
863```hoon
864 ++ tec (just '`') :: backTiCk
865```
867#### Examples
869```
870 > (scan "`" tec)
871 ~~~6.
873 > `cord`(scan "`" tec)
874 '`'
876 > (tec [[1 1] "`"])
877 [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
879 > (tec [[1 1] " `"])
880 [p=[p=1 q=1] q=~]
881```
883---
885## `++tis`
887Parse equals sign
889Parses ASCII character 61, the equals sign.
891#### Source
893```hoon
894 ++ tis (just '=')
895```
897#### Examples
899```
900 > (scan "=" tis)
901 '='
903 > (tis [[1 1] "="])
904 [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
906 > (tis [[1 1] "|="])
907 [p=[p=1 q=1] q=~]
908```
910---
912## `++wut`
914Parses question mark
916Parses ASCII character 63, the question mark.
918#### Source
920```hoon
921 ++ wut (just '?')
922```
924#### Examples
926```
927 > (scan "?" wut)
928 '?'
930 > (wut [[1 1] "?"])
931 [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
933 > (wut [[1 1] ".?"])
934 [p=[p=1 q=1] q=~]
935```
937---
939## `++zap`
941Exclamation point
943Parses ASCII character 33, the exclamation point zap.
945#### Source
947```hoon
948 ++ zap (just '!')
949```
951#### Examples
953```
954 > (scan "!" zap)
955 '!'
957 > (zap [[1 1] "!"])
958 [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
960 > (zap [[1 1] "?!"])
961 [p=[p=1 q=1] q=~]
962```
964---