on master help sign in
Add an SML syntax test file.
commit88ea21b2762b3715d3816248953ed7f551cdaa7b authorDaniil Baturin <daniil@baturin.org> dateMon 5 Oct 2020, 01:18 (6 years ago) parent62397db
2 files changed+94
tests/syntax-tests/highlighted/SML/sample.sml+47 tests/syntax-tests/source/SML/sample.sml+47
tests/syntax-tests/highlighted/SML/sample.smlnew file+47
@@ -0,0 +1,47 @@
1+val x = 0
2+
3+val hello = "hello world"
4+
5+val id = fn x => x
6+
7+fun id' x = x
8+
9+val () = print "hello world\n"
10+
11+val _ = let
12+ val hello = "hello"
13+ val world = "world"
14+in
15+ print (hello ^ " " ^ world ^ "\n")
16+end
17+
18+fun isZero n =
19+ if n = 0 then true
20+ else false
21+
22+fun isTrue b =
23+ case b of
24+ true => true
25+ | false => false
26+
27+exception Bad_value of string
28+
29+fun isTrue' b =
30+ case b of
31+ true => true
32+ | _ => raise (Bad_value "value is not true!")
33+
34+val alwaysTrue =
35+ isTrue' false handle Bad_value _ => true
36+
37+datatype myBool = True | False
38+
39+datatype shape = Square of real | Circle of real | Point
40+
41+signature FOO = sig
42+ val foo : 'a -> 'a
43+end
44+
45+structure Foo :> FOO = struct
46+ fun foo x = x
47+end
tests/syntax-tests/source/SML/sample.smlnew file+47
@@ -0,0 +1,47 @@
1+val x = 0
2+
3+val hello = "hello world"
4+
5+val id = fn x => x
6+
7+fun id' x = x
8+
9+val () = print "hello world\n"
10+
11+val _ = let
12+ val hello = "hello"
13+ val world = "world"
14+in
15+ print (hello ^ " " ^ world ^ "\n")
16+end
17+
18+fun isZero n =
19+ if n = 0 then true
20+ else false
21+
22+fun isTrue b =
23+ case b of
24+ true => true
25+ | false => false
26+
27+exception Bad_value of string
28+
29+fun isTrue' b =
30+ case b of
31+ true => true
32+ | _ => raise (Bad_value "value is not true!")
33+
34+val alwaysTrue =
35+ isTrue' false handle Bad_value _ => true
36+
37+datatype myBool = True | False
38+
39+datatype shape = Square of real | Circle of real | Point
40+
41+signature FOO = sig
42+ val foo : 'a -> 'a
43+end
44+
45+structure Foo :> FOO = struct
46+ fun foo x = x
47+end