Commit graph

1080 commits

Author SHA1 Message Date
Timo Freiberg
f5ac313000 Add quickfix to add a struct field 2020-06-12 18:52:44 +02:00
bors[bot]
f3d73865d6
Merge #4855
4855: Use more idiomatic style for lifetimes in generated code r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-12 12:49:30 +00:00
Veetaha
4fefc7d06c Simplify 2020-06-12 02:56:06 +03:00
Veetaha
c514060600 Apply codegen with idiomatic lifetimes 2020-06-12 01:26:58 +03:00
Matthew Jasper
8622e4cc1b Add example of old trait object syntax 2020-06-11 18:15:03 +01:00
Matthew Jasper
879693e63c Move complex inline test to own file 2020-06-11 18:14:57 +01:00
Matthew Jasper
506e1ddbfa Separating parsing of for in predicates and types 2020-06-10 11:30:58 +01:00
Aleksey Kladov
e8d50578ab Correctly parse <_> paths in patterns
closes #3659
2020-06-09 13:45:18 +02:00
bors[bot]
eb53f5a9e5
Merge #4812
4812: Use correct indent when replacing with match r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-09 11:14:30 +00:00
Aleksey Kladov
8cad7d1a2b Use correct indent when replacing with match 2020-06-09 12:38:47 +02:00
Avi Dessauer
e38685cb48 Parse default unsafe fn 2020-06-08 17:49:06 -04:00
Leander Tentrup
3aaaf924cb Fix bug in lexer for format specifier where the type and width were not correctly distinguished 2020-06-07 22:57:24 +02:00
Avi Dessauer
c4fd463981 Move default const test out of line 2020-06-04 13:06:57 -04:00
Avi Dessauer
a5588b9e19 Update tests 2020-06-03 20:39:57 -04:00
Avi Dessauer
fb632c747d Parse default unsafe & default const 2020-06-03 20:16:38 -04:00
Aaron Loucks
4c655c01f3 Enable hover and autocomplete docs on macro generated items 2020-06-03 06:46:07 -04:00
bors[bot]
fe6508bd78
Merge #4658
4658: Fix problem with format string tokenization r=matklad a=ruabmbua

Fixed by just not handling closing curlybrace escaping.

Closes https://github.com/rust-analyzer/rust-analyzer/issues/4637

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-06-02 12:13:02 +00:00
veetaha
fb971c3bce Simplify 2020-06-02 02:50:05 +03:00
veetaha
ddd811601e Small refactor 2020-05-31 21:39:19 +03:00
robojumper
1cd78a3355 correctly infer labelled breaks 2020-05-31 11:40:18 +02:00
Roland Ruckerbauer
a27ede88a3 Fix problem with format string tokenization
Fixed by just not handling closing curlybrace escaping.
2020-05-30 14:09:10 +02:00
robojumper
367487fe88 Support raw_ref_op's raw reference operator 2020-05-28 21:42:22 +02:00
kjeremy
9a0353a81e Update lexer 2020-05-26 14:35:09 -04:00
Julian Wollersberger
ff9d553fe3 Some FIXMEs were outdated:
* Done at line 243: "Add validation of `crate` keyword not appearing in the middle of the symbol path"
* Already happened: "Remove validation of unterminated literals (it is already implemented in `tokenize()`)"
* Happens in `unescape()`: "Add validation of character literal containing only a single char"
* Missing: "raw string literals and raw byte string literals"
2020-05-24 13:17:16 +02:00
Julian Wollersberger
cd4ffc1945 Update to rustc_lexer version 660.
Change `unescape_*()` to `unescape_literal()`.
2020-05-24 13:12:16 +02:00
bors[bot]
a36202390c
Merge #4521 #4522
4521: Use snippets in add_function r=matklad a=matklad

bors r+
🤖

4522: Explain the purpose of `ast::make` module more clearly r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-05-19 23:30:48 +00:00
Aleksey Kladov
e6fc0bdffb Moderate cleanup of add_function 2020-05-20 01:30:12 +02:00
Aleksey Kladov
4de2749db8 Explain the purpose of ast::make module more clearly 2020-05-20 01:28:46 +02:00
Simon Vandel Sillesen
ef6d53521f Shrink ra_parser::Event from 32 bytes to 16 bytes
This boxes the Error variant with the assumption that it is rarely constructed
2020-05-16 22:20:44 +02:00
bors[bot]
f1587ac263
Merge #4445
4445: Correctly fill default type parameters r=flodiebold a=montekki

Fixes #3877 

So, basically even if the parameters are omitted from the `impl` block, check the parameters in `trait` if they have a default type, and if they do go from `hir` to `ast::TypeArg`. I've added a helper for that but I am not sure that it's a proper way to go from `hir` to `ast` here.

Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
2020-05-14 11:20:42 +00:00
Fedor Sakharov
7e9396c7eb
Change type_arg to type_ref func 2020-05-14 10:14:04 +03:00
Trevor Spiteri
2d0a949236 Use back ticks instead of single quotes around code 2020-05-14 01:06:07 +02:00
Fedor Sakharov
00f3b6c59a
Correctly fill default type parameters 2020-05-13 16:07:44 +03:00
bors[bot]
9594fe33fa
Merge #4083
4083: Smol documentation for ast nodes r=matklad a=Veetaha

There is a tremendous amount of TODOs to clarify the topics I am not certain about.
Please @matklad, @edwin0cheng review carefully, I even left some mentions of your names in todos to put your attention where you most probably can give comments.

In order to simplify the review, I separated the codegen (i.e. changes in `ast/generated/nodes.rs`) from `ast_src` changes (they in fact just duplicate one another) into two commits.

Also, I had to hack a little bit to let the docs be generated as doc comments and not as doc attributes because it's easier to read them this way and IIRC we don't support hints for `#[doc = ""]` attributes for now...

Closes #3682 

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-05-13 09:09:46 +00:00
veetaha
8d4c11625a Remove an equals sign from ConstArg (this probably pertains only to ConstParam)
(As per matklad)
2020-05-12 23:57:04 +03:00
veetaha
51edfbaffe Convert TODO to a Note(matklad) 2020-05-12 23:50:52 +03:00
veetaha
65b380fa8d Convert to TODOs to FIXMEs as per matklad 2020-05-12 23:48:04 +03:00
veetaha
55a29982c0 Revert "Remove MacroStmts as per edwin0cheng" (cc @edwin0cheng) and add a fixme to document it.
This reverts commit 7a49165f5d.
MacroStmts ast node is not used by itself, but it pertains
to SyntaxNodeKind MACRO_STMTS that is used by ra_paser, so
even tho the node itself is not used, it is better to keep it
with a FIXME to actually add a doc comment when it becomes useful.
2020-05-12 23:45:29 +03:00
veetaha
24b27abf9f Add a doc comment on the difference between Name and NameRef ast nodes 2020-05-12 23:31:37 +03:00
veetaha
2a5ab9f5dd Resolve TODO about macro 2.0 def 2020-05-10 22:08:06 +03:00
veetaha
73c6bc4dbd Fix typo 2020-05-10 21:59:15 +03:00
veetaha
33f240960d Carify on a semicolon in macro call 2020-05-10 21:57:49 +03:00
veetaha
a1dc28f236 Resolve TODO about curly-braced constructions in expression statement 2020-05-10 21:51:53 +03:00
veetaha
8a298eed7a Resolve todos about refs and empty statements 2020-05-10 21:44:14 +03:00
veetaha
f5e2e02aa9 Converted TODO about MacroItems to FIXME as per edwin0cheng 2020-05-10 21:06:12 +03:00
veetaha
71f2be968b Verified ConstArg example, waiting for response on what = sign pertains to 2020-05-10 21:02:21 +03:00
bors[bot]
bfb40a698d
Merge #4396
4396: Improve panic message for ast_from_text r=jonas-schievink a=edwin0cheng

Related: #4368

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-10 18:01:20 +00:00
veetaha
f6fd4c4a74 Correcy use tree and type args docs 2020-05-10 20:52:25 +03:00
veetaha
2af6b4b67e Correct use cannot have type args as per flodiebold 2020-05-10 20:23:29 +03:00
veetaha
a19b164661 Correct path docs and add colon2 token to Path ast node 2020-05-10 20:21:46 +03:00
veetaha
eedf11ae88 Add example with const in TypeBound as per flodiebold 2020-05-10 19:24:06 +03:00
veetaha
09c438b47e Properly document const impl as per flodiebold 2020-05-10 19:17:46 +03:00
veetaha
7a49165f5d Remove MacroStmts as per edwin0cheng 2020-05-10 19:11:22 +03:00
veetaha
258a3461b4 Add proper docs for TokenTree as per edwin0cheng 2020-05-10 19:09:36 +03:00
veetaha
3554866d67 Run codegen of ast types with documentation 2020-05-10 19:06:28 +03:00
Edwin Cheng
0f1d39133c Improve panic message for ast_from_text 2020-05-10 03:46:12 +08:00
Aleksey Kladov
5c04d8544c unindent -> dedent 2020-05-09 14:48:43 +02:00
Aleksey Kladov
231fddab54 More fluent indent API 2020-05-09 14:40:11 +02:00
Aleksey Kladov
27c7ef6d65 Use more natural signature for Edit::apply 2020-05-05 23:23:29 +02:00
Aleksey Kladov
4a6fa8f0df Rename AtomTextEdit -> Indel 2020-05-05 23:15:49 +02:00
Edwin Cheng
92665358cd Rename ImplItem to AssocItem 2020-05-05 23:56:10 +08:00
Edwin Cheng
f90fbaf6a6 Add documents owner for ImplDef and SourceFile 2020-05-03 18:00:27 +08:00
Kirill Bulatov
c4b32d1534 Fix the extension method 2020-05-02 21:41:02 +03:00
bors[bot]
89e1f97515
Merge #4207 #4253
4207: Add unwrap block assist #4156 r=matklad a=bnjjj

close issue #4156 

4253: Remove `workspaceLoaded` setting r=matklad a=eminence

The `workspaceLoaded` notification setting was originally designed to
control the display of a popup message that said:

    "workspace loaded, {} rust packages"

This popup was removed and replaced by a much sleeker message in the
VSCode status bar that provides a real-time status while loading:

    rust-analyzer: {}/{} packages

This was done as part of #3587

The change in this PR simply renames this setting from `workspaceLoaded` to
`progress` to better describe what it actually controls.  At the moment,
the only type of progress message that is controlled by this setting is
the initial load messages, but in theory other messages could also be
controlled by this setting.


Reviewer notes:

* If we didn't like the idea of causing minor breaking to user's config, we could keep the setting name as `workspaceLoaded`
* I think we can now close both #2719 and #3176 since the notification dialog in question no longer exists (actually I think you can close those issues even if you reject this PR 😄 )

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Andrew Chin <achin@eminence32.net>
2020-05-02 12:44:55 +00:00
Aleksey Kladov
359d3be308 Fix parsing of blocks without { 2020-05-02 14:35:17 +02:00
Benjamin Coenen
fdf86637bf Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-02 13:39:05 +02:00
bors[bot]
fb8fb65131
Merge #4234
4234: Support local_inner_macros r=jonas-schievink a=edwin0cheng

This PR implements `#[macro_export(local_inner_macros)]` support. 

Note that the rustc implementation is quite [hacky][1] too. :)

[1]: 614f273e93/src/librustc_resolve/macros.rs (L456)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-05-02 10:30:49 +00:00
Benjamin Coenen
0b40876b99 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-02 12:25:04 +02:00
Aleksey Kladov
b73dbbfbf2 Add missing members generates indented blocks 2020-05-02 11:53:07 +02:00
Aleksey Kladov
623faefcda Cleanup inline tests 2020-05-02 11:21:39 +02:00
Aleksey Kladov
642a3392d9 Update test data 2020-05-02 11:21:39 +02:00
Aleksey Kladov
4f2134cc33 Introduce EffectExpr 2020-05-02 11:21:39 +02:00
Edwin Cheng
edf0b4c152 Test whether it is bang macro properly 2020-05-02 10:16:26 +08:00
Aleksey Kladov
fd030f9450 Revert "Merge #4233"
This reverts commit a5f2b16366, reversing
changes made to c96b2180c1.
2020-05-02 01:12:37 +02:00
bors[bot]
3232fd5179
Merge #4220 #4240
4220: Introduce LowerCtx r=matklad a=edwin0cheng

This PR introduces `LowerCtx` for path lowering. 

After this PR, there are only 2 places remains for using deprecated `Path::from_ast`, which is related to `AstTransform` I am not familiar. I would like to change these in another PR by others ;)

related disscusiion:  https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Path.3A.3Afrom_src

And also fixed part of https://github.com/rust-analyzer/rust-analyzer/issues/4176#issuecomment-620672930

4240: Bump deps r=matklad a=lnicola



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-05-01 20:16:25 +00:00
bors[bot]
21588e15df
Merge #4246
4246: Validate uses of self and super r=matklad a=djrenren

This change follows on the validation of the `crate` keyword in paths. It verifies the following things:

`super`:
 - May only be preceded by other `super` segments
 - If in a `UseItem` then all semantically preceding paths also consist only of `super`

`self`
 - May only be the start of a path


Just a note, a couple times while working on this I found myself really wanting a Visitor of some sort so that I could traverse descendants while skipping sub-trees that are unimportant. Iterators don't really work for this, so as you can see I reached for recursion. Considering paths are generally small a fancy debounced visitor probably isn't important but figured I'd say something in case we had something like this lying around and I wasn't using it.

Co-authored-by: John Renner <john@jrenner.net>
2020-05-01 19:24:25 +00:00
Diana
375dd18dc0 Fix pub(self) visibility?
Clippy complained about it and it seems wrong
2020-05-01 12:09:47 -04:00
John Renner
3bb46042fb Validate uses of self and super 2020-05-01 08:59:24 -07:00
Benjamin Coenen
dc34162450 Merge branch 'master' of github.com:rust-analyzer/rust-analyzer 2020-05-01 16:26:30 +02:00
Laurențiu Nicola
1e20467c3a Bump deps 2020-05-01 15:29:03 +03:00
Aleksey Kladov
1865dedadf Introduce BlockModifier 2020-04-30 22:58:26 +02:00
Aleksey Kladov
292ba6a1f8 Remove dead code, which elaborately pretends to be alive 2020-04-30 22:41:14 +02:00
Aleksey Kladov
15cfa9a808 Fix a bunch of false-positives in join-lines 2020-04-30 22:08:50 +02:00
bors[bot]
745bd45ddb
Merge #4227
4227: Report invalid, nested, multi-segment crate-paths r=matklad a=djrenren

There was a bug in the previous path-validating code that didn't detect multi-segment paths that started with `crate`.

```rust
// Successfully reported
use foo::{crate};

// BUG: was not being reported
use foo::{crate::bar};
```

This was due to my confusion about path-associativity. That is, the path with no qualifier is the innermost path, not the outermost. I've updated the code with a lot of comments to explain what's going on. 

This bug was discovered when I found an erroneous `ok` test which I reported here: 
https://github.com/rust-analyzer/rust-analyzer/issues/4226

This test now fails and has been modified, hopefully in the spirit of the original test, to be correct.  Sorry about submitting the bug in the first place!

Co-authored-by: John Renner <john@jrenner.net>
2020-04-30 18:37:35 +00:00
John Renner
513a3615f6 Report invalid, nested, multi-segment crate-paths
Specifically, things like:

use foo::{crate::bar};

Are now being caught, when before we only caught:

use foo::{crate};
2020-04-30 11:16:09 -07:00
Edwin Cheng
45c4f620b1 Special-case try macro_rules 2020-04-30 22:07:46 +08:00
Aleksey Kladov
c51c8bfb84 Special-case try macro to better support 2015 edition 2020-04-30 14:17:14 +02:00
bors[bot]
95e8766db6
Merge #4178
4178: Validate the location of `crate` in paths r=matklad a=djrenren

**This solution does not fully handle `use` statements. See below**

This pull requests implements simple validation of usages of the `crate` keyword in `Path`s. Specifically it validates that:

- If a `PathSegment` is starts with the `crate` keyword, it is also the first segment of the `Path`
- All other usages of `crate` in `Path`s are considered errors.

This aligns with `rustc`'s rules. Unlike rustc this implementation does not issue a special error message in the case of `::crate` but it does catch the error.

Furthermore, this change does not cover all error cases. Specifically the following is not caught:

```rust
use foo::{crate}
```

This is because this check is context sensitive. From an AST perspective, `crate` is the root of the `Path`. Only by inspecting the full `UseItem` do we see that it is not in fact the root. This problem becomes worse because `UseTree`s are allowed to be arbitrarily nested:

```rust
use {crate, {{crate, foo::{crate}}}
```

So this is a hard problem to solve without essentially a breadth-first search. In a traditional compiler, I'd say this error is most easily found during the AST -> HIR conversion pass but within rust-analyzer I'm not sure where it belongs.  

Under the implementation in this PR, such errors are ignored so we're *more correct* just not *entirely correct*. 

Co-authored-by: John Renner <john@jrenner.net>
2020-04-30 10:17:40 +00:00
John Renner
0af727da91 Validate the location of crate in paths 2020-04-29 11:06:51 -07:00
Aleksey Kladov
b4dd475257 More principled approach for finding From trait 2020-04-29 14:51:44 +02:00
Benjamin Coenen
76733f0cd4 Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-04-29 14:08:30 +02:00
adamrk
0bd7d81805 Fix comment prefix method for four slash comments 2020-04-28 21:13:37 +02:00
adamrk
b6560e3ebb Treat comments beginning with four slashes as regular line comments 2020-04-28 10:23:45 +02:00
bors[bot]
7bc7173230
Merge #4134
4134: Special case for empty comments in doc comment kind  r=matklad a=edwin0cheng

Part of #4103

Fix `ui/empty/empty-comment.rs macros`

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-04-25 10:53:40 +00:00
Aleksey Kladov
e873469500 text-size 1.0.0 2020-04-25 12:15:32 +02:00
Aleksey Kladov
63a462f37c Switch to TryFrom 2020-04-25 11:59:18 +02:00
Aleksey Kladov
8843588fca Convert tests to text-size 2020-04-25 11:59:18 +02:00
Aleksey Kladov
b1d5817dd1 Convert code to text-size 2020-04-25 11:59:18 +02:00
Edwin Cheng
d20eea073e Special case for empty comments 2020-04-25 17:37:34 +08:00
bors[bot]
51a0058d4c
Merge #3998 #4006
3998: Make add_function generate functions in other modules via qualified path r=matklad a=TimoFreiberg

Additional feature for #3639 

- [x] Add tests for paths with more segments
- [x] Make generating the function in another file work
- [x] Add `pub` or `pub(crate)` to the generated function if it's generated in a different module
- [x] Make the assist jump to the edited file
- [x] Enable file support in the `check_assist` helper

4006: Syntax highlighting for format strings r=matklad a=ltentrup

I have an implementation for syntax highlighting for format string modifiers `{}`.
The first commit refactors the changes in #3826 into a separate struct.
The second commit implements the highlighting: first we check in a macro call whether the macro is a format macro from `std`. In this case, we remember the format string node. If we encounter this node during syntax highlighting, we check for the format modifiers `{}` using regular expressions.

There are a few places which I am not quite sure:
- Is the way I extract the macro names correct?
- Is the `HighlightTag::Attribute` suitable for highlighting the `{}`?

Let me know what you think, any feedback is welcome!

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
Co-authored-by: Leander Tentrup <ltentrup@users.noreply.github.com>
2020-04-24 20:10:54 +00:00
Aleksey Kladov
dd59237e0c minor 2020-04-23 23:18:18 +02:00
Aleksey Kladov
27dd0086ea Fully get rid of SyntaxNodePtr::range 2020-04-23 21:23:36 +02:00
Leander Tentrup
445052f6d4 Adapt format specifier highlighting to support escaped squences and unicode identifiers 2020-04-22 15:28:35 +02:00
Leander Tentrup
b2829a5216 Apply suggestions from code review
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
2020-04-22 10:18:46 +02:00
Timo Freiberg
f2f882bc44 Add pub(crate) to functions generated in other module 2020-04-21 23:04:44 +02:00
Timo Freiberg
317fc650d5 Make add_function generate functions in other modules via qualified path 2020-04-21 23:04:44 +02:00
bors[bot]
4a250021b1
Merge #4038
4038: Group generated ast boilerplate apart from the interesting part r=matklad a=Veetaha

Boilerplate `AstNode` and `From` impls are moved to the end further from the interesting part in `generated.rs`

Co-authored-by: veetaha <veetaha2@gmail.com>
2020-04-21 12:58:27 +00:00
Aleksey Kladov
8a04372fec Fix panic in split_imports assist
The fix is admittedly quit literally just papering over.

Long-term, I see two more principled approaches:

* we switch to a fully tree-based impl, without parse . to_string
  step; with this approach, there shouldn't be any panics. The results
  might be nonsensical, but so was the original input.

* we preserve the invariant that re-parsing constructed node is an
  identity, and make all the `make_xxx` method return an `Option`.

closes #4044
2020-04-20 16:34:01 +02:00
Leander Tentrup
ac798e1f7c Implement syntax highlighting for format strings
Detailed changes:
1) Implement a lexer for string literals that divides the string in format specifier `{}` including the format specifier modifier.
2) Adapt syntax highlighting to add ranges for the detected sequences.
3) Add a test case for the format string syntax highlighting.
2020-04-20 11:19:15 +02:00
veetaha
972d3b2ba3 Group generated ast boilerplate apart from the interesting part 2020-04-18 23:51:13 +03:00
Aleksey Kladov
cae2498513 Don't expose SyntaxNodePtr impl details 2020-04-16 21:01:04 +02:00
Aleksey Kladov
5e5eb6a108 Align grammar for record patterns and literals
The grammar now looks like this

   [name_ref :] pat
2020-04-12 00:00:15 +02:00
Aleksey Kladov
0aece75cdd Remove dead code 2020-04-11 19:36:31 +02:00
Aleksey Kladov
7a39bc3ba2 Make records grammar more orthogonal
We used

  name [: expr]

grammar before, now it is

  [name :] expr

which makes things simpler
2020-04-11 19:20:41 +02:00
Aleksey Kladov
997c959d4f
Merge pull request #3935 from cjhopman/todo
Change missing impl assist to use todo!() instead of unimplemented()
2020-04-11 16:05:23 +02:00
Aleksey Kladov
c1244c853c Forward compat 2020-04-11 00:27:00 +02:00
Chris Hopman
af04d45d32 Change missing impl assist to use todo!() instead of unimplemented()
todo!() "Indicates unfinished code" (https://doc.rust-lang.org/std/macro.todo.html)

Rust documentation provides further clarification:

> The difference between unimplemented! and todo! is that while todo!
> conveys an intent of implementing the functionality later and the
> message is "not yet implemented", unimplemented! makes no such claims.

todo!() seems more appropriate for assists that insert missing impls.
2020-04-10 13:56:12 -07:00
Aleksey Kladov
c476742f47 Simplify 2020-04-10 17:47:49 +02:00
Aleksey Kladov
5c5bde47fb Rename some tokens 2020-04-10 17:07:09 +02:00
Aleksey Kladov
d4332760d8 Better readability 2020-04-10 16:10:28 +02:00
Aleksey Kladov
e0f02d233f Remove dead code 2020-04-10 16:10:28 +02:00
Aleksey Kladov
4560fe2abf Generate only minimal set of ineresting tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
8d71a6bf0c Scale token generation back 2020-04-10 16:10:28 +02:00
Aleksey Kladov
779f06ed77 Convert more tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
548f562dda Other delimiters 2020-04-10 16:10:28 +02:00
Aleksey Kladov
460c8bbdec Curley tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
1c5d859195 Start replacing tokens 2020-04-10 16:10:28 +02:00
Aleksey Kladov
c8b4c36f81 Semicolon token 2020-04-10 16:10:28 +02:00
Aleksey Kladov
f89f2e3885 More readable ast_src for keywords 2020-04-10 16:10:28 +02:00
Aleksey Kladov
30084a56a5 Simpler acessors for keywords 2020-04-09 23:42:01 +02:00
Aleksey Kladov
00ec0c1066 use uniform accessor 2020-04-09 23:19:51 +02:00
Aleksey Kladov
046a021013 use stdx 2020-04-09 23:05:13 +02:00
Aleksey Kladov
0ed27c388a Drop needless trait 2020-04-09 23:02:10 +02:00
Aleksey Kladov
e07d3c94de Remove code duplication 2020-04-09 22:22:58 +02:00
Aleksey Kladov
2bfb65db93 Be consistent about token accesors 2020-04-09 18:48:13 +02:00
Aleksey Kladov
e6d22187a6 Add _token suffix to token accessors
I think this makes is more clear which things are : AstNode and which
are : AstToken
2020-04-09 18:25:36 +02:00
Aleksey Kladov
a95116fbfa Simplify 2020-04-09 18:20:06 +02:00
Aleksey Kladov
56c8581b90 Put displays at the end 2020-04-09 18:11:16 +02:00
Aleksey Kladov
9285cbffb6 More compact 2020-04-09 18:08:54 +02:00
Aleksey Kladov
6fd2a12495 More compact generated code 2020-04-09 18:07:16 +02:00
Aleksey Kladov
4a063e651f Move the rest of the tokens to generated/tokens 2020-04-09 17:58:15 +02:00
Aleksey Kladov
c80795e274 Move generated tokens to a separate file 2020-04-09 17:47:46 +02:00
Aleksey Kladov
59b6b2278b Start ast/generated/tokens 2020-04-09 16:25:06 +02:00
Aleksey Kladov
d61932ef7e Prepare for spliting generated into tokens and nodes 2020-04-09 16:17:18 +02:00
Aleksey Kladov
738fc79c92 Remove allocations from LCA
I haven't actually profiled this, but not allocating a hash map (or
anything, really) seems like a good idea
2020-04-09 13:56:45 +02:00
Luca Barbieri
74e3b48806 Parse correctly fn f<T>() where T: Fn() -> u8 + Send {}
We used to parse it as T: Fn() -> (u8 + Send), which is different from
the rustc behavior of T: (Fn() -> u8) + Send
2020-04-09 13:05:41 +02:00
Aleksey Kladov
689661c959 Scale back to only two traits 2020-04-09 13:00:09 +02:00
Luca Barbieri
60f4d7bd8c Provide more complete AST accessors to support usage in rustc 2020-04-09 11:50:37 +02:00
Aleksey Kladov
8f01e62bb9 Scale back the traits 2020-04-09 11:04:18 +02:00
Luca Barbieri
68196ccc10 Add AstElement trait, generate tokens, support tokens in enums
- Adds a new AstElement trait that is implemented by all generated
  node, token and enum structs

- Overhauls the code generators to code-generate all tokens, and
  also enhances enums to support including tokens, node, and nested
  enums
2020-04-08 17:15:12 +02:00