-
Notifications
You must be signed in to change notification settings - Fork 9
Parser improvements #24
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
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8e42795
add block output typechecking
InnocentZero 2b6b68f
add parameter typechecking
InnocentZero ace961f
add typechecking for if else block
InnocentZero 9acff9b
fix typechecking in If Node
InnocentZero 0433b31
Add better diagnostics to if else
InnocentZero 54aebb7
add none type for params
InnocentZero ef7fbcb
Remove Type::Block and BLOCK_TYPE
InnocentZero 5503a46
Check if condition's type
InnocentZero 6fd3232
remove if-else branch checks
InnocentZero 1f4959f
add OneOf type
InnocentZero 0e68280
Typecheck For loop node
InnocentZero cde0a9f
Add while node
InnocentZero aeec48a
add aliasing test
InnocentZero 77e46cd
Typecheck match node
InnocentZero 09886e4
Replace BTreeSet with HashSet
InnocentZero b0820fb
Fix while loop typechecking
InnocentZero 5b9ee66
Fix test output
InnocentZero 76057a0
Add Error type
InnocentZero 095f859
Forbidden type for params
InnocentZero cc6a0e7
change for and match types
InnocentZero e6fb37e
Add unit type
InnocentZero 8ca08b8
Fix match parsing
InnocentZero 227e954
Update tests for after unit type
InnocentZero a21f060
Add Alias Node
InnocentZero fdb4f25
Add flag framework for while
InnocentZero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,41 @@ | ||
| --- | ||
| source: src/test.rs | ||
| expression: evaluate_example(path) | ||
| input_file: tests/alias.nu | ||
| snapshot_kind: text | ||
| --- | ||
| ==== COMPILER ==== | ||
| 0: Name (4 to 7) "foo" | ||
| 1: Name (9 to 10) "a" | ||
| 2: Param { name: NodeId(1), ty: None } (9 to 10) | ||
| 3: Params([NodeId(2)]) (8 to 11) | ||
| 4: Variable (14 to 16) "$a" | ||
| 5: Block(BlockId(0)) (12 to 18) | ||
| 6: Def { name: NodeId(0), params: NodeId(3), return_ty: None, block: NodeId(5) } (0 to 18) | ||
| 7: Name (26 to 29) "bar" | ||
| 8: Name (32 to 35) "foo" | ||
| 9: Alias { new_name: NodeId(7), old_name: NodeId(8) } (20 to 35) | ||
| 10: Name (37 to 40) "bar" | ||
| 11: Int (41 to 42) "1" | ||
| 12: Call { parts: [NodeId(10), NodeId(11)] } (41 to 42) | ||
| 13: Block(BlockId(1)) (0 to 43) | ||
| ==== SCOPE ==== | ||
| 0: Frame Scope, node_id: NodeId(13) | ||
| decls: [ bar: NodeId(7), foo: NodeId(0) ] | ||
| 1: Frame Scope, node_id: NodeId(5) | ||
| variables: [ a: NodeId(1) ] | ||
| ==== TYPES ==== | ||
| 0: unknown | ||
| 1: unknown | ||
| 2: any | ||
| 3: none | ||
| 4: unknown | ||
| 5: unknown | ||
| 6: none | ||
| 7: unknown | ||
| 8: unknown | ||
| 9: none | ||
| 10: unknown | ||
| 11: int | ||
| 12: any | ||
| 13: any |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,61 @@ | ||
| --- | ||
| source: src/test.rs | ||
| expression: evaluate_example(path) | ||
| input_file: tests/closure3.nu | ||
| snapshot_kind: text | ||
| --- | ||
| ==== COMPILER ==== | ||
| 0: Variable (4 to 11) "closure" | ||
| 1: Name (16 to 17) "a" | ||
| 2: Name (19 to 22) "int" | ||
| 3: Type { name: NodeId(2), params: None, optional: false } (19 to 22) | ||
| 4: Param { name: NodeId(1), ty: Some(NodeId(3)) } (16 to 22) | ||
| 5: Name (24 to 25) "b" | ||
| 6: Name (27 to 30) "int" | ||
| 7: Type { name: NodeId(6), params: None, optional: false } (27 to 30) | ||
| 8: Param { name: NodeId(5), ty: Some(NodeId(7)) } (24 to 30) | ||
| 9: Params([NodeId(4), NodeId(8)]) (15 to 31) | ||
| 10: Variable (32 to 34) "$a" | ||
| 11: Plus (35 to 36) | ||
| 12: Variable (37 to 39) "$b" | ||
| 13: LessThan (40 to 41) | ||
| 14: Int (42 to 43) "5" | ||
| 15: BinaryOp { lhs: NodeId(10), op: NodeId(11), rhs: NodeId(12) } (32 to 39) | ||
| 16: BinaryOp { lhs: NodeId(15), op: NodeId(13), rhs: NodeId(14) } (32 to 43) | ||
| 17: Block(BlockId(0)) (32 to 43) | ||
| 18: Closure { params: Some(NodeId(9)), block: NodeId(17) } (14 to 44) | ||
| 19: Let { variable_name: NodeId(0), ty: None, initializer: NodeId(18), is_mutable: false } (0 to 44) | ||
| 20: Name (46 to 52) "filter" | ||
| 21: Variable (53 to 61) "$closure" | ||
| 22: Call { parts: [NodeId(20), NodeId(21)] } (53 to 61) | ||
| 23: Block(BlockId(1)) (0 to 62) | ||
| ==== SCOPE ==== | ||
| 0: Frame Scope, node_id: NodeId(23) | ||
| variables: [ closure: NodeId(0) ] | ||
| 1: Frame Scope, node_id: NodeId(17) | ||
| variables: [ a: NodeId(1), b: NodeId(5) ] | ||
| ==== TYPES ==== | ||
| 0: closure | ||
| 1: unknown | ||
| 2: unknown | ||
| 3: int | ||
| 4: int | ||
| 5: unknown | ||
| 6: unknown | ||
| 7: int | ||
| 8: int | ||
| 9: forbidden | ||
| 10: int | ||
| 11: forbidden | ||
| 12: int | ||
| 13: forbidden | ||
| 14: int | ||
| 15: int | ||
| 16: bool | ||
| 17: bool | ||
| 18: closure | ||
| 19: none | ||
| 20: unknown | ||
| 21: closure | ||
| 22: stream<binary> | ||
| 23: stream<binary> |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe throw an error here with a WIP note instead of silently ignoring flags.