Jump to content

Compiler/Verifying syntax: Difference between revisions

→‎Generic PEG Library: def q: def box:
(→‎Generic PEG Library: Omit calls to trace)
(→‎Generic PEG Library: def q: def box:)
Line 699:
consume($re)
| .result = .result + [.match] ;
 
def q($s):
select(.remainder | startswith($s))
| .remainder |= .[$s | length :] ;
 
def literal($s):
consumeliteralq($s)
| .result += [$s];
 
Line 711 ⟶ 715:
# optional white space
def ws: consume("[ \n\r\t]*");
 
# Tagging
def box(E):
((.result = null) | E) as $e
| .remainder = $e.remainder
| .result += [$e.result] # the magic sauce
;
 
</syntaxhighlight>
 
2,502

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.