on b93c19b help sign in
961 lines 12 kB history raw
1+++
2title = "4h: Parsing (ASCII Glyphs)"
3weight = 35
4template = "doc.html"
5+++
6### `++ace`
8Parse space
10Parses ASCII character 32, space.
12#### Source
14```
15 ++ ace (just ' ')
16```
18#### Examples
20```
21 > (scan " " ace)
22 ~~.
24 > `cord`
25 (scan " " ace)
26 ' '
28 > (ace [[1 1] " "])
29 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q=""]]]]
31 > (ace [[1 1] " abc "])
32 [p=[p=1 q=2] q=[~ [p=~~. q=[p=[p=1 q=2] q="abc "]]]]
33```
36---
37### `++bar`
39Parse vertical bar
41Parses ASCII character 124, the vertical bar.
43#### Source
45```
46 ++ bar (just '|')
47```
49#### Examples
51```
52 > (scan "|" bar)
53 ~~~7c.
55 > `cord`(scan "|" bar)
56 '|'
58 > (bar [[1 1] "|"])
59 [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q=""]]]]
61 > (bar [[1 1] "|="])
62 [p=[p=1 q=2] q=[~ [p=~~~7c. q=[p=[p=1 q=2] q="="]]]]
63```
66---
67### `++bas`
69Parse backslash
71Parses ASCII character 92, the backslash. Note the extra `\` in the calling of
72`bas` with [`++just`](@/docs/reference/library/4f.md) is to escape the escape
73character, `\`.
75#### Source
77```
78 ++ bas (just '\\')
79```
81#### Examples
83```
84 > (scan "\\" bas)
85 ~~~5c.
87 > `cord`(scan "\\" bas)
88 '\'
90 > (bas [[1 1] "\"])
91 ~ <syntax error at [1 18]>
93 > (bas [[1 1] "\\"])
94 [p=[p=1 q=2] q=[~ [p=~~~5c. q=[p=[p=1 q=2] q=""]]]]
96 > (bas [[1 1] "\""])
97 [p=[p=1 q=1] q=~]
98```
101---
102### `++buc`
104Parse dollar sign
106Parses ASCII character 36, the dollar sign.
108#### Source
110```
111 ++ buc (just '$')
112```
114#### Examples
116```
117 > (scan "$" buc)
118 ~~~24.
120 > `cord`(scan "$" buc)
121 '$'
123 > (buc [[1 1] "$"])
124 [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q=""]]]]
126 > (buc [[1 1] "$%"])
127 [p=[p=1 q=2] q=[~ [p=~~~24. q=[p=[p=1 q=2] q="%"]]]]
128```
131---
132### `++cab`
134Parse underscore
136Parses ASCII character 95, the underscore.
138#### Source
140```
141 ++ cab (just '_')
142```
144#### Examples
146```
147 > (scan "_" cab)
148 ~~~5f.
150 > `cord`(scan "_" cab)
151 '_'
153 > (cab [[1 1] "_"])
154 [p=[p=1 q=2] q=[~ [p=~~~5f. q=[p=[p=1 q=2] q=""]]]]
156 > (cab [[1 1] "|_"])
157 [p=[p=1 q=1] q=~]
158```
161---
162### `++cen`
164Parses percent sign
166Parses ASCII character 37, the percent sign.
168#### Source
170```
171 ++ cen (just '%')
172```
174#### Examples
176```
177 > (scan "%" cen)
178 ~~~25.
180 > `cord`(scan "%" cen)
181 '%'
183 > (cen [[1 1] "%"])
184 [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q=""]]]]
186 > (cen [[1 1] "%^"])
187 [p=[p=1 q=2] q=[~ [p=~~~25. q=[p=[p=1 q=2] q="^"]]]]
188```
191---
192### `++col`
194Parse colon
196Parses ASCII character 58, the colon
198#### Source
200```
201 ++ col (just ':')
202```
204#### Examples
206```
207 > (scan ":" col)
208 ~~~3a.
210 > `cord`(scan ":" col)
211 ':'
213 > (col [[1 1] ":"])
214 [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q=""]]]]
216 > (col [[1 1] ":-"])
217 [p=[p=1 q=2] q=[~ [p=~~~3a. q=[p=[p=1 q=2] q="-"]]]]
218```
220---
221### `++com`
223Parse comma
225Parses ASCII character 44, the comma.
227#### Source
229```
230 ++ com (just ',')
231```
233#### Examples
235```
236 > (scan "," com)
237 ~~~2c.
239 > `cord`(scan "," com)
240 ','
242 > (com [[1 1] ","])
243 [p=[p=1 q=2] q=[~ [p=~~~2c. q=[p=[p=1 q=2] q=""]]]]
245 > (com [[1 1] "not com"])
246 [p=[p=1 q=1] q=~]
247```
250---
251### `++doq`
253Parse double quote
255Parses ASCII character 34, the double quote.
257#### Source
259```
260 ++ doq (just '"')
261```
263#### Examples
265```
266 > (scan "\"" doq)
267 ~~~22.
269 > `cord`(scan "\"" doq)
270 '"'
272 > (doq [[1 1] "\""])
273 [p=[p=1 q=2] q=[~ [p=~~~22. q=[p=[p=1 q=2] q=""]]]]
275 > (doq [[1 1] "not successfully parsed"])
276 [p=[p=1 q=1] q=~]
278 > (scan "see?" doq)
279 ! {1 1}
280 ! 'syntax-error'
281 ! exit
282```
285---
286### `++dot`
288Parse period
290Parses ASCII character 46, the period.
292#### Source
294```
295 ++ dot (just '.')
296```
298#### Examples
300```
301 > (scan "." dot)
302 ~~~.
304 > `cord`(scan "." dot)
305 '.'
307 > (dot [[1 1] "."])
308 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q=""]]]]
310 > (dot [[1 1] ".^"])
311 [p=[p=1 q=2] q=[~ [p=~~~. q=[p=[p=1 q=2] q="^"]]]]
312```
315---
316### `++fas`
318Parse forward slash
320Parses ASCII character 47, the forward slash.
322#### Source
324```
325 ++ fas (just '/')
326```
328#### Examples
330```
331 > (scan "/" fas)
332 '/'
334 > (fas [[1 1] "/"])
335 [p=[p=1 q=2] q=[~ [p=~~~2f. q=[p=[p=1 q=2] q=""]]]]
337 > (fas [[1 1] "|/"])
338 [p=[p=1 q=1] q=~]
339```
342---
343### `++gal`
345Parse less-than sign
347Parses ASCII character 60, the less-than sign.
349#### Source
351```
352 ++ gal (just '<')
353```
355#### Examples
357```
358 > (scan "<" gal)
359 '<'
361 > (gal [[1 1] "<"])
362 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q=""]]]]
364 > (gal [[1 1] "<+"])
365 [p=[p=1 q=2] q=[~ [p=~~~3c. q=[p=[p=1 q=2] q="+"]]]]
367 > (gal [[1 1] "+<"])
368 [p=[p=1 q=1] q=~]
369```
372---
373### `++gar`
375Parse greater-than sign
377Parses ASCII character 62, the greater-than sign.
379#### Source
381```
382 ++ gar (just '>')
383```
385#### Examples
387```
388 > (scan ">" gar)
389 ~~~3e.
391 > `cord`(scan ">" gar)
392 '>'
394 > (gar [[1 1] ">"])
395 [p=[p=1 q=2] q=[~ [p=~~~3e. q=[p=[p=1 q=2] q=""]]]]
397 > (gar [[1 1] "=>"])
398 [p=[p=1 q=1] q=~]
399```
402---
403### `++hax`
405Parse number sign
407Parses ASCII character 35, the number sign.
409#### Source
411```
412 ++ hax (just '#')
413```
415#### Examples
417```
418 > (scan "#" hax)
419 '#'
421 > (hax [[1 1] "#"])
422 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q=""]]]]
424 > (hax [[1 1] "#!"])
425 [p=[p=1 q=2] q=[~ [p=~~~23. q=[p=[p=1 q=2] q="!"]]]]
426```
429---
430### `++hep`
432Parse hyphen
434Parses ASCII character 45, the hyphen.
436#### Source
438```
439 ++ hep (just '-')
440```
442#### Examples
444```
445 > (scan "-" hep)
446 '-'
448 > (hep [[1 1] "-"])
449 [p=[p=1 q=2] q=[~ [p=~~- q=[p=[p=1 q=2] q=""]]]]
451 > (hep [[1 1] ":-"])
452 [p=[p=1 q=1] q=~]
453```
456---
457### `++kel`
459Parse left curley bracket
461Parses ASCII character 123, the left curly bracket. Note that `{`
462(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
463interpolation. To parse either of them, they must be escaped.
465#### Source
467```
468 ++ kel (just '{')
469```
471#### Examples
473```
474 > (scan "\{" kel)
475 '{'
477 > (kel [[1 1] "\{"])
478 [p=[p=1 q=2] q=[~ [p=~~~7b. q=[p=[p=1 q=2] q=""]]]]
480 > (kel [[1 1] " \{"])
481 [p=[p=1 q=1] q=~]
482```
485---
486### `++ker`
488Parse right curley bracket
490Parses ASCII character 125, the right curly bracket. Note that `{`
491(`kel`) and `}` (`ker`) open and close a Hoon expression for Hoon string
492interpolation. To parse either of them, they must be escaped.
494#### Source
496```
497 ++ ker (just '}')
498```
500#### Examples
502```
503 > (scan "}" ker)
504 '}'
506 > (ker [[1 1] "}"])
507 [p=[p=1 q=2] q=[~ [p=~~~7d. q=[p=[p=1 q=2] q=""]]]]
509 > (ker [[1 1] "\{}"])
510 [p=[p=1 q=1] q=~]
511```
514---
515### `++ket`
517Parse caret
519Parses ASCII character 94, the caret.
521#### Source
523```
524 ++ ket (just '^')
525```
527#### Examples
529```
530 > (scan "^" ket)
531 '^'
533 > (ket [[1 1] "^"])
534 [p=[p=1 q=2] q=[~ [p=~~~5e. q=[p=[p=1 q=2] q=""]]]]
536 > (ket [[1 1] ".^"])
537 [p=[p=1 q=1] q=~]
538```
540---
541### `++lus`
543Parse plus sign
545Parses ASCII character 43, the plus sign.
547#### Source
549```
550 ++ lus (just '+')
551```
553#### Examples
555```
556 > (scan "+" lus)
557 ~~~2b.
559 > `cord`(scan "+" lus)
560 '+'
562 > (lus [[1 1] "+"])
563 [p=[p=1 q=2] q=[~ [p=~~~2b. q=[p=[p=1 q=2] q=""]]]]
565 > (lus [[1 1] ".+"])
566 [p=[p=1 q=1] q=~]
567```
570---
571### `++pam`
573Parse ampersand
575Parses ASCII character 38, the ampersand.
577#### Source
579```
580 ++ pam (just '&')
581```
583#### Examples
585```
586 > (scan "&" pam)
587 ~~~26.
589 > `cord`(scan "&" pam)
590 '&'
592 > (pam [[1 1] "&"])
593 [p=[p=1 q=2] q=[~ [p=~~~26. q=[p=[p=1 q=2] q=""]]]]
595 > (pam [[1 1] "?&"])
596 [p=[p=1 q=1] q=~]
597```
600---
601### `++pat`
603Parse "at" sign
605Parses ASCII character 64, the "at" sign.
607#### Source
609```
610 ++ pat (just '@')
611```
613#### Examples
615```
616 > (scan "@" pat)
617 ~~~4.
619 > `cord`(scan "@" pat)
620 '@'
622 > (pat [[1 1] "@"])
623 [p=[p=1 q=2] q=[~ [p=~~~4. q=[p=[p=1 q=2] q=""]]]]
625 > (pat [[1 1] "?@"])
626 [p=[p=1 q=1] q=~]
627```
630---
631### `++pel`
633Parse left parenthesis
635Parses ASCII character 40, the left parenthesis.
637#### Source
639```
640 ++ pel (just '(')
641```
643#### Examples
645```
646 > (scan "(" pel)
647 '('
649 > (pel [[1 1] "("])
650 [p=[p=1 q=2] q=[~ [p=~~~28. q=[p=[p=1 q=2] q=""]]]]
652 > (pel [[1 1] ";("])
653 [p=[p=1 q=1] q=~]
654```
657---
658### `++per`
660Parse right parenthesis
662Parses ASCII character 41, the right parenthesis.
664#### Source
666```
667 ++ per (just ')')
668```
670#### Examples
672```
673 > (scan ")" per)
674 ')'
676 > (per [[1 1] ")"])
677 [p=[p=1 q=2] q=[~ [p=~~~29. q=[p=[p=1 q=2] q=""]]]]
679 > (per [[1 1] " )"])
680 [p=[p=1 q=1] q=~]
681```
684---
685### `++sel`
687Parse left square bracket
689Parses ASCII character 91, the left square bracket.
691#### Source
693```
694 ++ sel (just '[')
695```
697#### Examples
699```
700 > (scan "[" sel)
701 '['
703 > (sel [[1 1] "["])
704 [p=[p=1 q=2] q=[~ [p=~~~5b. q=[p=[p=1 q=2] q=""]]]]
706 > (sel [[1 1] "-["])
707 [p=[p=1 q=1] q=~]
708```
711---
712### `++sem`
714Parse semicolon
716Parses ASCII character 59, the semicolon.
718#### Source
720```
721 ++ sem (just ';')
722```
724#### Examples
726```
727 > (scan ";" sem)
728 ';'
730 > (sem [[1 1] ";"])
731 [p=[p=1 q=2] q=[~ [p=~~~3b. q=[p=[p=1 q=2] q=""]]]]
733 > (sem [[1 1] " ;"])
734 [p=[p=1 q=1] q=~]
735```
738---
739### `++ser`
741Parse right square bracket
743Parses ASCII character 93, the right square bracket.
745#### Source
747```
748 ++ ser (just ']')
749```
751#### Examples
753```
754 > (scan "]" ser)
755 ']'
757 > (ser [[1 1] "]"])
758 [p=[p=1 q=2] q=[~ [p=~~~5d. q=[p=[p=1 q=2] q=""]]]]
760 > (ser [[1 1] "[ ]"])
761 [p=[p=1 q=1] q=~]
762```
765---
766### `++sig`
768Parse tilde
770Parses ASCII character 126, the tilde.
772#### Source
774```
775 ++ sig (just '~')
776```
778#### Examples
780```
781 > (scan "~" sig)
782 '~'
784 > (sig [[1 1] "~"])
785 [p=[p=1 q=2] q=[~ [p=~~~~ q=[p=[p=1 q=2] q=""]]]]
787 > (sig [[1 1] "?~"])
788 [p=[p=1 q=1] q=~]
789```
792---
793### `++soq`
795Parse single quote
797Parses ASCII character 39, soq. Note the extra '' is to escape the first
798`soq` because soq delimits a `++cord`.
800#### Source
802```
803 ++ soq (just '\'')
804```
806#### Examples
808```
809 > (scan "'" soq)
810 '\''
812 > (soq [[1 1] "'"])
813 [p=[p=1 q=2] q=[~ [p=~~~27. q=[p=[p=1 q=2] q=""]]]]
815 > (soq [[1 1] ">'"])
816 [p=[p=1 q=1] q=~]
817```
820---
821### `++tar`
823Parse asterisk
825Parses ASCII character 42, the asterisk.
827#### Source
829```
830 ++ tar (just '*')
831```
833#### Examples
835```
836 > (scan "*" tar)
837 ~~~2a.
839 > `cord`(scan "*" tar)
840 '*'
842 > (tar [[1 1] "*"])
843 [p=[p=1 q=2] q=[~ [p=~~~2a. q=[p=[p=1 q=2] q=""]]]]
845 > (tar [[1 1] ".*"])
846 [p=[p=1 q=1] q=~]
847```
850---
851### `++tec`
853Parse backtick
855Parses ASCII character 96, the backtick (also known as the "grave
856accent").
858#### Source
860```
861 ++ tec (just '`') :: backTiCk
862```
864#### Examples
866```
867 > (scan "`" tec)
868 ~~~6.
870 > `cord`(scan "`" tec)
871 '`'
873 > (tec [[1 1] "`"])
874 [p=[p=1 q=2] q=[~ [p=~~~6. q=[p=[p=1 q=2] q=""]]]]
876 > (tec [[1 1] " `"])
877 [p=[p=1 q=1] q=~]
878```
881---
882### `++tis`
884Parse equals sign
886Parses ASCII character 61, the equals sign.
888#### Source
890```
891 ++ tis (just '=')
892```
894#### Examples
896```
897 > (scan "=" tis)
898 '='
900 > (tis [[1 1] "="])
901 [p=[p=1 q=2] q=[~ [p=~~~3d. q=[p=[p=1 q=2] q=""]]]]
903 > (tis [[1 1] "|="])
904 [p=[p=1 q=1] q=~]
905```
907---
908### `++wut`
910Parses question mark
912Parses ASCII character 63, the question mark.
914#### Source
916```
917 ++ wut (just '?')
918```
920#### Examples
922```
923 > (scan "?" wut)
924 '?'
926 > (wut [[1 1] "?"])
927 [p=[p=1 q=2] q=[~ [p=~~~3f. q=[p=[p=1 q=2] q=""]]]]
929 > (wut [[1 1] ".?"])
930 [p=[p=1 q=1] q=~]
931```
934---
935### `++zap`
937Exclamation point
939Parses ASCII character 33, the exclamation point zap.
941#### Source
943```
944 ++ zap (just '!')
945```
947#### Examples
949```
950 > (scan "!" zap)
951 '!'
953 > (zap [[1 1] "!"])
954 [p=[p=1 q=2] q=[~ [p=~~~21. q=[p=[p=1 q=2] q=""]]]]
956 > (zap [[1 1] "?!"])
957 [p=[p=1 q=1] q=~]
958```
961---