String escapes

This commit is contained in:
iko 2024-07-26 03:33:28 +03:00
parent acad1c1497
commit fcef505df2
Signed by untrusted user: iko
GPG Key ID: 82C257048D1026F2
2 changed files with 42 additions and 3 deletions

View File

@ -3,5 +3,4 @@
- [x] functioncall
- [ ] any string apart from the basic string with no escapes
- [ ] check if int fits in int or make it a float
- [ ] strip out comments before parsing
- [ ] should `print-blok` have `do`-`end`? This is fucked.

View File

@ -118,7 +118,47 @@ apex
|* closing=rule
;~ pfix
(punt nl)
%- star ;~(less closing next)
%- star
;~ less closing
;~ pose
%+ cold '\07' (jest '\\a')
%+ cold '\08' (jest '\\b')
%+ cold '\0c' (jest '\\f')
%+ cold '\0a' (jest '\\n')
%+ cold '\0d' (jest '\\r')
%+ cold '\09' (jest '\\t')
%+ cold '\0b' (jest '\\v')
%+ cold '\\' (jest '\\\\')
%+ cold '"' (jest '\\"')
%+ cold '\'' (jest '\\\'')
%+ cold '\0a' (jest '\\\0a')
%+ cold '' ;~(pose (jest '\\z') (plus gaw))
::
;~ pfix
(jest '\\x')
;< hex-digits=tape bind ;~(plug next next (easy ~))
=/ digit=(unit @) (rust hex-digits hex)
?~ digit fail (easy `@t`u.digit)
==
::
;~ pfix
(jest '\\')
;< digits=tape bind (stun [1 3] (shim '0' '9'))
=/ digit=(unit @) (rust digits dem)
?~ digit fail (easy `@t`u.digit)
==
::
%+ cook
|= [* point=@ *] `@t`point
;~ plug
(jest '\\u{')
hex
(just '}')
==
::
next
==
==
==
==
++ parse-table
@ -820,7 +860,7 @@ apex
|* [=term gar=mold sef=rule]
|= tub=nail
^- (like gar)
=/ trace &
=/ trace |
~? trace [p.p.tub term `tape`(scag 40 q.tub)]
=/ res (sef tub)
?. trace res