Lukas Wirth
c3c9f5ffe1
internal: Compute syntax validation errors on demand
2024-03-04 12:06:15 +01:00
Lukas Wirth
4303e741de
Cleanup
2024-03-04 11:10:06 +01:00
Lukas Wirth
ed57008510
fix: Validate literals in proc-macro-srv FreeFunctions::literal_from_str
2024-02-13 12:33:51 +01:00
bors
925705e0c9
Auto merge of #16446 - Tyrubias:literal_from_str, r=Veykril
...
Implement `literal_from_str` for proc macro server
Closes #16233
Todos and unanswered questions:
- [x] Is this the correct approach? Can both the legacy and `rust_analyzer_span` servers depend on the `syntax` crate?
- [ ] How should we handle suffixes for string literals? It doesn't seem like `rust-analyzer` preservers suffix information after parsing.
- [x] Why are the `expect` tests failing? Specifically `test_fn_like_macro_clone_literals`
2024-02-13 10:41:36 +00:00
Victor Song
4923b8a74b
Return Option<Parse<ast::Literal>>
from ast::Literal::parse
2024-02-13 00:00:02 -06:00
Victor Song
1918f9b9e0
Address PR comments
2024-02-13 00:00:02 -06:00
Chengxu Bian
ca64359945
remove eprintln! overwrite
2024-02-12 23:54:32 -05:00
Tetsuharu Ohzeki
81c35d1f56
syntax: Fix warnings about clippy str_to_string
rule
2024-02-10 01:00:40 +09:00
Lukas Wirth
8a5829cf28
Re-order mod declarations
2024-01-27 11:02:34 +01:00
Lukas Wirth
83591268ab
minor: Make use of some new SmolStr
improvements
2024-01-17 13:47:15 +01:00
Lukas Wirth
b97ab00bd4
Split out rustc_lexer from rustc_dependencies
2024-01-08 15:24:46 +01:00
Igor Matuszewski
a7224c998d
Don't explicitly warn against semicolon_in_expressions_from_macros
...
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
Lukas Wirth
0dbde71159
Simplify
2023-09-26 12:25:59 +02:00
bors
11ffcc08a3
Auto merge of #15615 - shogo-nakano-desu:refactor/fix-clippy-lints, r=Veykril
...
Refactor/fix clippy lints
As title says.
2023-09-22 06:46:29 +00:00
hkalbasi
f4704bc8ae
Switch to in-tree rustc dependencies with a cfg flag
2023-09-15 18:10:11 +03:30
shogo-nakano-desu
ebbbaaa90f
refactor: fix clippy lints
2023-09-15 16:43:21 +09:00
Lukas Wirth
cba39f8553
fix: Fix float parser hack creating empty NameRef tokens
2023-08-08 14:44:33 +02:00
Lukas Wirth
7c765d9f9e
fix: Expand eager macros to delimited comma separated expression list
2023-07-30 17:31:26 +02:00
Lukas Wirth
6a7b905c86
Fix the eager token maps by re-mapping the textranges between the input and input expansion
2023-07-13 09:22:38 +02:00
Laurențiu Nicola
7197a27028
Use triomphe Arc
2023-05-02 20:02:43 +03:00
Lukas Wirth
e550e553e0
fix: Bring back hovering call parens for return type info
2023-02-15 18:58:59 +01:00
Lukas Wirth
9d3e616f82
Simplify
2022-10-19 21:17:11 +02:00
Jonas Schievink
bd7dfac5eb
Fix r-a spelling in some places
2022-08-01 13:47:09 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Lukas Wirth
86d1d9067e
fix: Insert whitespace into trait-impl completions when coming from macros
2022-05-24 22:56:33 +02:00
Moritz Vetter
8848186213
fix(11422): have two different funuctions - one for iterating breaks, one for iteraating breaks and continues
2022-02-24 19:00:08 +01:00
Lukas Wirth
45ff51ba22
Make more precise range macro upmapping
2022-01-31 15:53:44 +01:00
Aleksey Kladov
bfc263f1f9
introduce hacks module
2021-12-28 18:57:13 +03:00
Aleksey Kladov
45bba40079
dead code
2021-12-28 17:00:55 +03:00
Aleksey Kladov
55f1564101
remove fragments from syntax
2021-12-28 17:00:55 +03:00
Aleksey Kladov
7e9c74d20b
drop dead code
2021-12-28 17:00:55 +03:00
Aleksey Kladov
f0fefde401
remove Item::parse
2021-12-28 17:00:55 +03:00
Aleksey Kladov
b468bd6645
internal: start isolating ssr-related parsing APIs to SSR
2021-12-28 17:00:55 +03:00
Aleksey Kladov
a022ad68c9
internal: move all the lexing to the parser crate
2021-12-18 17:20:38 +03:00
Aleksey Kladov
958f20ff84
minor: dead code
2021-12-18 14:55:20 +03:00
Lukas Wirth
901c7c7277
match_ast!
takes a pattern to allow underscore usage
2021-12-14 12:44:31 +01:00
Aleksey Kladov
c2e425dd00
internal: make sure macro test expand to valid syntax
2021-10-09 18:06:24 +03:00
Lukas Wirth
b6ed91a6de
Rename *Owner
traits to Has*
2021-09-27 12:54:24 +02:00
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Aleksey Kladov
defe805fb7
internal: fix and force-disable block validation ;-(
...
Originally we tried to maintain the invariant that `{}` always match.
That is, that in the parse tree the pair of corresponding `{}` is always
first and last tokens of some nodes.
We had the code to validate that, but apparently it's been broken for
**years** since we introduced tokens/nodes split. Fixing it now makes
some tests fail.
It's unclear if we want to keep this invariant: there's a strong
motivation for breaking it in the following case:
```
use std::{ // unclosed paren
fn main() {
}
} // don't actually want to pair up this with the one from `use`
```
So let's fix the code, but disable it for the time being
2021-09-26 15:49:23 +03:00
Lukas Wirth
a6dde501df
Only strip derive attributes when preparing macro input
2021-09-19 23:38:38 +02:00
Aleksey Kladov
104cd0ce88
internal: make name consistent with usage
2021-09-06 18:34:03 +03:00
Aleksey Kladov
78c7940f5c
internal: remove dead code
2021-08-14 20:29:46 +03:00
Aleksey Kladov
1bbac9053d
Add TokenText
2021-03-26 21:33:45 +03:00
Aleksey Kladov
f5a81ec468
Upgrade rowan
...
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
Kirill Bulatov
778deb38fe
Better strip turbofishes
2021-03-08 23:59:39 +02:00
Aleksey Kladov
3429b32ad1
⬆️ rowan
...
It now stores text inline with tokens
2021-01-20 14:04:53 +03:00
Aleksey Kladov
f9707cde68
Rename expr -> tail_expr
2021-01-05 15:51:13 +03:00
Marijn Suijten
42da26e959
parser,syntax: Add separate parser for stmt with optional semicolon
...
Adjusting `grammar::fragments::stmt` to Optional or Yes will break
original functionality and tests.
2021-01-03 12:05:52 +01:00