Skip to content
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

feat: modernize parser #412

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions docs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion maud/tests/warnings/attribute-missing-value.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unexpected end of input
error: unexpected end of input, expected one of: curly braces, literal, parentheses, identifier, `.`, `#`, `@`, `;`
--> $DIR/attribute-missing-value.rs:4:5
|
4 | / html! {
Expand Down
2 changes: 1 addition & 1 deletion maud/tests/warnings/class-shorthand-missing-value.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: unexpected end of input
error: unexpected end of input, expected one of: curly braces, literal, parentheses, identifier, `.`, `#`, `@`, `;`
--> $DIR/class-shorthand-missing-value.rs:4:5
|
4 | / html! {
Expand Down
9 changes: 9 additions & 0 deletions maud/tests/warnings/let-without-block.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use maud::html;

fn main() {
html! {
p.@let x = 1; {
(x)
}
};
}
5 changes: 5 additions & 0 deletions maud/tests/warnings/let-without-block.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: `@let` bindings are only allowed inside blocks
--> tests/warnings/let-without-block.rs:5:11
|
5 | p.@let x = 1; {
| ^^^^^^^^^^^
2 changes: 1 addition & 1 deletion maud/tests/warnings/non-closed-element.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: expected `;`, found end of macro
error: unexpected end of input, expected one of: identifier, literal, `.`, `#`, curly braces, `;`
--> $DIR/non-closed-element.rs:4:5
|
4 | / html! {
Expand Down
16 changes: 8 additions & 8 deletions maud/tests/warnings/non-string-literal.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,43 @@ error: literal must be double-quoted: `"42usize"`
| ^^^^^^^

error: literal must be double-quoted: `"42.0"`
--> tests/warnings/non-string-literal.rs:7:9
--> $DIR/non-string-literal.rs:7:9
|
7 | 42.0
| ^^^^

error: literal must be double-quoted: `"a"`
--> tests/warnings/non-string-literal.rs:8:9
--> $DIR/non-string-literal.rs:8:9
|
8 | 'a'
| ^^^

error: expected string
--> tests/warnings/non-string-literal.rs:9:9
--> $DIR/non-string-literal.rs:9:9
|
9 | b"a"
| ^^^^

error: expected string
--> tests/warnings/non-string-literal.rs:10:9
--> $DIR/non-string-literal.rs:10:9
|
10 | b'a'
| ^^^^

error: attribute value must be a string
--> tests/warnings/non-string-literal.rs:13:24
--> $DIR/non-string-literal.rs:13:15
|
13 | input disabled=true;
| ^^^^
| ^^^^^^^^^^^^^
|
= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`

error: attribute value must be a string
--> tests/warnings/non-string-literal.rs:14:24
--> $DIR/non-string-literal.rs:14:15
|
14 | input disabled=false;
| ^^^^^
| ^^^^^^^^^^^^^^
|
= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`
4 changes: 2 additions & 2 deletions maud_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repository.workspace = true
edition.workspace = true

[dependencies]
syn = "2"
syn = { version = "2", features = ["extra-traits", "full"] }
quote = "1.0.7"
proc-macro2 = "1.0.23"
proc-macro-error = { version = "1.0.0", default-features = false }
proc-macro2-diagnostics = { version = "0.10", default-features = false }

[lib]
name = "maud_macros"
Expand Down
Loading
Loading