-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from Vishalk91-4/kcl-pretest
Added assert, schema and remaining statement, test cases
- Loading branch information
Showing
3 changed files
with
130 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
================================================================================ | ||
assert statements | ||
================================================================================ | ||
|
||
assert x > 1 | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(module | ||
(assert_statement | ||
(comparison_operator | ||
(identifier) | ||
(integer)))) | ||
|
||
================================================================================ | ||
assert statements using if expression | ||
================================================================================ | ||
|
||
assert a > 2 if a | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(module | ||
(assert_statement | ||
(comparison_operator | ||
(identifier) | ||
(integer)) | ||
(identifier))) | ||
|
||
================================================================================ | ||
assert statements with error message | ||
================================================================================ | ||
|
||
assert a == b, "SOS" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(module | ||
(assert_statement | ||
(comparison_operator | ||
(identifier) | ||
(identifier)) | ||
(string | ||
(string_start) | ||
(string_content) | ||
(string_end)))) |
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,22 @@ | ||
================================================================================ | ||
Schema Statement | ||
================================================================================ | ||
|
||
schema Person: | ||
firstName: str = "John" | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
(module | ||
(schema_statement | ||
(identifier) | ||
(block | ||
(assignment | ||
(dotted_name | ||
(identifier)) | ||
(type | ||
(basic_type)) | ||
(string | ||
(string_start) | ||
(string_content) | ||
(string_end)))))) |
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