Lukas Wirth
8a5829cf28
Re-order mod declarations
2024-01-27 11:02:34 +01:00
Johann Hemmann
fad4fa163c
cargo clippy --fix
2024-01-18 13:59:49 +01:00
Lukas Wirth
4ec81230db
Remove usages of Span::DUMMY
2023-12-20 12:53:46 +01:00
Lukas Wirth
f48ecb6e09
Try to support pre and post-change metavars
2023-12-19 20:45:12 +01:00
Lukas Wirth
66e29be1bd
internal: Split out a span crate
2023-12-18 14:08:33 +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
18f1a3c3c6
Some final touches
2023-12-03 20:20:59 +01:00
Lukas Wirth
0003e568ca
Pass calling span through to builtin macro expansions
2023-12-01 14:11:57 +01:00
Lukas Wirth
f48fa0c6cb
Re-implement syntax fixups
2023-11-29 16:00:39 +01:00
Lukas Wirth
b98597f06d
Re-enable proc-macros
2023-11-28 16:28:56 +01:00
Lukas Wirth
6208960c48
Deduplicate dummy test span maps
2023-11-28 10:55:40 +01:00
Lukas Wirth
30093a6d81
spans always come from real file
2023-11-28 10:55:39 +01:00
Lukas Wirth
05f375eae2
hygiene 2.0
2023-11-28 10:55:39 +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
83f91f61b1
Infect mbe crate with generic span type parameter
2023-11-28 10:55:39 +01:00
harpsword
3f4368a090
fix: fix typo in mbe/lib.rs comment
2023-10-14 14:13:24 +08:00
Lukas Wirth
75607fc34c
Simplify
2023-08-01 17:47:52 +02:00
Lukas Wirth
2366c16bf9
Fix eager token mapping panics
2023-07-11 13:54:28 +02:00
Lukas Wirth
f6c09099da
Don't unnecessarily clone the input tt for decl macros
2023-07-10 16:28:23 +02:00
Lukas Wirth
d5f64f875a
Infallibe ExpandDatabase::macro_def
2023-07-10 16:23:29 +02:00
Lukas Wirth
4ff93398fd
Skip buildin subtrees for builtin derives
2023-07-10 15:19:00 +02:00
Ryo Yoshida
0d4d1d7e3b
Implement ${count()}
metavariable expression
2023-05-28 19:54:36 +09:00
Lukas Wirth
90499d4390
Use boxed slices instead ovecs in decl macros
2023-05-02 17:04:53 +02:00
Lukas Wirth
d1ca505525
fix: Fix pat fragment handling in 2021 edition
2023-04-24 22:21:37 +02:00
Lukas Wirth
a2a3fecae3
Option begone part 2
2023-04-16 19:20:48 +02:00
Lukas Wirth
71b50f9f09
Record eager expansion errors in EagerCallInfo
2023-04-16 16:11:59 +02:00
Lukas Wirth
41a46a78f2
Make tt generic over the span data
2023-01-31 14:58:16 +01:00
Daniel Eades
cc80c5bd07
remove unnecessary lazy evaluations
2023-01-02 15:02:54 +00:00
Lukas Wirth
78f33c0e96
Expand unmatched mbe fragments to reasonable default token trees
...
Currently we expand unmatched fragments by not replacing them at all,
leaving us with `$ident`. This trips up the parser or subsequent macro
calls. Instead it makes more sense to replace these with some reasonable
default depending on the fragment kind which should make more recursive
macro calls work better for completions.
2022-10-10 14:27:05 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Lukas Wirth
1505b6a9b4
internal: Split unresolve proc-macro error out of mbe
2022-02-22 10:08:00 +01:00
Florian Diebold
bdb7ae5dd0
Rename syntax_node_to_token_tree_censored
2022-02-09 13:45:31 +01:00
Florian Diebold
1a5aa84e9f
Track synthetic tokens, to be able to remove them again later
2022-02-08 18:13:18 +01:00
Florian Diebold
cff209f152
WIP: Actually fix up syntax errors in attribute macro input
2022-02-07 18:12:51 +01:00
Lukas Wirth
2ad71f1350
Shrink mbe::ExpandError
and mbe::ParseError
2022-02-03 17:25:24 +01:00
Lukas Wirth
a0e0e4575b
Simplify
2022-01-02 02:39:14 +01:00
Aleksey Kladov
afffa096f6
add TopEntryPoint
2021-12-28 17:00:55 +03:00
Aleksey Kladov
74de79b1da
internal: rename
2021-12-25 22:02:26 +03:00
Aleksey Kladov
1055a6111a
port mbe to soa tokens
2021-12-12 19:06:40 +03:00
Lukas Wirth
a9c4c6da4c
Fix mbe::Shift::new not accounting for non-ident token ids
2021-11-22 18:00:32 +01:00
Lukas Wirth
64cb09ddea
Add to macro testing infra to emit token map ids
2021-11-22 16:51:09 +01:00
Aleksey Kladov
d4d67406d7
internal: clean up code duplication
2021-10-10 21:08:10 +03:00
Aleksey Kladov
634f047d90
internal: add integrated test for token censoring
2021-10-10 16:52:21 +03:00
Aleksey Kladov
ef1251f696
feat: report errors in macro definition
...
Reporting macro *definition* error at the macro *call site* is a rather
questionable approach, but at least we don't erase the errors
altogether!
2021-10-09 15:23:55 +03:00
Aleksey Kladov
8e9003447c
future proof structure
2021-10-09 14:48:38 +03:00
Aleksey Kladov
613609cc5e
minor: cleanup
2021-10-02 20:38:39 +03:00
Aleksey Kladov
104cd0ce88
internal: make name consistent with usage
2021-09-06 18:34:03 +03:00
Aleksey Kladov
dbb702cfc1
internal: remove accidental code re-use
...
FragmentKind played two roles:
* entry point to the parser
* syntactic category of a macro call
These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.
This PR introduces `ExpandsTo` enum to separate this two use-cases.
I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00
Aleksey Kladov
81602f8a5d
internal: reduce coupling
...
tt is a data structure, data structures cant' go wrong, they shouldn't
have the knowledge that the world outside of them has all kinds of
errors.
2021-08-31 19:14:33 +03:00