-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix attachment of trailing trivia with tab characters
- Loading branch information
1 parent
aaf57e4
commit 95fb5c8
Showing
5 changed files
with
658 additions
and
1 deletion.
There are no files selected for viewing
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
342 changes: 342 additions & 0 deletions
342
full-moon/tests/cases/pass/table-constructors-9/ast.snap
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,342 @@ | ||
--- | ||
source: full-moon/tests/pass_cases.rs | ||
expression: ast.nodes() | ||
input_file: full-moon/tests/cases/pass/table-constructors-9 | ||
--- | ||
stmts: | ||
- - LocalAssignment: | ||
local_token: | ||
leading_trivia: | ||
- start_position: | ||
bytes: 0 | ||
line: 1 | ||
character: 1 | ||
end_position: | ||
bytes: 102 | ||
line: 1 | ||
character: 103 | ||
token_type: | ||
type: SingleLineComment | ||
comment: " comments separated by tab chars, should be parsed as trailing trivia of the tokens they are next to" | ||
- start_position: | ||
bytes: 102 | ||
line: 1 | ||
character: 103 | ||
end_position: | ||
bytes: 103 | ||
line: 1 | ||
character: 103 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- start_position: | ||
bytes: 103 | ||
line: 2 | ||
character: 1 | ||
end_position: | ||
bytes: 120 | ||
line: 2 | ||
character: 18 | ||
token_type: | ||
type: SingleLineComment | ||
comment: " stylua: ignore" | ||
- start_position: | ||
bytes: 120 | ||
line: 2 | ||
character: 18 | ||
end_position: | ||
bytes: 121 | ||
line: 2 | ||
character: 18 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
token: | ||
start_position: | ||
bytes: 121 | ||
line: 3 | ||
character: 1 | ||
end_position: | ||
bytes: 126 | ||
line: 3 | ||
character: 6 | ||
token_type: | ||
type: Symbol | ||
symbol: local | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 126 | ||
line: 3 | ||
character: 6 | ||
end_position: | ||
bytes: 127 | ||
line: 3 | ||
character: 7 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
name_list: | ||
pairs: | ||
- End: | ||
leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 127 | ||
line: 3 | ||
character: 7 | ||
end_position: | ||
bytes: 130 | ||
line: 3 | ||
character: 10 | ||
token_type: | ||
type: Identifier | ||
identifier: too | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 130 | ||
line: 3 | ||
character: 10 | ||
end_position: | ||
bytes: 131 | ||
line: 3 | ||
character: 11 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
equal_token: | ||
leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 131 | ||
line: 3 | ||
character: 11 | ||
end_position: | ||
bytes: 132 | ||
line: 3 | ||
character: 12 | ||
token_type: | ||
type: Symbol | ||
symbol: "=" | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 132 | ||
line: 3 | ||
character: 12 | ||
end_position: | ||
bytes: 133 | ||
line: 3 | ||
character: 13 | ||
token_type: | ||
type: Whitespace | ||
characters: " " | ||
expr_list: | ||
pairs: | ||
- End: | ||
TableConstructor: | ||
braces: | ||
tokens: | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 133 | ||
line: 3 | ||
character: 13 | ||
end_position: | ||
bytes: 134 | ||
line: 3 | ||
character: 14 | ||
token_type: | ||
type: Symbol | ||
symbol: "{" | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 134 | ||
line: 3 | ||
character: 14 | ||
end_position: | ||
bytes: 135 | ||
line: 3 | ||
character: 14 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 165 | ||
line: 6 | ||
character: 1 | ||
end_position: | ||
bytes: 166 | ||
line: 6 | ||
character: 2 | ||
token_type: | ||
type: Symbol | ||
symbol: "}" | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 166 | ||
line: 6 | ||
character: 2 | ||
end_position: | ||
bytes: 167 | ||
line: 6 | ||
character: 2 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
fields: | ||
pairs: | ||
- Punctuated: | ||
- NoKey: | ||
Var: | ||
Name: | ||
leading_trivia: | ||
- start_position: | ||
bytes: 135 | ||
line: 4 | ||
character: 1 | ||
end_position: | ||
bytes: 136 | ||
line: 4 | ||
character: 2 | ||
token_type: | ||
type: Whitespace | ||
characters: "\t" | ||
token: | ||
start_position: | ||
bytes: 136 | ||
line: 4 | ||
character: 2 | ||
end_position: | ||
bytes: 137 | ||
line: 4 | ||
character: 3 | ||
token_type: | ||
type: Identifier | ||
identifier: x | ||
trailing_trivia: [] | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 137 | ||
line: 4 | ||
character: 3 | ||
end_position: | ||
bytes: 138 | ||
line: 4 | ||
character: 4 | ||
token_type: | ||
type: Symbol | ||
symbol: "," | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 138 | ||
line: 4 | ||
character: 4 | ||
end_position: | ||
bytes: 140 | ||
line: 4 | ||
character: 6 | ||
token_type: | ||
type: Whitespace | ||
characters: "\t\t" | ||
- start_position: | ||
bytes: 140 | ||
line: 4 | ||
character: 6 | ||
end_position: | ||
bytes: 149 | ||
line: 4 | ||
character: 15 | ||
token_type: | ||
type: SingleLineComment | ||
comment: " string" | ||
- start_position: | ||
bytes: 149 | ||
line: 4 | ||
character: 15 | ||
end_position: | ||
bytes: 150 | ||
line: 4 | ||
character: 15 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- Punctuated: | ||
- NoKey: | ||
Var: | ||
Name: | ||
leading_trivia: | ||
- start_position: | ||
bytes: 150 | ||
line: 5 | ||
character: 1 | ||
end_position: | ||
bytes: 151 | ||
line: 5 | ||
character: 2 | ||
token_type: | ||
type: Whitespace | ||
characters: "\t" | ||
token: | ||
start_position: | ||
bytes: 151 | ||
line: 5 | ||
character: 2 | ||
end_position: | ||
bytes: 152 | ||
line: 5 | ||
character: 3 | ||
token_type: | ||
type: Identifier | ||
identifier: y | ||
trailing_trivia: [] | ||
- leading_trivia: [] | ||
token: | ||
start_position: | ||
bytes: 152 | ||
line: 5 | ||
character: 3 | ||
end_position: | ||
bytes: 153 | ||
line: 5 | ||
character: 4 | ||
token_type: | ||
type: Symbol | ||
symbol: "," | ||
trailing_trivia: | ||
- start_position: | ||
bytes: 153 | ||
line: 5 | ||
character: 4 | ||
end_position: | ||
bytes: 155 | ||
line: 5 | ||
character: 6 | ||
token_type: | ||
type: Whitespace | ||
characters: "\t\t" | ||
- start_position: | ||
bytes: 155 | ||
line: 5 | ||
character: 6 | ||
end_position: | ||
bytes: 164 | ||
line: 5 | ||
character: 15 | ||
token_type: | ||
type: SingleLineComment | ||
comment: " string" | ||
- start_position: | ||
bytes: 164 | ||
line: 5 | ||
character: 15 | ||
end_position: | ||
bytes: 165 | ||
line: 5 | ||
character: 15 | ||
token_type: | ||
type: Whitespace | ||
characters: "\n" | ||
- ~ |
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,6 @@ | ||
-- comments separated by tab chars, should be parsed as trailing trivia of the tokens they are next to | ||
-- stylua: ignore | ||
local too = { | ||
x, -- string | ||
y, -- string | ||
} |
Oops, something went wrong.