tricu

A lazy functional language based on Tree Calculus
Log | Files | Refs | README | LICENSE

lexer-demo.json (11522B)


      1 {
      2   "id": "lexer",
      3   "source": "!import 6aa33a710955e5746f322775b9078f57ba4145f6b723ff4b76a292285e919823 *\n!import 14282088469cc420dd014700da06998f6bb8dcf990fc885a464c0a1e1858e20d *\n!import 816df1a32853750a1254112aff8ae8c55ca86bf70e809d226969ab1d43a6688b *\n!import 7f87549d587fa8c3be88af0ea988db3adcc3b35f1ffb48973553491b075614db as N\n!export scanWord\n!export scanWhitespace\n\n-- Positioned prefix scans, not whole-input parsers. The remainder begins\n-- at the first nonmatching character. Positions count source characters,\n-- not UTF-8 bytes or display columns: only LF advances the line.\n-- Edit a predicate below and evaluate scanWord \"hello,world\" to compare.\n-- scanWhitespace accepts space, LF and tab, but deliberately not CR.\nreport reply = let\n  payload = parserReplyPayload reply\n  end = snd payload\n  in [\n    [\"matched\" 0 (fst payload)]\n    [\"remaining\" 0 (parserReplyRest reply)]\n    [\"line\" 1 (lexerPositionLine end)]\n    [\"column\" 1 (lexerPositionColumn end)]\n    [\"offset\" 1 (lexerPositionOffset end)]\n    [\"consumed\" 2 (parserReplyConsumed reply)]]\n\nscan predicate text = lexerScanWhile text lexerStart [] predicate (state character : pair character state)\n  |> lexerMapScan reverse\n  |> report\nscanWord text = scan (character : N.inRange character 97 122) text\nscanWhitespace text = scan (character : or? (equal? character 32)\n  (or? (equal? character 9) (equal? character 10))) text\n",
      4   "hash": "e756a481b3056a2e76f50316ccf77bfab8b15727b7bec899580c2eb919e668b2",
      5   "mode": "pure",
      6   "compilerSha256": "819ad1c86fbf2d6f86533439217146eb9ffd37ca7f95bb278063a28f0ab5b534",
      7   "sourceSha256": "2a441d6d881acd6e34cd0caa8179ee1afefbce68c2e5ff1e44fb1768f69eeb3c",
      8   "haskellCases": [
      9     {
     10       "export": "scanWord",
     11       "arguments": [
     12         "220202021020210210022102021020202102100220202102102021021002202021021020210210022102102102102021021002202021021020210022102102102021021021002210210210210202102100220210202021021021002202021021020210210022020210202021021000"
     13       ],
     14       "input": null,
     15       "terminal": "",
     16       "result": "222210202102102021021002210202020202102100220202102021021021002210210202020210210022020202102021021002210202102020210210022020210202021021000202220202021020210210022102021020202102100220202102102021021002202021021020210210022102102102102021021000022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020222020210210202100221021021020210210210022102102102102021021002202102020210210210022020210210202102100220202102020210210000222202021021020210210022102020210202102100220210210210202102100221020210202021021000221002210002222102102020202102100221021021021020210210022020210210202102100221020210202102102100221020210210202102100220210210210202102100022100220210210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210022102021000222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210021000"
     17     },
     18     {
     19       "export": "scanWord",
     20       "arguments": [
     21         "0"
     22       ],
     23       "input": null,
     24       "terminal": "",
     25       "result": "22221020210210202102100221020202020210210022020210202102102100221021020202021021002202020210202102100221020210202021021002202021020202102100020200222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202002222020210210202102100221020202102021021002202102102102021021002210202102020210210002210022100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002000"
     26     },
     27     {
     28       "export": "scanWord",
     29       "arguments": [
     30         "22020202102020210022102021020202102100220202102102021021002202021021020210210022102102102102021021000"
     31       ],
     32       "input": null,
     33       "terminal": "",
     34       "result": "222210202102102021021002210202020202102100220202102021021021002210210202020210210022020202102021021002210202102020210210022020210202021021000202002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002022202020210202021002210202102020210210022020210210202102100220202102102021021002210210210210202102100002222020210210202102100221020202102021021002202102102102021021002210202102020210210002210022100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002000"
     35     },
     36     {
     37       "export": "scanWord",
     38       "arguments": [
     39         "2210202020202102100220210202020210210022102102020202102100221020202102021021021000"
     40       ],
     41       "input": null,
     42       "terminal": "",
     43       "result": "2222102021021020210210022102020202021021002202021020210210210022102102020202102100220202021020210210022102021020202102100220202102020210210002022210202020202102100220210202020210210022102102020202102100002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002022210202021020210210210000222202021021020210210022102020210202102100220210210210202102100221020210202021021000221002210002222102102020202102100221021021021020210210022020210210202102100221020210202102102100221020210210202102100220210210210202102100022100220202100022221021021021020210210022021021020202102100220210210202021021002210210202021021021002210202102020210210022020210202102102100022100221021000222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210021000"
     44     },
     45     {
     46       "export": "scanWhitespace",
     47       "arguments": [
     48         "220202020202100220210202100221020202100221021021020210210210022102102102102021021002202102020210210210022020210202021021000"
     49       ],
     50       "input": null,
     51       "terminal": "",
     52       "result": "222210202102102021021002210202020202102100220202102021021021002210210202020210210022020202102021021002210202102020210210022020210202021021000202220202020202100220210202100221020202100002222021020202102102100221020210202021021002210202102102021021002210202020202102100221020202102021021002202102102102021021002210202021020210210022021021021020210210022102102102020210210002022210210210202102102100221021021021020210210022021020202102102100220202102020210210000222202021021020210210022102020210202102100220210210210202102100221020210202021021000221002202100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002202100022221021021021020210210022021021020202102100220210210202021021002210210202021021021002210202102020210210022020210202102102100022100221021000222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210021000"
     53     },
     54     {
     55       "export": "scanWhitespace",
     56       "arguments": [
     57         "2202102021002202102021002210202102020210210022021021021020210210022020210202021021000"
     58       ],
     59       "input": null,
     60       "terminal": "",
     61       "result": "22221020210210202102100221020202020210210022020210202102102100221021020202021021002202020210202102100221020210202021021002202021020202102100020222021020210022021020210000222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202221020210202021021002202102102102021021002202021020202102100002222020210210202102100221020202102021021002202102102102021021002210202102020210210002210022102100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210022021000222210210202020210210022102102102102021021002202102102102021021002210210202021021021002210202102021021021002210202102102021021002210202102020210210022020210202021021000220210021000"
     62     },
     63     {
     64       "export": "scanWhitespace",
     65       "arguments": [
     66         "2210202102100220210202100221021021020210210210022102102102102021021002202102020210210210022020210202021021000"
     67       ],
     68       "input": null,
     69       "terminal": "",
     70       "result": "22221020210210202102100221020202020210210022020210202102102100221021020202021021002202020210202102100221020210202021021002202021020202102100020200222202102020210210210022102021020202102100221020210210202102100221020202020210210022102020210202102100220210210210202102100221020202102021021002202102102102021021002210210210202021021000202221020210210022021020210022102102102021021021002210210210210202102100220210202021021021002202021020202102100002222020210210202102100221020202102021021002202102102102021021002210202102020210210002210022100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002000"
     71     },
     72     {
     73       "export": "scanWhitespace",
     74       "arguments": [
     75         "221020202102021021021000"
     76       ],
     77       "input": null,
     78       "terminal": "",
     79       "result": "2222102021021020210210022102020202021021002202021020210210210022102102020202102100220202021020210210022102021020202102100220202102020210210002020022220210202021021021002210202102020210210022102021021020210210022102020202021021002210202021020210210022021021021020210210022102020210202102100220210210210202102100221021021020202102100020222102020210202102102100002222020210210202102100221020202102021021002202102102102021021002210202102020210210002210022100022221021020202021021002210210210210202102100220202102102021021002210202102021021021002210202102102021021002202102102102021021000221002210002222102102102102021021002202102102020210210022021021020202102100221021020202102102100221020210202021021002202021020210210210002210020022221021020202021021002210210210210202102100220210210210202102100221021020202102102100221020210202102102100221020210210202102100221020210202021021002202021020202102100022021002000"
     80     }
     81   ]
     82 }