1
Fork 0

Add support for literals

This commit is contained in:
Caio 2024-07-06 18:00:04 -03:00
parent a0f01c3c10
commit c990e00f15
9 changed files with 272 additions and 59 deletions

View file

@ -1,4 +1,4 @@
error: expected identifier
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:5:10
|
LL | ${concat()}
@ -10,59 +10,126 @@ error: `concat` must have at least two elements
LL | ${concat(aaaa)}
| ^^^^^^
error: expected identifier
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:11:10
|
LL | ${concat(aaaa,)}
| ^^^^^^^^^^^^^^^
error: expected identifier, found `1`
--> $DIR/syntax-errors.rs:14:24
|
LL | ${concat(aaaa, 1)}
| ^ help: try removing `1`
error: expected comma
--> $DIR/syntax-errors.rs:19:10
--> $DIR/syntax-errors.rs:16:10
|
LL | ${concat(aaaa aaaa)}
| ^^^^^^^^^^^^^^^^^^^
error: `concat` must have at least two elements
--> $DIR/syntax-errors.rs:22:11
--> $DIR/syntax-errors.rs:19:11
|
LL | ${concat($ex)}
| ^^^^^^
error: expected comma
--> $DIR/syntax-errors.rs:28:10
--> $DIR/syntax-errors.rs:25:10
|
LL | ${concat($ex, aaaa 123)}
| ^^^^^^^^^^^^^^^^^^^^^^^
error: expected identifier
--> $DIR/syntax-errors.rs:31:10
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:28:10
|
LL | ${concat($ex, aaaa,)}
| ^^^^^^^^^^^^^^^^^^^^
error: expected identifier, found `123`
--> $DIR/syntax-errors.rs:34:29
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:88:26
|
LL | ${concat($ex, aaaa, 123)}
| ^^^ help: try removing `123`
LL | let ${concat(_a, 'b')}: () = ();
| ^^^
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:91:26
|
LL | let ${concat(_a, 1)}: () = ();
| ^
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:94:30
|
LL | let ${concat($ident, 'b')}: () = ();
| ^^^
error: expected identifier or string literal
--> $DIR/syntax-errors.rs:96:30
|
LL | let ${concat($ident, 1)}: () = ();
| ^
error: `${concat(..)}` currently only accepts identifiers or meta-variables as parameters
--> $DIR/syntax-errors.rs:25:19
--> $DIR/syntax-errors.rs:22:19
|
LL | ${concat($ex, aaaa)}
| ^^
error: variable `foo` is not recognized in meta-variable expression
--> $DIR/syntax-errors.rs:41:30
--> $DIR/syntax-errors.rs:35:30
|
LL | const ${concat(FOO, $foo)}: i32 = 2;
| ^^^
error: aborting due to 11 previous errors
error: `${concat(..)}` is not generating a valid identifier
--> $DIR/syntax-errors.rs:42:14
|
LL | let ${concat("1", $ident)}: () = ();
| ^^^^^^^^^^^^^^^^^^^^^
...
LL | starting_number!(_abc);
| ---------------------- in this macro invocation
|
= note: this error originates in the macro `starting_number` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `${concat(..)}` is not generating a valid identifier
--> $DIR/syntax-errors.rs:55:14
|
LL | let ${concat("\u{00BD}", $ident)}: () = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | starting_invalid_unicode!(_abc);
| ------------------------------- in this macro invocation
|
= note: this error originates in the macro `starting_invalid_unicode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `${concat(..)}` is not generating a valid identifier
--> $DIR/syntax-errors.rs:74:14
|
LL | let ${concat($ident, "\u{00BD}")}: () = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | ending_invalid_unicode!(_abc);
| ----------------------------- in this macro invocation
|
= note: this error originates in the macro `ending_invalid_unicode` (in Nightly builds, run with -Z macro-backtrace for more info)
error: expected pattern, found `$`
--> $DIR/syntax-errors.rs:88:13
|
LL | let ${concat(_a, 'b')}: () = ();
| ^ expected pattern
...
LL | unsupported_literals!(_abc);
| --------------------------- in this macro invocation
|
= note: this error originates in the macro `unsupported_literals` (in Nightly builds, run with -Z macro-backtrace for more info)
error: `${concat(..)}` is not generating a valid identifier
--> $DIR/syntax-errors.rs:81:14
|
LL | let ${concat("", "")}: () = ();
| ^^^^^^^^^^^^^^^^
...
LL | empty!();
| -------- in this macro invocation
|
= note: this error originates in the macro `empty` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 18 previous errors