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

Refactor the diagnostic renderer to avoid printing trailing whitespace #430

Merged
merged 21 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: encountered unmatched `[` delimiter
--> testdata/lexer/braces/interleaved.proto:2:5
|
|
2 | [
| ^ expected a closing `]`
3 | }
| - closed by this instead
4 | ]
| - help: perhaps it was meant to match this?

encountered 1 error
encountered 1 error
mcy marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: encountered unmatched `{` delimiter
--> testdata/lexer/braces/stray-close.proto:1:1
|
|
1 | {
| ^ expected a closing `}`
2 | ]
| - closed by this instead
3 | }
| - help: perhaps it was meant to match this?

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: encountered unmatched `[` delimiter
--> testdata/lexer/braces/stray-open.proto:2:5
|
|
2 | [
| ^ expected a closing `]`

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: encountered unmatched `(` delimiter
--> testdata/lexer/braces/unclosed.proto:1:1
|
|
1 | (
| ^ expected a closing `)`

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: encountered unmatched `)` delimiter
--> testdata/lexer/braces/unopened.proto:1:1
|
|
1 | )
| ^ expected a closing `(`

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: encountered unmatched `*/` delimiter
--> testdata/lexer/comments/nested.proto:4:1
|
|
4 | */
| ^^ expected a closing `/*`
= note: Protobuf does not support nested block comments

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: encountered unmatched `/*` delimiter
--> testdata/lexer/comments/unterminated.proto:1:1
|
|
1 | /*
| ^^ expected a closing `*/`

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
error: unrecognized token
--> testdata/lexer/idents/non-ascii.proto:1:7
|
|
1 | kitty_🐈<U+200D>⬛
| ^^^^^^^^^^^^
| ^^^^^^^^^^^^

error: non-ASCII identifiers are not allowed
--> testdata/lexer/idents/non-ascii.proto:2:1
|
2 | 黑猫
| ^^^^
|
2 | 黑猫
| ^^^^

error: non-ASCII identifiers are not allowed
--> testdata/lexer/idents/non-ascii.proto:3:1
|
|
3 | काली बिल्ली
| ^^^^
| ^^^^

error: non-ASCII identifiers are not allowed
--> testdata/lexer/idents/non-ascii.proto:3:6
|
|
3 | काली बिल्ली
| ^^^^^
| ^^^^^

error: non-ASCII identifiers are not allowed
--> testdata/lexer/idents/non-ascii.proto:4:1
|
|
4 | 黑猫_suffix
| ^^^^^^^^^^^
| ^^^^^^^^^^^

encountered 5 errors
encountered 5 errors
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ error: files must be encoded as valid UTF-8
--> testdata/lexer/non-utf8.proto
= note: unexpected 0xff byte at offset 616

encountered 1 error
encountered 1 error
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
error: unexpected characters in integer literal
--> testdata/lexer/numbers/bad-digit.proto:1:1
|
|
1 | 0f
| ^^
| ^^

error: unexpected characters in integer literal
--> testdata/lexer/numbers/bad-digit.proto:2:1
|
|
2 | 0b02
| ^^^^
| ^^^^

error: unexpected characters in integer literal
--> testdata/lexer/numbers/bad-digit.proto:3:1
|
|
3 | 0o08
| ^^^^
| ^^^^

error: unexpected characters in integer literal
--> testdata/lexer/numbers/bad-digit.proto:4:1
|
|
4 | 08
| ^^
| ^^

error: unexpected characters in integer literal
--> testdata/lexer/numbers/bad-digit.proto:5:1
|
|
5 | 0x0G
| ^^^^
| ^^^^

encountered 5 errors
encountered 5 errors
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
error: unsupported base for integer literal
--> testdata/lexer/numbers/exotic-base.proto:1:1
help: use a hexadecimal literal instead
|
|
1 | - 0b1100101
1 | + 0x65
|
|
= note: Protobuf does not support binary literals

error: unsupported base for integer literal
--> testdata/lexer/numbers/exotic-base.proto:2:1
help: use a hexadecimal literal instead
|
|
2 | - 0B1010101
2 | + 0x55
|
|
= note: Protobuf does not support binary literals

error: unsupported base for integer literal
--> testdata/lexer/numbers/exotic-base.proto:3:1
help: remove the `o`
|
|
3 | - 0o1234567
3 | + 01234567
|
|
= note: octal literals are prefixed with `0`, not `0o`

error: unsupported base for integer literal
--> testdata/lexer/numbers/exotic-base.proto:4:1
help: remove the `o`
|
|
4 | - 0O1234567
4 | + 01234567
|
|
= note: octal literals are prefixed with `0`, not `0o`

error: unexpected characters in floating-point literal
--> testdata/lexer/numbers/exotic-base.proto:6:1
|
|
6 | 0x10203.4
| ^^^^^^^^^
| ^^^^^^^^^

error: unexpected characters in floating-point literal
--> testdata/lexer/numbers/exotic-base.proto:7:1
|
|
7 | 0X12.ffP10
| ^^^^^^^^^^
| ^^^^^^^^^^

encountered 6 errors
encountered 6 errors
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
error: integer literal contains underscores
--> testdata/lexer/numbers/thousands.proto:1:1
help: remove these underscores
|
|
1 | - 1_000_000
1 | + 1000000
|
|
= note: Protobuf does not support Go/Java/Rust-style thousands separators

error: unsupported base for integer literal
--> testdata/lexer/numbers/thousands.proto:2:1
help: use a hexadecimal literal instead
|
|
2 | - 0b1_000_000
2 | + 0x40
|
|
= note: Protobuf does not support binary literals

error: unsupported base for integer literal
--> testdata/lexer/numbers/thousands.proto:3:1
help: remove the `o`
|
|
3 | - 0o1_000_000
3 | + 01_000_000
|
|
= note: octal literals are prefixed with `0`, not `0o`

error: integer literal contains underscores
--> testdata/lexer/numbers/thousands.proto:4:1
help: remove these underscores
|
|
4 | - 0x1_000_000
4 | + 0x1000000
|
|
= note: Protobuf does not support Go/Java/Rust-style thousands separators

error: integer literal contains underscores
--> testdata/lexer/numbers/thousands.proto:5:1
help: remove these underscores
|
|
5 | - 01_000_000
5 | + 01000000
|
|
= note: Protobuf does not support Go/Java/Rust-style thousands separators

error: floating-point literal contains underscores
--> testdata/lexer/numbers/thousands.proto:6:1
help: remove these underscores
|
|
6 | - 1_000_000.00
6 | + 1000000.00
|
|
= note: Protobuf does not support Go/Java/Rust-style thousands separators

encountered 6 errors
encountered 6 errors
38 changes: 19 additions & 19 deletions experimental/parser/testdata/lexer/punct.proto.stderr.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
error: unrecognized token
--> testdata/lexer/punct.proto:2:1
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:3
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:5
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:7
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:9
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:11
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:13
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:15
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

error: unrecognized token
--> testdata/lexer/punct.proto:2:17
|
|
2 | ! @ # $ % ^ & * + _
| ^
| ^

encountered 9 errors
encountered 9 errors
Loading
Loading