mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
More ostap
This commit is contained in:
parent
f1f3c8aff0
commit
9163747ff3
7 changed files with 175 additions and 145 deletions
5
stdlib/regression/orig/test09.log
Normal file
5
stdlib/regression/orig/test09.log
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Parsing a*| against "aa"... Succ ({"a", "a"})
|
||||
Parsing a+| against "aa"... Succ ({"a", "a"})
|
||||
Parsing list(a)| against "a"... Succ ({"a"})
|
||||
Parsing list(a)| against "a,a"... Succ ({"a", "a"})
|
||||
Parsing list0(a)| against ""... Succ (0)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import Matcher;
|
||||
|
||||
local m = matcherInit (" -- asdasdakm ,m.,msd .,m.,asd\n \n\n abc");
|
||||
local m = initMatcher (" -- asdasdakm ,m.,msd .,m.,asd\n \n\n abc");
|
||||
|
||||
local
|
||||
lident = createRegexp ("[a-z][a-zA-Z_]*", "lowercase identifier"),
|
||||
|
|
@ -29,7 +29,7 @@ fun const (m) {
|
|||
infixl @ before * (p, f) {
|
||||
fun (m) {
|
||||
case p (m) of
|
||||
Succ (m, x) -> Succ (m, f (x))
|
||||
Succ (x, m) -> Succ (f (x), m)
|
||||
| err -> err
|
||||
esac
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ infixl @ before * (p, f) {
|
|||
infixr |> after !! (l, r) {
|
||||
fun (m) {
|
||||
case l (m) of
|
||||
Succ (m, s) -> r (s) (m)
|
||||
Succ (s, m) -> r (s) (m)
|
||||
| err -> err
|
||||
esac
|
||||
}
|
||||
|
|
@ -56,4 +56,4 @@ infixr || after |> (l, r) {
|
|||
local expr = lid @ fun (s) {Lid (s)} || const @ fun (s) {Dec (s)},
|
||||
assn = lid |> fun (id) {token (":=") |> fun (s) {expr @ fun (e) {Assn (id, e)}}};
|
||||
|
||||
printf ("%s\n", case assn (matcherInit ("x:=3")) of Fail (err) -> err | Succ (_, s) -> s.string esac)
|
||||
printf ("%s\n", case assn (initMatcher ("x:=3")) of Fail (err) -> err | Succ (s, _) -> s.string esac)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue