-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make modules just an expression at the top level.
No more hacky ModuleAst stuff. Just a single expression. Also fix a bug with lexing a // comment at the end of a file.
- Loading branch information
1 parent
583696d
commit 31d2f17
Showing
23 changed files
with
220 additions
and
265 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
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
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
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
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
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
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 |
---|---|---|
@@ -1,34 +1,32 @@ | ||
def main() | ||
// Note: These tests implicitly depend on non-zero ints being truthy. | ||
// Also rely on print() returning its argument. | ||
// Note: These tests implicitly depend on non-zero ints being truthy. | ||
// Also rely on print() returning its argument. | ||
|
||
// Return the first non-true argument. | ||
print(0 and false) // expect: 0 | ||
print(1 and 0) // expect: 0 | ||
print(1 and 2 and 0) // expect: 0 | ||
// Return the first non-true argument. | ||
print(0 and false) // expect: 0 | ||
print(1 and 0) // expect: 0 | ||
print(1 and 2 and 0) // expect: 0 | ||
|
||
// Return the last argument if all are true. | ||
print(1 and true) // expect: true | ||
print(1 and 2 and 3) // expect: 3 | ||
// Return the last argument if all are true. | ||
print(1 and true) // expect: true | ||
print(1 and 2 and 3) // expect: 3 | ||
|
||
// Short-circuit at the first false argument. | ||
print(true) and // expect: true | ||
print(false) and // expect: false | ||
print(false) // should not print | ||
// Short-circuit at the first false argument. | ||
print(true) and // expect: true | ||
print(false) and // expect: false | ||
print(false) // should not print | ||
|
||
// Call 'true?' on the arguments to determine truthiness. | ||
// TODO(bob): Support this. | ||
/* | ||
it should("call 'true?' on the arguments to determine truth") with | ||
val left = TruthTest new(false) | ||
val right = TruthTest new(false) | ||
left and right | ||
left called shouldEqual(true) | ||
right called shouldEqual(false) | ||
end | ||
*/ | ||
// Call 'true?' on the arguments to determine truthiness. | ||
// TODO(bob): Support this. | ||
/* | ||
it should("call 'true?' on the arguments to determine truth") with | ||
val left = TruthTest new(false) | ||
val right = TruthTest new(false) | ||
left and right | ||
left called shouldEqual(true) | ||
right called shouldEqual(false) | ||
end | ||
*/ | ||
|
||
// Swallow a trailing newline. | ||
print(true and | ||
true) // expect: true | ||
end | ||
// Swallow a trailing newline. | ||
print(true and | ||
true) // expect: true |
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,2 @@ | ||
print("ok") // expect: ok | ||
/* comment */ |
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,2 @@ | ||
print("ok") // expect: ok | ||
// comment |
Oops, something went wrong.