This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trailing comma are supported for dict, list, set, import, can.
- Loading branch information
1 parent
4fdfafd
commit 9e72115
Showing
3 changed files
with
79 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
This test file is to ensure the valid syntax of jac lang. | ||
Add new jac syntax here to test if it compile without any issue. | ||
""" | ||
|
||
# Import statement without trailing comma. | ||
import:py from time { | ||
sleep, | ||
timezone, | ||
tzname | ||
} | ||
|
||
|
||
# Import statement with trailing comma. | ||
import:py from os { | ||
path, | ||
getenv, | ||
getpid, | ||
} | ||
|
||
|
||
enum WithoutTrailComma { | ||
FOO = "FOO", | ||
BAR = "BAR" | ||
} | ||
|
||
|
||
enum WithTrailComma { | ||
FOO = "FOO", | ||
BAR = "BAR", | ||
} | ||
|
||
|
||
can without_trail_comma(a:int, b:int) {} | ||
|
||
can with_trail_comma( | ||
a:int, | ||
b:int, | ||
c:int, | ||
) {} | ||
|
||
|
||
with entry { | ||
|
||
dict_without_trail_comma = { "key" : "value" }; | ||
dict_with_trail_comma = { | ||
"key" : "val", | ||
}; | ||
|
||
list_without_trail_comma = [ "foo", "bar" ]; | ||
list_with_trail_comma = [ | ||
"foo", | ||
"bar", | ||
]; | ||
|
||
set_without_trail_comma = { "foo", "bar" }; | ||
set_with_trail_comma = { | ||
"foo", | ||
"bar", | ||
}; | ||
|
||
print("Code compiled and ran successfully!"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters