Do fast special cases for +slaw instead of always calling +slay.

+slay is a giant, recursive, slow parser combinator. +slaw is called
on every beam handling. In actual usage, we can special case based
on the passed in type and use a much smaller parser.
This commit is contained in:
Elliot Glaysher 2018-12-03 16:41:30 -08:00
parent 5da58f862c
commit 770025c155

View File

@ -5944,8 +5944,24 @@
~/ %slaw
|= {mod/@tas txt/@ta}
^- (unit @)
=+ con=(slay txt)
?.(&(?=({~ $$ @ @} con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
?+ mod
:: slow fallback case to the full slay
::
=+ con=(slay txt)
?.(&(?=({~ $$ @ @} con) =(p.p.u.con mod)) ~ [~ q.p.u.con])
::
%p
(rust (trip txt) ;~(pfix sig fed:ag))
::
%ud
(rust (trip txt) dem:ag)
::
%ux
(rust (trip txt) ;~(pfix (jest '0x') hex:ag))
::
%tas
(rust (trip txt) sym)
==
::
++ slay
|= txt/@ta ^- (unit coin)