Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an SML syntax test file. #1236

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/syntax-tests/highlighted/SML/sample.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
val x = 0

val hello = "hello world"

val id = fn x => x

fun id' x = x

val () = print "hello world\n"

val _ = let
 val hello = "hello"
 val world = "world"
in
 print (hello ^ " " ^ world ^ "\n")
end

fun isZero n =
 if n = 0 then true
 else false

fun isTrue b =
 case b of
 true => true
 | false => false

exception Bad_value of string

fun isTrue' b =
 case b of
 true => true
 | _ => raise (Bad_value "value is not true!")

val alwaysTrue =
 isTrue' false handle Bad_value _ => true

datatype myBool = True | False

datatype shape = Square of real | Circle of real | Point

signature FOO = sig
 val foo : 'a -> 'a
end

structure Foo :> FOO = struct
 fun foo x = x
end
47 changes: 47 additions & 0 deletions tests/syntax-tests/source/SML/sample.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
val x = 0

val hello = "hello world"

val id = fn x => x

fun id' x = x

val () = print "hello world\n"

val _ = let
val hello = "hello"
val world = "world"
in
print (hello ^ " " ^ world ^ "\n")
end

fun isZero n =
if n = 0 then true
else false

fun isTrue b =
case b of
true => true
| false => false

exception Bad_value of string

fun isTrue' b =
case b of
true => true
| _ => raise (Bad_value "value is not true!")

val alwaysTrue =
isTrue' false handle Bad_value _ => true

datatype myBool = True | False

datatype shape = Square of real | Circle of real | Point

signature FOO = sig
val foo : 'a -> 'a
end

structure Foo :> FOO = struct
fun foo x = x
end