tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

parserControl.tri (1467B)


      1 !import prelude *
      2 !export *
      3 
      4 -- Test-only supplied-parser probes. All subjects arrive as arguments, so the
      5 -- wrapper's construction cannot run (or accidentally replace) their code.
      6 reply status value rest consumed committed = pair status (pair value (pair rest (pair consumed committed)))
      7 diagnostic = pair 7 (pair t (pair t (pair t t)))
      8 one [1 | rest] = reply true 1 rest true false
      9 one input = reply false diagnostic input false false
     10 zero input = reply true 9 input false false
     11 commit input = reply true t input false true
     12 failed input = reply false diagnostic input true false
     13 committed input = reply false diagnostic input false true
     14 oneCommitted [1 | rest] = reply true 1 rest true true
     15 oneCommitted input = reply false diagnostic input false false
     16 selected 0 = one
     17 selected 1 = zero
     18 selected 2 = commit
     19 selected 3 = failed
     20 selected 4 = committed
     21 selected _ = oneCommitted
     22 
     23 many function mode input = function (selected mode) input
     24 sequenced function first second input = function (selected first) (_ : selected second) input
     25 lexed function first second input = function (selected first) (selected second) input
     26 
     27 spin token = spin token
     28 ignoredFields function status = function (_ _ _ _ : 11) (_ _ _ _ : 22) (pair status (spin status))
     29 unselectedFailure function status = function (_ _ _ _ : spin status) (_ _ _ _ : 22) (pair status (spin status))
     30 unselectedSuccess function status = function (_ _ _ _ : 11) (_ _ _ _ : spin status) (pair status (spin status))