1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-27 17:17:45 +00:00

Add derive macro for Syntax (used to be Language) (#51)

This commit is contained in:
DQ 2023-04-18 20:10:35 +02:00 committed by GitHub
parent 2aa543036f
commit c5279bae7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 1459 additions and 899 deletions

View file

@ -0,0 +1,11 @@
use cstree::Syntax;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Syntax)]
#[repr(u32)]
pub enum SyntaxKind {
A,
#[static_text()]
B,
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: argument to `static_text` must be a string literal: `#[static_text("...")]`
--> tests/ui/static_text/empty_expr.rs:7:7
|
7 | #[static_text()]
| ^^^^^^^^^^^^^
error: unexpected end of input, expected string literal
--> tests/ui/static_text/empty_expr.rs:7:19
|
7 | #[static_text()]
| ^

View file

@ -0,0 +1,11 @@
use cstree::Syntax;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Syntax)]
#[repr(u32)]
pub enum SyntaxKind {
A,
#[static_text]
B,
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: missing text for `static_text`: try `#[static_text("...")]`
--> tests/ui/static_text/missing_text.rs:7:5
|
7 | #[static_text]
| ^^^^^^^^^^^^^^

View file

@ -0,0 +1,11 @@
use cstree::Syntax;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Syntax)]
#[repr(u32)]
pub enum SyntaxKind {
A,
#[static_text(SyntaxKind)]
B,
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: argument to `static_text` must be a string literal: `#[static_text("...")]`
--> tests/ui/static_text/non_expr.rs:7:7
|
7 | #[static_text(SyntaxKind)]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: expected string literal
--> tests/ui/static_text/non_expr.rs:7:19
|
7 | #[static_text(SyntaxKind)]
| ^^^^^^^^^^

View file

@ -0,0 +1,11 @@
use cstree::Syntax;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Syntax)]
#[repr(u32)]
pub enum SyntaxKind {
A,
#[static_text(foo + 3)]
B,
}
fn main() {}

View file

@ -0,0 +1,11 @@
error: argument to `static_text` must be a string literal: `#[static_text("...")]`
--> tests/ui/static_text/non_string_expr.rs:7:7
|
7 | #[static_text(foo + 3)]
| ^^^^^^^^^^^^^^^^^^^^
error: expected string literal
--> tests/ui/static_text/non_string_expr.rs:7:19
|
7 | #[static_text(foo + 3)]
| ^^^

View file

@ -0,0 +1,11 @@
use cstree::Syntax;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Syntax)]
#[repr(u32)]
pub enum SyntaxKind {
A,
#[static_text = "b"]
B,
}
fn main() {}

View file

@ -0,0 +1,5 @@
error: `static_text` takes the text as a function argument: `#[static_text("...")]`
--> tests/ui/static_text/text_assigned.rs:7:5
|
7 | #[static_text = "b"]
| ^^^^^^^^^^^^^^^^^^^^