forked from NomicFoundation/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses labels to select AST nodes, which is more accurate, requires less code (instead of checking individual kinds), and also fixes a bug where additional `TerminalKind`s of `PrecedenceOperator` are not taken into account. Closes NomicFoundation#872 Closes NomicFoundation#986
- Loading branch information
1 parent
33cf0ee
commit 0d0435f
Showing
18 changed files
with
1,502 additions
and
3,554 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
crates/codegen/language/tests/src/fail/definitions/duplicate_expression_name/test.stderr
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,5 +1,5 @@ | ||
error: An expression with the name 'Expression1' already exists. | ||
--> src/fail/definitions/duplicate_expression_name/test.rs:20:53 | ||
--> src/fail/definitions/duplicate_expression_name/test.rs:33:36 | ||
| | ||
20 | PrecedenceExpression(name = Expression1, operators = []) | ||
| ^^^^^^^^^^^ | ||
33 | ... name = Expression1, | ||
| ^^^^^^^^^^^ |
41 changes: 41 additions & 0 deletions
41
crates/codegen/language/tests/src/fail/definitions/operator_mismatch/test.rs
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,41 @@ | ||
#![allow(unused_crate_dependencies)] | ||
|
||
codegen_language_macros::compile!(Language( | ||
name = Foo, | ||
documentation_dir = "foo/bar", | ||
root_item = Bar, | ||
leading_trivia = Sequence([]), | ||
trailing_trivia = Sequence([]), | ||
versions = ["1.0.0"], | ||
sections = [Section( | ||
title = "Section One", | ||
topics = [Topic( | ||
title = "Topic One", | ||
items = [ | ||
Precedence( | ||
name = Expression, | ||
precedence_expressions = [PrecedenceExpression( | ||
name = Foo, | ||
operators = [ | ||
PrecedenceOperator( | ||
model = BinaryLeftAssociative, | ||
fields = (operator = Required(Baz1)) | ||
), | ||
PrecedenceOperator( | ||
model = Prefix, | ||
fields = (operator = Required(Baz1)) | ||
) | ||
] | ||
)], | ||
primary_expressions = [PrimaryExpression(reference = Baz1)] | ||
), | ||
Token( | ||
name = Baz1, | ||
definitions = [TokenDefinition(scanner = Atom("baz1"))] | ||
) | ||
] | ||
)] | ||
)] | ||
)); | ||
|
||
fn main() {} |
5 changes: 5 additions & 0 deletions
5
crates/codegen/language/tests/src/fail/definitions/operator_mismatch/test.stderr
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,5 @@ | ||
error: All operators under the same expression must have the same model and type. | ||
--> src/fail/definitions/operator_mismatch/test.rs:18:32 | ||
| | ||
18 | name = Foo, | ||
| ^^^ |
Oops, something went wrong.