-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into jou-valgrind
- Loading branch information
Showing
7 changed files
with
64 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "stdlib/io.jou" | ||
|
||
class Foo: | ||
def do_stuff(self) -> void: | ||
printf("Doing stuff!\n") | ||
|
||
def make_foo() -> Foo: | ||
return Foo{} | ||
|
||
def bar() -> void: | ||
make_foo().do_stuff() # Error: cannot take address of a function call, needed for calling the do_stuff() method |
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,35 @@ | ||
import "stdlib/ascii.jou" | ||
import "stdlib/str.jou" | ||
|
||
def main() -> int: | ||
assert is_ascii("hello") | ||
assert is_ascii("hello world test!!! @$!") | ||
assert is_ascii("") | ||
assert not is_ascii("örkkimörkki") | ||
|
||
assert is_ascii_digit('0') | ||
assert is_ascii_digit('7') | ||
assert is_ascii_digit('9') | ||
assert not is_ascii_digit('x') | ||
assert not is_ascii_digit('\0') | ||
|
||
assert is_ascii_punctuation('!') | ||
assert is_ascii_punctuation('_') | ||
assert not is_ascii_punctuation('a') | ||
assert not is_ascii_punctuation('2') | ||
assert not is_ascii_punctuation('\0') | ||
|
||
assert is_ascii_whitespace(' ') | ||
assert is_ascii_whitespace('\t') | ||
assert is_ascii_whitespace('\r') | ||
assert is_ascii_whitespace('\n') | ||
assert not is_ascii_whitespace('a') | ||
assert not is_ascii_whitespace('.') | ||
assert not is_ascii_whitespace('\0') | ||
|
||
s: byte[100] | ||
strcpy(s, " hello world \r\n \t ") | ||
trim_ascii_whitespace(s) | ||
assert strcmp(s, "hello world") == 0 | ||
|
||
return 0 |