bors[bot]
91e7a3b6f2
Merge #983
...
983: support remainder assignment operator r=matklad a=JeanMertz
`%=` was returning errors for me, turns out it wasn't added as a valid assignment operation.
I'm not sure what the best location would be to add a test for this. Please let me know and I'll add one.
Co-authored-by: Jean Mertz <jean@mertz.fm>
2019-03-17 14:34:14 +00:00
Jean Mertz
a8ee994ae0
support remainder assignment operator
2019-03-17 14:11:24 +01:00
pcpthm
a67fe4ea7e
Fix parse tree of attribute on match arm
2019-03-17 20:57:27 +09:00
pcpthm
a1d84f5fb0
Allow attribute on struct literal field
2019-03-17 19:08:35 +09:00
Aleksey Kladov
182c05a96c
add name resolution from the old impl
...
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Michael Chesser
943d2fb781
Add test for minus in inner pattern
2019-03-14 19:24:12 +10:30
Caio
cc9721996c
Add test for async block
2019-03-10 14:35:25 -03:00
Caio
ad72699553
Add async keyword
2019-03-09 20:40:22 -03:00
Ville Penttinen
1f4468a8da
Add support for parsing multiple if and while-let patterns
2019-03-04 19:10:14 +02:00
Aleksey Kladov
90122542b2
allow mut ident
patterns in trait methods
...
closes #928
2019-03-04 17:47:02 +03:00
Aleksey Kladov
0a19f4f1b4
allow aliases in underscores
...
this helps with
use foo::Trait as _;
syntax
2019-03-04 16:40:08 +03:00
bors[bot]
dc8bcc1e42
Merge #926
...
926: allow vararg functions r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-04 12:49:37 +00:00
Aleksey Kladov
77f2381eea
improve error recovery
...
parse the contents of error block as an expression
2019-03-04 15:31:18 +03:00
Aleksey Kladov
a99b1db49f
allow vararg functions
2019-03-04 14:34:59 +03:00
Ville Penttinen
d3ce69aee3
Remove TypeRef
from item opts which implement TypeAscriptionOwner
2019-02-27 14:08:09 +02:00
Ville Penttinen
6eb070d661
Add new trait TypeAscriptionOwner
...
This trait should be implemented for nodes which have an ascribed type,
e.g. thing : Type. Such as let, const, static, param, named struct fields.
2019-02-26 11:35:57 +02:00
Aleksey Kladov
78f10fcdc4
rename type to type_alias in the AST as well
2019-02-25 13:49:32 +03:00
Aleksey Kladov
65a2be4953
complete struct literals
2019-02-24 17:01:56 +03:00
Aleksey Kladov
666303faf3
support upcastig in AST enum
2019-02-24 16:57:05 +03:00
Aleksey Kladov
f078f7adc8
introduce tree builder
2019-02-23 16:55:01 +03:00
Aleksey Kladov
0c1cb98182
rename
2019-02-23 16:07:29 +03:00
bors[bot]
5100aeac42
Merge #876
...
876: Fix join_lines not adding a comma after join_single_expr_block with match arm r=matklad a=vipentti
Fixes #868
Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-21 16:55:26 +00:00
Ville Penttinen
82173c8de4
Move non_trivia_sibling
to ra_syntax::algo
2019-02-21 18:49:03 +02:00
Aleksey Kladov
4fe07a2b61
add API guide to ra_syntax
2019-02-21 17:35:45 +03:00
Aleksey Kladov
7060a39d5c
simplify trait bounds
2019-02-21 16:12:15 +03:00
Aleksey Kladov
b51b71bf25
rearrange methods
2019-02-21 16:04:03 +03:00
Aleksey Kladov
f7f99af0a6
kill utils module
2019-02-21 15:57:40 +03:00
Aleksey Kladov
6225e1ab70
Ignore lockfile in fuzz
...
It's too much trouble maintaining it
2019-02-21 15:44:38 +03:00
Aleksey Kladov
412ac63ff5
docs
2019-02-21 15:24:42 +03:00
Aleksey Kladov
c47f9e2d37
fix compilation
2019-02-21 13:37:32 +03:00
Aleksey Kladov
d334b5a1db
move parser to a separate crate
2019-02-21 13:27:45 +03:00
Aleksey Kladov
cd0d2866fc
make grammar independent of syntax tree
2019-02-21 12:12:04 +03:00
Aleksey Kladov
1b2e70df99
minor
2019-02-21 12:05:52 +03:00
Aleksey Kladov
79ce0fa8d7
move whitespace handling to tree builder
2019-02-21 12:03:42 +03:00
Aleksey Kladov
882c47f187
move syntax error to parser
2019-02-20 23:17:07 +03:00
Aleksey Kladov
61992dc1cd
simplify
2019-02-20 23:05:59 +03:00
Aleksey Kladov
4c1f9b8d4e
remove TokenPos
2019-02-20 23:02:24 +03:00
Aleksey Kladov
cce23fddba
flattern module structure
2019-02-20 22:52:32 +03:00
Aleksey Kladov
2acb21e8f7
merge parse_impl and parser_api
2019-02-20 22:44:06 +03:00
Aleksey Kladov
e72ad0a2fa
fix off by one error
2019-02-20 22:27:49 +03:00
Aleksey Kladov
2b5e336ce7
move abstract traits to top
2019-02-20 22:19:12 +03:00
Aleksey Kladov
d2bce118ae
switch to dynamic dispatch for TokenSource
...
Benchmarks show no difference. This is probably because we are
bottlenecked on memory allocations, and we should fix that, but we are
not optimizing for performance just yet.
changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit. # # On branch token-source # Changes to be
committed: # modified: crates/ra_syntax/src/parsing/parser_api.rs #
modified: crates/ra_syntax/src/parsing/parser_impl.rs #
2019-02-20 22:02:03 +03:00
Aleksey Kladov
0c81b9deee
route parsing via TokenSource trait
2019-02-20 21:50:07 +03:00
Aleksey Kladov
3517c175ac
rename Sink -> TreeSink
2019-02-20 21:08:59 +03:00
Aleksey Kladov
86a67dce25
fix tests
2019-02-20 16:48:06 +03:00
Aleksey Kladov
45fc91cc47
rearrange modules in a suggestd reading order
2019-02-20 16:24:39 +03:00
Aleksey Kladov
a4a1e08ab8
flatten modules
2019-02-20 16:16:14 +03:00
Aleksey Kladov
9f6883fbf1
move reparsers to grammar
2019-02-20 16:02:06 +03:00
Aleksey Kladov
5a6eda528c
tighten visibility
2019-02-20 15:57:26 +03:00
Aleksey Kladov
5222b8aba3
move all parsing related bits to a separate module
2019-02-20 15:47:32 +03:00
Aleksey Kladov
9d0cda4bc8
slightly better name
2019-02-20 15:03:31 +03:00
Aleksey Kladov
df6efe62c5
make stuff private
2019-02-20 14:53:19 +03:00
Aleksey Kladov
4e8a3f565b
handle != operator
2019-02-18 10:09:44 +03:00
Ville Penttinen
58d14bcaf7
Enable parsing attributes for generic lifetimes and type parameters
2019-02-17 23:32:10 +02:00
Ville Penttinen
bb25958705
Remove match_armlist validator
2019-02-17 20:32:10 +02:00
Ville Penttinen
96e3ac389f
Parse only outer_attributes for match arms for now
2019-02-17 19:48:08 +02:00
Ville Penttinen
1c97c1ac11
Enable parsing of attributes inside a match block
...
We allow invalid inner attributes to be parsed, e.g. inner attributes that are
not directly after the opening brace of the match block.
Instead we run validation on `MatchArmList` to allow better reporting of errors.
2019-02-17 19:26:57 +02:00
Florian Diebold
a1bda3fc08
Handle generic args for method calls
2019-02-16 23:06:41 +01:00
Florian Diebold
da7056245d
Add generic params to impl blocks
2019-02-16 23:06:41 +01:00
Florian Diebold
1526eb25c9
Import the prelude
2019-02-13 20:10:09 +01:00
Aleksey Kladov
4e91c23c79
rename yellow -> syntax_node
...
why yellow in the first place? Its red + green.
2019-02-12 19:02:30 +03:00
Aleksey Kladov
2efdf41bdb
make macro a NameOwner
2019-02-11 19:24:13 +03:00
Ville Penttinen
710975ecd8
Fix typo in Cargo.toml authors
...
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d
Update authors field in Cargo.tomls to "rust-analyzer developers"
...
This closes #777
2019-02-11 08:55:35 +02:00
Florian Diebold
f1afc93353
Fix handling of literal patterns
...
Wrap them in a LiteralPat node so they can be distinguished from literal
expressions.
2019-02-09 21:37:30 +01:00
Florian Diebold
fcd615e4b7
Extract project model to separate crate
2019-02-09 11:15:25 +01:00
Aleksey Kladov
12e3b4c70b
reformat the world
2019-02-08 14:49:43 +03:00
kjeremy
852b083794
Fill deprecation for LSP
2019-02-05 17:05:46 -05:00
Florian Diebold
e163c908ac
Add AST for extern crate
...
Also change it to parse the crate name as a NAME_REF, not a NAME.
2019-02-04 21:49:34 +01:00
DJMcNab
7417c0775b
Fix number of extern_inner_attributes
2019-02-02 16:18:12 +00:00
Florian Diebold
5a7fce4e4c
Pass aliases to ImportData
2019-02-02 00:23:53 +01:00
Aleksey Kladov
3bd4560d6e
convert punts and literals
2019-01-31 22:23:30 +02:00
bors[bot]
97ade89993
Merge #692
...
692: [WIP] Correctly parse attributes r=matklad a=DJMcNab
Reference - https://doc.rust-lang.org/reference/attributes.html
This fixes/investigates inner attributes for:
- [x] `impl` blocks
- [x] `extern` blocks
- [x] `fn`s (fixes #689 )
- [x] `mod`s (already supported)
- [x] 'block expressions' (the long text just describes all 'blocks' used as statements)
This also investigates/fixes outer attributes for:
- [ ] 'most statements' (see also: #685 , https://doc.rust-lang.org/reference/expressions.html#expression-attributes )
- [x] Enum variants, Struct and Union fields (Fixed in #507 )
- [ ] 'Match expression arms' (@matklad can you provide a test case which explains what this means?)
- [ ] 'Generic lifetime or type parameters'
- [ ] 'Elements of array expressions, tuple expressions, call expressions, tuple-style struct and enum variant expressions'
- [ ] 'The tail expression of block expressions'
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2019-01-31 07:06:31 +00:00
Marcus Klaas de Vries
3daca3eb4d
Infer type of match guard
2019-01-28 23:09:14 +01:00
DJMcNab
00e6b5d26c
Parse and validate attributes in blocks
2019-01-28 20:03:56 +00:00
DJMcNab
137b1ccb71
Add a test for inner attributes on extern blocks
2019-01-27 15:20:36 +00:00
DJMcNab
73b075c556
Correctly parse inner attributes of impl blocks
2019-01-27 14:55:03 +00:00
Erlend Tobiassen
e2e1f4ceca
Typos
2019-01-27 15:19:42 +01:00
bors[bot]
964086e0d4
Merge #685
...
685: Support attributes on let statements r=matklad a=DJMcNab
Fix #677 .
Co-authored-by: DJMcNab <36049421+djmcnab@users.noreply.github.com>
2019-01-27 09:04:02 +00:00
DJMcNab
4d35cc3875
Stop using let_stmt twice
2019-01-27 09:00:57 +00:00
bors[bot]
ffcf618842
Merge #662
...
662: Preserve indentation in doc comments r=matklad a=kjeremy
Fixes #502
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-01-27 08:21:04 +00:00
Aleksey Kladov
7177fffd7b
fix verification on CI
...
remove `--verify` flag from the binaries: we have tests for this!
2019-01-27 02:30:54 +03:00
DJMcNab
7055d43c3a
Make attrs be a child of the let statement
2019-01-26 22:02:23 +00:00
Aleksey Kladov
619af1e22c
fix AST for if expressions
...
then is not always a block...
2019-01-27 00:37:11 +03:00
DJMcNab
55a3e21ac4
Support attributes on let statements
2019-01-26 21:35:03 +00:00
DJMcNab
7a76433c45
Struct literals should not be a BlockLike::Block
2019-01-26 18:45:29 +00:00
Aleksey Kladov
6f862a6704
⬆️ rowan
...
The new rowan uses arena allocator for red nodes which helps
slightly (5% on std completion test) with performance but should help
quite a bit with avoiding memory fragmentation.
2019-01-26 19:39:31 +03:00
Jeremy Kolb
a892067951
Make doc comments optional
2019-01-26 10:35:23 -05:00
Jeremy Kolb
e9e0ea0398
Do not unconditionally trim comments
2019-01-26 09:55:30 -05:00
Jeremy Kolb
8c08b6825e
Preserve indentation in doc comments
2019-01-26 09:50:17 -05:00
bors[bot]
2acaa92c93
Merge #660
...
660: Support macro calls in type position r=matklad a=regiontog
A [playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=fdc6dd4ddaece92a72fa2a292b75e27c ) demonstrating the syntax in question.
Co-authored-by: Erlend Tobiassen <erlend.tobiassen@gmail.com>
2019-01-26 10:23:28 +00:00
Erlend Tobiassen
e28bd099d6
Support macro calls in type position
2019-01-25 23:56:31 +01:00
Aleksey Kladov
23172a116c
rename POS_FIELD -> POS_FIELD_DEF
...
to match NAMED_FIELD_DEF
2019-01-26 00:24:12 +03:00
Jeremy A. Kolb
7a0bc2dd64
Add docs to struct fields
2019-01-25 14:29:56 -05:00
bors[bot]
675943712c
Merge #630
...
630: Fill in DocumentSymbol::detail r=matklad a=hban
Closes : #516
I just pulled type text from the syntax node and "formatted" is bit. VS Code can't really handle multi-line symbol detail (it's will crop it when rendering), so that formatting will just collapse all white-space to singe space. It isn't pretty, but maybe there's a better way.
Issue also mentions "need to be done for `NavigationTarget` to `SymbolInformation`", but `SymbolInformation` doesn't have detail field on it?
Co-authored-by: Hrvoje Ban <hban@users.noreply.github.com>
2019-01-25 07:13:16 +00:00
bors[bot]
1d4b421aad
Merge #633
...
633: use ToOwned trait instead of inherent method r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-24 23:10:09 +00:00
Aleksey Kladov
2e354f480b
use ToOwned trait instead of inherent method
2019-01-25 02:09:31 +03:00
bors[bot]
c42db0bbd7
Merge #623
...
623: WIP: module id is not def id r=matklad a=matklad
This achieves two things:
* makes module_tree & item_map per crate, not per source_root
* begins the refactoring to remove universal `DefId` in favor of having separate ids for each kind of `Def`. Currently, only modules get a differnt ID though.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-01-24 22:56:13 +00:00
Aleksey Kladov
0f2f3a21e7
Migrate trait & type to new ids
2019-01-25 01:31:32 +03:00
DJMcNab
107d6a0a16
Reformat
2019-01-24 22:01:49 +00:00
Daniel McNab
82dfb00157
Apply suggestions from code review
...
Co-Authored-By: DJMcNab <36049421+DJMcNab@users.noreply.github.com>
2019-01-24 21:41:02 +00:00
DJMcNab
f0e5a314b0
Dedupe PATH_FIRST in ATOM_EXPR_FIRST
2019-01-24 21:31:43 +00:00
DJMcNab
4899e7be76
Support universal function call syntax in function calls
2019-01-24 21:19:16 +00:00
Hrvoje Ban
4eff8ddb8b
Fill in DocumentSymbol::detail
2019-01-24 19:05:26 +01:00
Aleksey Kladov
566c8e321e
migrate enums to new id
2019-01-24 18:56:38 +03:00
Aleksey Kladov
a00570d7a3
minor rename
2019-01-24 13:40:36 +03:00
Jeremy A. Kolb
6a6ce2bc95
Make EnumVariant a DocCommentsOwner
2019-01-23 16:23:21 -05:00
Josh Robson Chase
2ffea72f74
More correct raw ident handling
2019-01-23 13:57:17 -05:00
Josh Robson Chase
3b70acad01
Use IDENT for both raw and normal idents
2019-01-23 13:19:49 -05:00
Josh Robson Chase
1cd6d6539a
Add raw idents to lexer and parser
2019-01-23 13:17:41 -05:00
Aleksey Kladov
d4ed25d86f
introduced better typed AstPtr
2019-01-23 18:26:02 +03:00
Aleksey Kladov
7b901f86cd
move SyntaxPtr to ra_syntax
2019-01-23 17:37:10 +03:00
gfreezy
13d2fd32ab
fix completion bugs
2019-01-23 15:43:47 +08:00
Aleksey Kladov
7b28a15202
⬆️ rowan
2019-01-22 23:37:03 +03:00
Erlend Tobiassen
c550c6759d
Add test for placeholder parameters in trait fn defs
2019-01-22 18:46:15 +01:00
Erlend Tobiassen
234b65fd61
Allow placeholder parameters in trait fn defs
2019-01-22 18:33:53 +01:00
Erlend Tobiassen
84f888e93d
No need for is_type_start
2019-01-22 14:46:06 +01:00
Erlend Tobiassen
9f3d133813
Prefer TYPE_FIRST
2019-01-22 14:36:57 +01:00
Erlend Tobiassen
8198cde13b
Update tests after allowing where predicate to accept types
2019-01-22 14:32:23 +01:00
Erlend Tobiassen
2b22f5fb43
Optimistically bail out of where clause loop if not at start of a type or lifetime
2019-01-22 13:17:10 +01:00
Erlend Tobiassen
1aba42128f
Don't leave a marker hanging without completing it.
2019-01-22 01:25:00 +01:00
Erlend Tobiassen
1059ec74e2
Allow types to the left of : in where predicates.
2019-01-22 01:11:35 +01:00
Florian Diebold
5862542ded
Add AST/HIR for type args in path segments
2019-01-19 16:02:06 +01:00
Marcus Klaas de Vries
fa43ef30f4
Change parsing of struct field patterns
2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
bcbfa2cc11
Finish move of StructField for pattern type inference
2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
f9a6050034
Move parsing of field pattern lists to the parser (where it belongs)
2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
d48d5b8b6c
Add initial (flawed) implementation of binding annotations
2019-01-19 15:37:26 +03:00
Marcus Klaas de Vries
ac216880f5
Implement unlabeled struct field pattern inference
2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
ab5deb7811
Create struct patterns up to the hir level
2019-01-19 15:37:25 +03:00
Marcus Klaas de Vries
afaa26636e
Add additional pattern variants
2019-01-19 15:37:25 +03:00
Aleksey Kladov
b82fe73d1a
make token set a const-fn
2019-01-19 15:36:58 +03:00
Hirokazu Hata
4729a1b054
Update ARRAY_EXPR grammar
2019-01-16 23:22:14 +09:00
bors[bot]
d75a0368f5
Merge #536
...
536: Introduce variable semicolon block expr r=matklad a=yerke
Fix for https://github.com/rust-analyzer/rust-analyzer/issues/504
Feels a bit hacky...
Co-authored-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
2019-01-16 06:20:09 +00:00
Yerkebulan Tulibergenov
5e35f191fc
add has_semi to ExprStmt
2019-01-15 20:26:46 -08:00
Aleksey Kladov
dd45697e53
update salsa
2019-01-15 15:06:45 +03:00
Marcus Klaas de Vries
d67eabb512
Fix type inference for raw (byte) strings
2019-01-14 20:56:14 +01:00
Marcus Klaas de Vries
a9a6a50c75
Fixup tests
2019-01-14 19:30:21 +01:00
Marcus Klaas de Vries
606d66a714
Start moving literal interpretation to the AST (WIP)
2019-01-14 13:56:43 +01:00
Marcus Klaas de Vries
5f5dc20d85
Try implementing integer type inference (WIP)
2019-01-14 13:52:57 +01:00
Marcus Klaas de Vries
a6146d35b1
Implement type inference for literals (WIP)
2019-01-14 13:52:55 +01:00
Hirokazu Hata
6efda8f6ce
Update TUPLE_EXPR grammar
2019-01-13 21:04:03 +09:00
Aleksey Kladov
8e554ea5fa
support ref-patterns
2019-01-13 13:36:06 +03:00
DJMcNab
0b9e462ab0
Fix handling of attributes in positional field lists
2019-01-12 15:42:12 +00:00
Aleksey Kladov
2d3940d0ab
rename TreePtr -> TreeArc
...
This is much clearer about the semantics
2019-01-11 19:59:06 +03:00
Aleksey Kladov
66d7adf1cb
force serde in ra_syntax
2019-01-11 13:21:18 +03:00
DJMcNab
afdb569902
Fix handling of where clauses in tuple structs
2019-01-10 18:21:01 +00:00
Aleksey Kladov
d18d8399f5
fuzz-lockfile
2019-01-09 01:58:25 +03:00
Aleksey Kladov
921689b70d
kill text utils
2019-01-08 22:03:13 +03:00
Aleksey Kladov
f553837c1c
upstream text-utils to text_unit
2019-01-08 21:50:04 +03:00
Aleksey Kladov
0c88360eb4
add comment
2019-01-08 21:01:41 +03:00