Michael Bradshaw
7531e1579d
Parse arbitrary self types as PatIdent
2018-10-19 22:26:56 -07:00
David Tolnay
7926839cb8
Allow true/false as the name in a MetaNameValue
2018-10-13 19:55:48 -07:00
David Tolnay
f1a1026336
Format with rustfmt 0.99.5-nightly
2018-10-13 15:33:50 -07:00
David Tolnay
f98865f0bb
Move parse_macro_input to a different trait
2018-10-13 14:58:25 -07:00
Carl Lerche
fbe5056de0
Implement ParseQuote for Vec<NestedMeta>
2018-10-12 22:20:25 -07:00
Carl Lerche
ae0fa60fa0
Provide Attribute::parse_meta
function
...
This function is a replacement for `interpret_meta` and uses the `Parse`
implementation for `Meta`.
2018-10-12 21:46:54 -07:00
Carl Lerche
fc96cd272f
Implement Parse for meta item types
...
The various meta item types have been missing `Parse` implementations.
This makes parsing the argument to Rust's proc macros difficult.
This patch provides Parse implementation for:
* Meta
* MetaList
* MetaNameValue
* NestedMeta
A first step towards the goals stated in #359 .
2018-10-12 20:46:30 -07:00
David Tolnay
fb84fc060e
Format with rustfmt 0.99.5-nightly
2018-10-02 21:01:30 -07:00
David Tolnay
35cb3407dd
Compiler now tracks whether module declarations are inline
2018-09-27 22:39:18 -07:00
David Tolnay
0eab7d956d
OneVector type alias has been removed
2018-09-26 22:10:40 -07:00
David Tolnay
d4561ca01e
Update test suite to nightly-2018-09-23
2018-09-23 01:42:12 -07:00
David Tolnay
3dc50486e1
Download test suite as tgz rather than git
2018-09-22 14:06:43 -07:00
David Tolnay
abbf819510
Format with rustfmt 0.99.4-nightly
2018-09-22 13:24:46 -07:00
David Tolnay
4c510044cc
Parse boolean literal in nested meta
2018-09-12 00:04:51 -07:00
David Tolnay
2b940f62cc
Update comparison of nightly syntax trees for DelimSpan change
2018-09-09 22:16:43 -07:00
David Tolnay
38012deef8
Allow where-clause to end at end of input
2018-09-02 13:34:30 -07:00
David Tolnay
9c119120b8
Accept let
as an expression
2018-09-01 19:10:13 -07:00
David Tolnay
bcf3688b9b
Merge branch master into next
2018-09-01 18:16:49 -07:00
David Tolnay
83c89013b9
Comparison of refactored match guards
2018-09-01 18:15:53 -07:00
David Tolnay
59e9631b80
No longer require so much stack space
2018-09-01 11:50:25 -07:00
David Tolnay
80a914fb21
Merge synom and parse modules
2018-08-30 23:52:06 -07:00
David Tolnay
73b7ca1697
Format with rustfmt 0.99.2
2018-08-30 21:05:13 -07:00
David Tolnay
59ffad9d7a
Remove Synom from test suite
2018-08-30 21:01:04 -07:00
David Tolnay
eecab7c41b
Simplify attribute parsing in test
2018-08-30 17:00:54 -07:00
David Tolnay
6e1e505ea5
Implement atom_expr
2018-08-30 11:35:43 -07:00
David Tolnay
f8106f843b
Give new signature the desirable name
2018-08-25 21:17:45 -04:00
David Tolnay
b625418e16
Lift parse.rs and lookahead.rs into syn
2018-08-25 08:45:36 -04:00
David Tolnay
ad4b247cf0
Unify the error modules
2018-08-25 08:26:05 -04:00
David Tolnay
1d8e996b4a
Store optional label in Expr::Block
2018-08-24 19:04:20 -04:00
David Tolnay
fb2dd4b7f4
Parse try-blocks as Expr::TryBlock
2018-08-24 18:51:50 -04:00
David Tolnay
d17b64fb18
Format with rustfmt 0.99.2
2018-08-24 16:46:10 -04:00
Yusuke Sasaki
4e5d9660e7
Async closures
2018-08-24 16:37:09 -04:00
Yusuke Sasaki
f00a3efc7d
Async functions and methods
2018-08-24 16:35:30 -04:00
David Tolnay
fe583306aa
Remove Attribute::is_sugared_doc
2018-08-24 16:09:34 -04:00
David Tolnay
0c7fed6e8a
Skip try blocks in bracket fold
2018-08-24 15:56:42 -04:00
David Tolnay
d1c31cc713
Update tests to nightly-2018-08-23
2018-08-24 15:26:17 -04:00
David Tolnay
758ee135c2
Parse existential types as verbatim
2018-08-21 21:29:40 -04:00
David Tolnay
e9ceb542d8
Bring in new test cases from 2018-08-18
2018-08-21 21:04:33 -04:00
David Tolnay
0ccb6d1786
Wrap comments when formatting with rustfmt
2018-08-14 22:43:00 -07:00
David Tolnay
c8659929be
Pick up changes to rustc data structures in nightly
2018-08-14 22:40:50 -07:00
David Tolnay
78572112cf
Parse macros_in_extern as ForeignItemVerbatim
2018-08-01 00:36:18 -07:00
David Tolnay
61e15e53b4
Hide labeled blocks from precedence test
2018-08-01 00:28:36 -07:00
David Tolnay
5d08ae619b
Parse labeled blocks as ExprVerbatim
2018-08-01 00:08:48 -07:00
David Tolnay
18a2582d48
Merge pull request #465 from ubnt-intrepid/async-verbatim
...
accept async functions and closures as verbatim
2018-07-31 22:02:01 -07:00
David Tolnay
57a2886ce8
Clean up confusing match-expression
2018-07-31 21:47:10 -07:00
David Tolnay
a25d1dcb9e
Format with rustfmt 0.9.0
2018-07-31 21:46:19 -07:00
David Tolnay
5d871d99cb
Configure libsyntax to 2018 edition
2018-07-31 21:43:10 -07:00
Yusuke Sasaki
0678b917b2
enable test cases for async/await
2018-08-01 05:29:12 +09:00
David Tolnay
b022d0663c
Parse unions in a DeriveInput
2018-07-21 18:59:36 -07:00
David Tolnay
72972e766f
Update equality comparison of existential types
2018-07-21 18:35:24 -07:00
David Tolnay
5d314dcd9a
Parse attributes on expressions
2018-07-21 18:16:17 -07:00
David Tolnay
73c9b52921
Parse outer attributes on literal and path expressions
2018-07-21 15:58:40 -07:00
David Tolnay
713a67279d
Parse outer attributes on closures
2018-07-21 15:49:40 -07:00
David Tolnay
5c4613a7d7
Parse inner attributes within foreign mod
2018-07-21 15:40:17 -07:00
David Tolnay
0a4d4e9f9a
Support feature(extern_in_paths)
2018-07-21 15:31:45 -07:00
David Tolnay
84434f60b6
Unreserve former keywords: pure, offsetof, sizeof, alignof
2018-07-21 15:13:59 -07:00
David Tolnay
caa2a6d605
Parse where-clause on associated types
2018-07-21 15:08:07 -07:00
David Tolnay
682c663bb6
File tickets against unsupported syntax
2018-07-21 14:59:05 -07:00
David Tolnay
d7c5d02d41
Triage the ignored test cases
2018-07-21 14:33:01 -07:00
David Tolnay
b965d8557d
Triage test case that requires extern_in_paths
2018-07-21 14:11:15 -07:00
David Tolnay
c6b5e81281
Ignore distinction between DotDotEq and DotDotDot in tests
2018-07-21 14:04:28 -07:00
David Tolnay
a27f29fc8d
Bump the test suite to rustc nightly-2018-07-19
2018-07-21 13:25:23 -07:00
David Tolnay
ecd024d452
Implement eq for libsyntax data structures
2018-07-21 13:06:31 -07:00
David Tolnay
0cec3e6f3e
Format with rustfmt 0.8.2
2018-07-21 09:08:30 -07:00
David Tolnay
f36af87bab
Parse crate::X in newtype as (crate::X) not crate(::X)
2018-06-30 23:16:08 -07:00
David Tolnay
d228b33fb1
Fix clippy lints
2018-06-28 00:00:24 -07:00
David Tolnay
05ef7ee854
Update test suite to nightly-2018-06-27
2018-06-27 23:46:38 -07:00
David Tolnay
28da13c516
Update test suite to nightly-2018-06-26
2018-06-27 00:39:21 -07:00
David Tolnay
0bb614f154
Update nightly libsyntax api for parsing an expr
2018-06-14 21:41:43 -07:00
hcpl
aa51179851
Replace TokenStream::empty
with ::new
...
`TokenStream::empty` is deprecated since `proc-macro2` 0.4.4.
2018-05-29 07:22:54 +03:00
David Tolnay
65fb5664a8
Format with rustfmt 0.7.0
2018-05-20 20:02:28 -07:00
David Tolnay
857e7e711f
Merge pull request #426 from alexcrichton/next
...
Update to the next version of proc-macro2
2018-05-20 18:10:38 -07:00
David Tolnay
446f7d6da0
Eliminate to_string() in Ident comparisons
2018-05-20 18:09:51 -07:00
Alex Crichton
3fec393878
Fix up some final issues
2018-05-20 16:41:41 -07:00
Geoffry Song
ac02b1810f
Don't parse a plus sign when parsing a function type's return type.
2018-05-19 22:11:31 -07:00
Alex Crichton
9dc5d0ea55
Fix test_grouping
2018-05-17 11:09:21 -07:00
Alex Crichton
eaa6e43704
Fix test_lit
2018-05-17 11:08:58 -07:00
Alex Crichton
0f1813d4e8
Fix test_token_trees
2018-05-17 11:08:03 -07:00
Alex Crichton
78e92a7d12
Fix test_meta_item
2018-05-17 11:07:06 -07:00
Alex Crichton
499ed64f1e
Fix test_ident
2018-05-17 11:02:02 -07:00
Alex Crichton
eed4bc7b59
Fix test_generics
2018-05-17 10:59:15 -07:00
Alex Crichton
a86282f4d4
Fix test_derive_input
2018-05-17 10:50:22 -07:00
Alex Crichton
bfec0d313f
Fix test_expr
2018-05-17 10:48:24 -07:00
David Tolnay
b57c8495b4
Format with rustfmt 0.6.1
2018-05-05 00:34:01 -07:00
David Tolnay
313a36f990
Parse match arm containing block expression
2018-04-29 20:19:52 -07:00
David Tolnay
8157e5ef2c
Remove incomplete test explanation
2018-04-29 20:04:30 -07:00
David Tolnay
94d2b79e90
Format with rustfmt 0.4.2
2018-04-29 12:26:52 -07:00
David Tolnay
98753eee3f
Format tests with rustfmt 0.4.1
2018-04-06 22:46:08 -07:00
David Tolnay
a31749964d
Simplify some Folder implementations in tests
2018-04-06 22:42:09 -07:00
David Tolnay
ffc86765f3
Fix precedence test for nightly-2018-04-06
2018-04-06 22:13:41 -07:00
David Tolnay
7066224af3
Remove placement operator from tests
2018-04-05 08:08:32 -07:00
Alex Crichton
c31fc682ad
Fix syn's tests with doc comment lex fixes
...
* Don't expect `is_sugared_doc` to be true
* Ensure we don't expect `///` in doc comment values
* When testing against libsyntax, process streams like `foo! { /** ... */ }` by
manually expanding the `DocComment` token that libsyntax parses. The
`proc-macro2` crate will expand that as a doc attribute unconditionally.
2018-04-04 15:07:21 -07:00
David Tolnay
3beadb7342
Accept _
in Ident::new
2018-04-04 07:53:50 -07:00
David Tolnay
d741aa849b
Add tests for Ident::new and Ident::parse
2018-04-04 07:53:10 -07:00
David Tolnay
eb7d79b35f
Format with rustfmt 0.4.1
2018-03-31 22:52:17 +02:00
David Tolnay
1208dcef5b
Update the rust-lang/rust commit we test
2018-03-31 22:50:09 +02:00
David Tolnay
c1f5d5dfbb
Capture parens in trait bound
2018-03-31 22:18:24 +02:00
David Tolnay
6fc475f758
Update test_expr with multiple patterns in Local
2018-03-31 21:09:24 +02:00
David Tolnay
13b6a1331a
Ignore macro-comma-support.rs test case
2018-03-31 20:38:58 +02:00
David Tolnay
e2099f3b86
Consistent new
signature between Ident and Lifetime
2018-03-31 18:42:43 +02:00
David Tolnay
fe58b5a725
Represent crate
visibility specifier
2018-03-31 18:24:09 +02:00
Alex Crichton
9a4dca26c9
Update to proc-macro2 0.3 and tweak apis
2018-03-31 16:55:52 +02:00
David Tolnay
5d1a3ee883
Set up libsyntax globals for tests
2018-03-17 19:41:36 -07:00
David Tolnay
e913492b3a
Merge pull request #371 from ignatenkobrain/patch-1
...
deps: update walkdir to 2
2018-03-17 13:05:47 -07:00
David Tolnay
54bdb4f2a8
Clean up redundant_field_names lint in tests
2018-03-17 13:00:45 -07:00
Igor Gnatenko
951a52be05
deps: update walkdir to 2
...
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-03-12 10:44:09 +01:00
David Tolnay
4755104910
Update respan to nightly-2018-02-25
2018-02-25 23:52:47 -08:00
Bastien Orivel
340553a5e0
Allow '_ to be parsed as a lifetime
2018-02-15 23:57:38 +01:00
Bastien Orivel
9ea503330e
Make Attribute::interprete_meta understand booleans
...
So proc_macro2::Literal doesn't have any boolean related variant which
means that a boolean value is put in a TokenNode::Term and not a
TokenNode::Literal which in turn means that those values were ignored
and resulted in an impossibility to parse booleans in an attribute.
Fixes #346
2018-01-23 17:43:11 +01:00
David Tolnay
5dec63d6d3
Bump the rust-lang/rust commit we test against
2018-01-18 23:36:12 -08:00
David Tolnay
bd27aac4f0
Unblacklist some tests that we now support
2018-01-18 23:25:35 -08:00
David Tolnay
c42b90a763
Support attributes on FieldValue
...
This is like:
let mut ctx = Blake2bCtx {
b: [0; 128],
finalized: false,
#[cfg(debug_assertions)]
fnv_hash: 0xcbf29ce484222325,
};
2018-01-18 23:11:43 -08:00
Sean Griffin
dadd0b3132
Remove fields_mut
, replace fields()
with fields.iter()
2018-01-16 10:35:40 -07:00
Sean Griffin
ca93a776d0
Bring back VariantData::fields
and VariantData::fields_mut
...
These methods were removed in syn 0.12. They seem like an odd removal,
since they're pretty widely used in the wild. This adds these methods
back. Though `Fields` is the closest structurally to `VariantData`, I've
opted to put it on `DataStruct` instead, as it's in the location most
people will look for it. `fields.fields()` also reads really poorly.
Fixes #316
2018-01-15 13:33:17 -07:00
David Tolnay
66bb8d51c4
Update to quote 0.4
2018-01-08 08:25:38 -08:00
David Tolnay
aaadd78b96
Redesign MetaItem naming
2018-01-06 22:58:13 -08:00
David Tolnay
d5ddbb4e13
Fix TokenBuffer constructor in tests
2018-01-06 18:55:45 -08:00
David Tolnay
1f0b7b8e9b
Box in stmt is no longer required
2018-01-06 16:15:22 -08:00
David Tolnay
eb75206fee
Rename test fold implementations
2018-01-06 13:51:42 -08:00
David Tolnay
dfc886ba94
Move Cursor and TokenBuffer into buffer module
2018-01-06 08:04:58 -08:00
David Tolnay
76ebcdd9bf
Address clippy lints
2018-01-05 17:07:26 -08:00
David Tolnay
555350115f
Add license boilerplate to source files
2018-01-05 16:39:26 -08:00
David Tolnay
61037c6584
Format with rustfmt
2018-01-05 16:21:47 -08:00
David Tolnay
360efd23b8
More useful literal api
2018-01-05 14:22:13 -08:00
David Tolnay
40fb8ce1a6
Eliminate PolyTraitRef
2018-01-02 10:53:46 -08:00
David Tolnay
a0834b46d6
Polish Punctuated api
2018-01-01 21:30:02 -08:00
David Tolnay
d4add859c2
Improve naming in WherePredicate
2018-01-01 20:13:24 -08:00
David Tolnay
bdafb10843
Rename fields to avoid repetition
2018-01-01 20:04:27 -08:00
David Tolnay
f2cfd72935
Punctuated
2017-12-31 18:14:35 -05:00
David Tolnay
f4aa6b4946
Put remaining cursor last
2017-12-31 16:42:03 -05:00
David Tolnay
e3d41b7678
Reorganize DeriveInput
2017-12-31 15:27:17 -05:00
David Tolnay
8875fcaba8
Parse delimiter before contents
2017-12-31 13:52:37 -05:00
David Tolnay
3bc597fc3f
Fix unneeded into()
2017-12-31 02:34:52 -05:00
David Tolnay
dd12556f30
Create 'delimited!' macro for tests
2017-12-31 02:16:22 -05:00
David Tolnay
8b4d3028d2
Collapse parallel Option fields in exprs
2017-12-29 12:11:50 -05:00
David Tolnay
2ae520adce
Add verbatim variants as an escape hatch
2017-12-29 11:21:46 -05:00
David Tolnay
eadbda37d2
Type field renames
2017-12-29 02:33:47 -05:00
David Tolnay
24237fb37b
Inline mutability as just a token
2017-12-29 02:17:32 -05:00
David Tolnay
d60cfec71b
Support method turbofish with const generics
2017-12-29 00:24:29 -05:00
David Tolnay
2a86fdd660
Rename array and tuple exprs to have 'elems'
2017-12-28 23:36:45 -05:00
David Tolnay
8701a5cb77
Remove old placement syntax
2017-12-28 23:31:10 -05:00
David Tolnay
8c91b888d7
Combine Expr and ExprKind
2017-12-28 23:12:26 -05:00
David Tolnay
e67902a72a
Flatten discriminant into one field
2017-12-28 22:14:41 -05:00
David Tolnay
fcfb900cad
Remove empty VisInherited type
2017-12-28 22:08:06 -05:00
David Tolnay
ac997ddc37
Make WhereClause always hold a where
token
2017-12-27 23:24:03 -05:00
David Tolnay
d587e7331e
Remove lone_comma in favor of trailing delimiter in Delimited
2017-12-27 23:02:35 -05:00
David Tolnay
85b69a46e8
Combine Expr::Field and Expr::TupleField into one variant
2017-12-27 20:46:59 -05:00
David Tolnay
d0b4b9661b
Rename TupField to TupleField in tests
2017-12-27 19:48:51 -05:00
David Tolnay
5138205475
Format with rustfmt 0.3.4-nightly
2017-12-27 13:46:21 -05:00
David Tolnay
c5f1a6550d
Clean up Vec<TokenTree> in tests
2017-12-27 02:10:10 -05:00
David Tolnay
9c76bcbe16
Use TokenTree straight from proc_macro2
2017-12-27 01:25:13 -05:00
David Tolnay
42eaae1f24
Rename 'tokens' to 'token' in tests
2017-12-26 23:05:18 -05:00
David Tolnay
9894256d73
Use proc-macro2's Span instead of our own
2017-12-26 21:37:25 -05:00
David Tolnay
c5ab8c6b9f
Merge synom into syn
2017-12-26 21:04:29 -05:00
David Tolnay
3cede94385
Resolve clippy lints in tests
2017-12-26 12:29:24 -05:00
David Tolnay
d079773783
Fix Tup -> Tuple in tests
2017-12-26 01:46:12 -05:00
David Tolnay
dfc6df7274
Parse crate in paths
2017-12-25 23:44:08 -05:00
David Tolnay
d9faf44138
Parse where-clause with parens
2017-12-25 23:36:05 -05:00
David Tolnay
ed8716e3d0
Move clone.sh out of tests/rust
...
To avoid spurious diffs in Travis from the cached tests/rust directory.
2017-12-25 21:49:47 -05:00
David Tolnay
ecce832e34
2.0 macro definitions no longer need to be excluded
2017-12-25 21:42:04 -05:00
David Tolnay
b0d21415ad
Bump the commit we test against
2017-12-25 21:31:58 -05:00
David Tolnay
3eaf7d88a5
Abort more promptly on test failure
2017-12-17 23:14:52 -08:00
David Tolnay
ec5b52e9c8
Avoid interleaving errorf in tests
2017-12-17 22:42:32 -08:00
David Tolnay
e959425c39
Use syntax_pos::FileName
2017-12-17 21:53:42 -08:00
Nika Layzell
6bd368177a
Also support parsing where clauses in trait associated types
2017-12-05 13:46:07 -05:00
Nika Layzell
b49a9e539e
Support trailing + when parsing trait objects
2017-12-05 13:31:52 -05:00
Nika Layzell
25231e85d7
Add some simple should_parse tests
2017-12-05 12:48:07 -05:00
Nika Layzell
c08227a5f9
Improve the consistency of type naming
2017-12-04 16:30:17 -05:00
Nika Layzell
357885acd3
Update generic arguments to be stored similar to generic parameters
2017-12-04 15:47:07 -05:00
Nika Layzell
3aa0dc7e0c
Add an explicit precedence test
2017-12-04 13:41:28 -05:00
Nika Layzell
640832aa1c
Separate unsafe blocks into a ExprKind variant
2017-12-04 13:37:09 -05:00
David Tolnay
c2f1aba7c3
Groundwork for const generics
2017-11-19 15:58:57 -08:00
David Tolnay
ee97dbfc2f
Run round-trip and precedence tests in parallel
2017-11-19 15:29:38 -08:00
David Tolnay
11e6da97ac
Script to clone the rust-lang/rust repo
2017-11-19 12:19:51 -08:00
David Tolnay
1590f11bc2
Log output when tests/rust already exists
2017-11-19 11:13:37 -08:00
David Tolnay
55d9ff79f6
Clean up unused imports in tests
2017-11-19 10:42:47 -08:00
Nika Layzell
a2a1a4a979
Get syn tests passing with libsyntax instead of syntex
2017-11-19 11:33:17 -05:00
David Tolnay
cfa5cc0382
Test with libsyntax instead of syntex
2017-11-13 01:05:11 -08:00
David Tolnay
fd6bf5c8a7
Rename Ty -> Type
...
Rust source code does not abbreviate type -> ty (the way it abbreviates impl and
mod, for example). This commit updates the naming in syn to reflect that.
2017-11-12 10:34:57 -08:00
David Tolnay
f8db7ba280
Token macros
2017-11-12 09:11:52 -08:00
David Tolnay
c6b55bcbe4
Flatten ItemKind into an Item enum
...
Side note: this pattern is sort of nice:
let item: &Item = /* ... */;
match *item {
Item::Mod(ref item) => {
do_something_with(&item.ident, &item.content);
}
Item::Fn(ref item) => {
do_something_with(&item.abi, &item.block);
}
/* ... */
}
Basically pattern matching on an `item` and rebinding the same name `item`
just takes your variable and imbues it with those additional fields that exist
on the type of item that it happens to be.
2017-11-09 23:05:43 -08:00
Nika Layzell
a6f46c40ff
Rename methods and functions to be more uniform
2017-10-26 15:30:44 -04:00
Nika Layzell
956d2b727b
Update fold implementation in test_precedence
2017-10-26 10:38:06 -04:00
Alex Crichton
10143d008f
Ignore a failing test in precedence tests
2017-08-28 10:57:23 -07:00
Alex Crichton
22b82c264a
More unused crates
2017-08-28 09:56:41 -07:00
Alex Crichton
e21116fab0
Update rust submodule, add some new whitelisted failures
2017-08-28 09:56:12 -07:00
Alex Crichton
3956789d82
Annotate TODO with what syntax needs to be parsed
2017-08-28 09:55:44 -07:00
Alex Crichton
6498031ec4
Remove unused crates
2017-08-28 09:55:02 -07:00
Alex Crichton
8637477c03
Remove rust
as a submodule
...
This removes the `tests/rust` submodule and instead moves to lazily cloning it
during tests. This helps work around the fact that git dependencies on `syn`
will pull in all submodules, and rust takes forever to clone. In short, the
intention here is to make git dependencies on `syn` bearable to avoid Cargo
auto-cloning submodules.
2017-07-07 20:42:15 -07:00
David Tolnay
c7a5d3de89
Pare down the Synom trait
...
I would like to make it clearer that parsing a string is second-class
functionality compared to parsing tokens.
2017-07-06 11:59:10 -07:00
Alex Crichton
605643b683
Fix test fallout from proc_macro2
2017-07-05 18:35:14 -07:00
Alex Crichton
f9e8f1a7d9
Update to published version of proc_macro2
2017-07-05 18:20:44 -07:00
Michael Layzell
57d5de7662
Update test_derive_input due to constexpr changes
2017-06-08 11:11:21 -04:00
Michael Layzell
1107ef3fce
Merge pull request #173 from mystor/macroinput
...
Remove the MacroInput type alias
2017-06-07 23:08:39 -04:00
Michael Layzell
f598c5c40d
Update test_macro_input to test_derive_input
2017-06-07 17:55:43 -04:00
Michael Layzell
188ba81d1f
Update test_round_trip to share code with test_precedence
2017-06-07 09:22:14 -04:00
Michael Layzell
53fc31a9f9
Add a test to check our parsing precedence matches that of syntex
2017-06-07 09:21:53 -04:00
Michael Layzell
be1e24d90b
Add a test for grouping expressions with None-delimited sequences
2017-06-05 00:10:34 -04:00
Michael Layzell
1f506c0628
try-macro.rs now succeeds due to precedence changes
2017-06-05 00:10:34 -04:00
Michael Layzell
6a5a164c8f
Correctly parse InPlace <- expressions
2017-06-05 00:10:34 -04:00
Michael Layzell
517fe42a46
Add an environment variable to make debugging test_round_trip easier
2017-06-04 20:16:33 -04:00
David Tolnay
63e3dee53a
Do not use Ident to represent Lifetime
2017-06-03 20:17:01 -07:00
Michael Layzell
c864f027eb
Add a test to ensure that we round-trip literals faithfully
2017-06-03 13:02:41 -04:00
Michael Layzell
85f61a55f3
Enable round-trip tests for 128-bit integers
...
We support parsing these now due to
https://github.com/alexcrichton/proc-macro2/issues/6 and
https://github.com/alexcrichton/proc-macro2/pull/8 .
2017-06-03 11:54:59 -04:00
Michael Layzell
65f15262ff
Update tests to use Cursor
2017-06-03 11:37:35 -04:00
David Tolnay
d7d8ec4049
New syntex
2017-06-01 22:37:32 -07:00
David Tolnay
75a1d4a8be
Joint token in test
2017-06-01 22:23:08 -07:00
Michael Layzell
b08f94da99
Update test_meta_item for removal of IResult
2017-06-01 00:45:02 -04:00
Alex Crichton
954046cda3
Finish porting to the Synom
trait
2017-05-31 16:00:01 -07:00
Alex Crichton
1c48953726
Merge commit '416724e44537bad521ef7fc8aad7fbcb4b31be9b' into new-parse
2017-05-30 15:09:25 -07:00
Alex Crichton
ccbb45dd92
Rewrite tokenization with proc-macro2
tokens
...
This ended up being a bit larger of a commit than I intended! I imagine that
this'll be one of the larger of the commits working towards #142 . The purpose of
this commit is to use an updated version of the `quote` crate which doesn't work
with strings but rather works with tokens form the `proc-macro2` crate. The
`proc-macro2` crate itself is based on the proposed API for `proc_macro` itself,
and will continue to mirror it. The hope is that we'll flip an easy switch
eventually to use compiler tokens, whereas for now we'll stick to string parsing
at the lowest layer.
The largest change here is the addition of span information to the AST. Building
on the previous PRs to refactor the AST this makes it relatively easy from a
user perspective to digest and use the AST still, it's just a few extra fields
on the side. The fallout from this was then quite large throughout the
`printing` feature of the crate. The `parsing`, `fold`, and `visit` features
then followed suit to get updated as well.
This commit also changes the the semantics of the AST somewhat as well.
Previously it was inferred what tokens should be printed, for example if you
have a closure argument `syn` would automatically not print the colon in `a: b`
if the type listed was "infer this type". Now the colon is a separate field and
must be in sync with the type listed as the colon/type will be printed
unconditionally (emitting no output if both are `None`).
2017-05-26 13:59:06 -07:00
Michael Layzell
416724e445
Parse based on proc-macro2
2017-05-24 21:12:34 -04:00
Alex Crichton
2e0229cd93
Move all #[derive] impls behind Cargo feature gates
...
This commit moves all #[derive] annotations behind Cargo feature gates to add
the ability to strip them all out entirely. The `Clone` and `Copy` impls
continue to be enabled by default as they tend to be mega useful but other
equality/hash/debug impls are all default behind the `extra-impls` gate.
This commit, on my computer, has the following timings:
| features | before | after
|-------------------------------|---------|------
| default | 3.67 | 2.96
| *none* | 1.78 | 0.49
| {printing, parsing} | 3.71 | 2.57
| default + {full} | 8.50 | 6.31
| {full} | 3.53 | 0.70
| {full, printing, parsing} | 8.10 | 5.29
Closes #143
2017-05-23 10:59:24 -07:00
Alex Crichton
62a0a59af3
Rewrite the AST to be a bit more user-friendly
...
This commit is a relatively large rewrite of the AST that `syn` exposes. The
main change is to expose enums-of-structs rather than
enums-with-huge-tuple-variants. The best example of this is `ItemKind::Fn` which
changed from:
enum ItemKind {
Fn(Box<FnDecl>, Unsafety, Constness, Option<Abi>, Generics, Box<Block>),
...
}
to
enum ItemKind {
Fn(ItemFn),
...
}
struct ItemFn {
decl: Box<FnDecl>,
unsafety: Unsafety,
constness: Constness,
abi: Option<Abi>,
generics: Generics,
block: Box<Block>,
}
This change serves a few purposes:
* It's now much easier to add fields to each variant of the ast, ast struct
fields tend to be "by default ignored" in most contexts.
* It's much easier to document what each field is, as each field can have
dedicated documentation.
* There's now canonicalized names for each field (the name of the field) which
can help match `match` statements more consistent across a codebase.
A downside of this representation is that it can be a little more verbose to
work with in `match` statements and during constructions. Overall though I'd
feel at least that the readability improved significantly despite the extra
words required to do various operations.
Closes #136
2017-05-23 09:01:03 -07:00
Ted Driggs
054abbb0da
Added FromStr implementations to mirror the parse_* functions
...
Also added #[deprecated] to parse_macro_input to pop warnings for those still using it.
2017-05-01 12:20:52 -07:00
Arnavion
d32b29499f
Update visibility
rule for stabilized pub(restricted)
syntax.
...
Fixes #118
2017-04-29 17:18:02 -07:00
David Tolnay
0e94f0ebc4
Merge pull request #128 from Arnavion/half-open-pat
...
Support parsing half-open ranges in patterns.
2017-04-29 17:01:51 -07:00
Arnavion
1992e2f68f
Support parsing half-open ranges in patterns.
...
Fixes #117
2017-04-25 01:47:46 -07:00
Arnavion
02ef13faf8
Support parsing catch expressions.
...
Fixes #109
2017-04-25 00:54:31 -07:00
Arnavion
f6b8bceedc
Update rust syntax to 1.18.0-nightly (ddc5d7bd4 2017-04-20)
2017-04-21 14:42:19 -07:00
Arnavion
740e8ab8b6
Consider the test a success if syntex fails to parse the original content.
2017-04-21 14:27:41 -07:00
Arnavion
67660b422f
Skip files under src/test/ui that have a corresponding .stderr file.
...
Fixes #121
2017-04-21 14:26:14 -07:00
David Tolnay
e0394902b8
Merge pull request #113 from Arnavion/round-trip
...
Small fixes for test_round_trip
2017-04-21 11:37:09 -07:00
Arnavion
f2dada15f6
fixup! Attribute paths are mod-style.
2017-04-20 23:55:20 -07:00
Arnavion
938062f3eb
Fail test_round_trip if RUST_MIN_STACK is not set to a valid value.
...
Some tests like tests/rust/src/test/run-pass/super-fast-paren-parsing.rs
require it to be atleast 16 MiB.
2017-04-20 23:54:42 -07:00
Arnavion
d6a05f7a14
Fix test_round_trip to properly ignore paths on Windows.
2017-04-20 23:54:21 -07:00
Arnavion
247706101c
fixup! Satisfy clippy some more.
2017-04-19 11:41:12 -07:00
Arnavion
95f8a7a76b
fixup! Reinstated name in MetaItem since it's no longer trivial to get it from its parent.
2017-04-19 03:29:56 -07:00
Arnavion
0b302a3a65
fixup! Test for attributes with paths.
2017-04-19 02:57:28 -07:00
Arnavion
e43b1b08f9
fixup! Attribute::name -> path
2017-04-19 02:47:45 -07:00
Arnavion
4ded3935a8
fixup! Added tests
2017-04-15 21:54:54 -07:00
Arnavion
bf395bf8c8
fixup! Only store tokens in Attribute.
2017-04-15 15:35:22 -07:00
David Tolnay
2a78fc7f2c
Run rustfmt on tests
2017-03-12 18:28:54 -07:00
David Tolnay
f093231810
Cast the one that needs to be cast
2017-03-12 18:27:52 -07:00
Demur Rumed
d6bcd6a0f3
Replace time with std::time
2017-03-12 21:50:39 +00:00
Colin Kiegel
4e76ade6ba
fix testsuite in absence of full
feature flag
...
test_macro_input::test_enum depends on `Expr` and `ExprKind`
which are behind the `full` feature flag.
2017-03-06 13:41:41 +01:00
Simon Sapin
ec3cb0d26a
Parse ConstExpr::Other
2017-02-27 12:28:47 +01:00
David Tolnay
02a8d47cea
Resolve clippy complaints
2017-02-19 12:59:44 -08:00
Igor Gnatenko
2449b76497
Cargo.toml: bump syntex_* deps to latest (0.58.0) version
...
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2017-02-18 18:49:35 +01:00
David Tolnay
c879a50c4e
Add turbofish quoter
2017-01-25 15:51:32 -08:00
David Tolnay
23d83f9cc6
Expose TyParamBound parsing
2017-01-25 15:41:47 -08:00
David Tolnay
48088d2a0e
Drop the expander registry
2017-01-23 00:34:10 -08:00
David Tolnay
88aa978ff2
Update to syntex 0.52
2016-12-22 15:34:58 -05:00
David Tolnay
0047c71c93
Type macros
2016-12-21 22:36:10 -05:00
David Tolnay
5d55ef7943
Update rust syntax to 1.15.0-nightly (71c06a56a 2016-12-18)
2016-12-21 21:53:31 -05:00
David Tolnay
db84cb2c50
Update to syntex 0.50
2016-11-20 21:34:58 -08:00
David Tolnay
617352731b
Allow trailing comma in vec pat
2016-10-30 17:34:23 -07:00
David Tolnay
385a0f74b3
Identify reason for failing test case
2016-10-30 17:29:34 -07:00
David Tolnay
a441d3fb09
Ignore byte order mark
2016-10-30 17:12:34 -07:00
David Tolnay
e07f9e047c
Implement pub(crate) and pub(restricted)
2016-10-30 17:05:55 -07:00
David Tolnay
e4076cd9c6
Run round-trip test against the Rust repo
2016-10-30 15:40:35 -07:00
David Tolnay
67370bbd87
Propagate is_shorthand when folding syntex struct field
2016-10-30 12:08:31 -07:00
David Tolnay
b7fa2b64f1
Allow literals inside meta item lists
2016-10-30 10:50:47 -07:00
David Tolnay
003bde887b
Catch panics from syntex in test
2016-10-30 00:03:19 -07:00
David Tolnay
dec282f07e
Do not compare most literals inside macros
2016-10-27 22:19:19 -07:00
David Tolnay
a76acd4840
Single-line comparison of failure cases
2016-10-27 22:13:12 -07:00
David Tolnay
36c3ec40b4
Do not compare char literals inside a macro
2016-10-27 22:10:26 -07:00
David Tolnay
1978c673a9
Fix the rule for trailing comma in match statements
2016-10-27 22:05:52 -07:00
David Tolnay
fe373a3fa2
Allow hex escapes greater than \x7F in byte literals
2016-10-26 23:51:19 -07:00
David Tolnay
bbf4052ba6
Rustfmt the round trip test
2016-10-25 22:22:45 -07:00
David Tolnay
ec5f8a62e0
Ignore test cases containing explicit paths to modules
2016-10-25 22:21:43 -07:00
David Tolnay
b3f55907f4
Run test cases in sorted order
2016-10-25 21:51:59 -07:00
David Tolnay
107ae26fc0
Fold away spans inside of meta items
2016-10-25 21:01:54 -07:00
David Tolnay
5ca64bdb07
Ignore module errors in round trip test
2016-10-25 10:24:57 -07:00
David Tolnay
0b07f602b5
Give up on comparing strings macro tokens in round trip test
2016-10-25 10:24:54 -07:00
David Tolnay
31f1f3f96e
No need to fold normalized lits
2016-10-25 00:27:05 -07:00
David Tolnay
289f4c79ef
Use \0 for the zero char
2016-10-25 00:00:09 -07:00
David Tolnay
93413a5280
Rustfmt the tests
2016-10-24 13:02:39 -07:00
David Tolnay
c7b636a2ee
Fold away underscores and escaped newlines
2016-10-24 13:01:08 -07:00
David Tolnay
8e01a6a4f1
Copy over latest parser.rs
2016-10-24 12:09:28 -07:00
David Tolnay
4f5f60f221
Float parsing
2016-10-24 00:52:58 -07:00
David Tolnay
4a65840878
Raw byte strings
2016-10-24 00:51:53 -07:00
David Tolnay
9e24d4da46
Integrate with syntex to print expanded code
2016-10-23 22:18:45 -07:00
David Tolnay
453cfd1168
Expand custom derives
2016-10-23 20:40:47 -07:00
Simon Sapin
095a42b93b
Add parse_token_trees.
...
Token trees are much simpler than an AST.
This makes them easier to work with when they are sufficient
for the task at hand, such as for example [expanding a procedural macro](
https://github.com/servo/html5ever/pull/217 ).
2016-10-20 16:37:20 +02:00
David Tolnay
e7678920fc
Attributes on generic formals and split_for_impl
2016-10-13 20:44:03 -07:00
David Tolnay
45cc84976e
Rename to proc_macro
2016-10-08 20:52:03 -07:00
David Tolnay
2165b0452f
Large test case
2016-10-08 10:53:31 -07:00
David Tolnay
079b5ad4d9
Block comment perf
...
This is 95 times faster in debug mode for large block comments.
2016-10-08 09:53:43 -07:00
David Tolnay
6414da71fb
ObjectSum and PolyTraitRef types
2016-10-08 00:55:17 -07:00
David Tolnay
1241783c01
Fix global list ViewPath with empty path
2016-10-08 00:12:37 -07:00
David Tolnay
4a05742628
Implement use items
2016-10-08 00:02:31 -07:00
David Tolnay
19f9bdc01f
Fix discriminant in test
2016-10-07 23:07:01 -07:00
David Tolnay
359023034f
Module parsing
2016-10-06 01:11:08 -07:00
David Tolnay
4c9be37ca6
Impl parsing
2016-10-06 00:47:37 -07:00
David Tolnay
344088d1c4
Test case for array types
2016-10-05 23:30:47 -07:00
David Tolnay
15dc31f7ac
Merge branch origin/stable into origin/master
2016-10-04 23:45:14 -07:00
David Tolnay
b153dbcc91
Helper function split_impl_generics
2016-10-04 23:39:10 -07:00
David Tolnay
f94e236fcc
Default impls
2016-10-04 00:29:51 -07:00
David Tolnay
e31989394f
Trait macro semicolon fixes
2016-10-04 00:21:34 -07:00
David Tolnay
ca08542461
Trait printing
2016-10-04 00:12:38 -07:00
David Tolnay
8d9e81a3bd
Struct patterns
2016-10-03 22:36:32 -07:00
David Tolnay
aa610946d6
Tuple struct patterns
2016-10-03 22:22:49 -07:00
David Tolnay
a1aa0da0bd
Rustfmt the tests
2016-10-03 20:58:10 -07:00
David Tolnay
ffdb97f815
Reference pattern
2016-10-03 01:28:33 -07:00
David Tolnay
8b308c21bc
Literal and range patterns
2016-10-03 01:24:10 -07:00
David Tolnay
fbb7323622
Box and tuple patterns
2016-10-03 01:00:06 -07:00
David Tolnay
6ed09a4a4f
Macro span folding
2016-10-02 23:51:44 -07:00
David Tolnay
84aa0750a0
Macro parsing
2016-10-02 23:02:12 -07:00
David Tolnay
cfe5502fb3
Optional semicolon after loops
2016-10-02 22:02:27 -07:00
David Tolnay
bb6feaeae8
Looping
2016-10-02 21:25:20 -07:00
David Tolnay
29f9ce1d2b
If let
2016-10-02 20:58:40 -07:00
David Tolnay
055a704f90
Struct expressions
2016-10-02 19:23:54 -07:00
David Tolnay
191e058209
Statement parsing
2016-10-02 18:31:09 -07:00
David Tolnay
3c2467ccbe
Filling in some expression printers
2016-10-02 17:55:08 -07:00
David Tolnay
9636c0546d
Empty path segments
2016-10-02 17:18:13 -07:00
David Tolnay
89e0567333
Closure parsing
2016-10-02 14:50:33 -07:00
David Tolnay
42602293eb
Function parsing
2016-10-01 23:36:58 -07:00
David Tolnay
3cf5298445
Typedef parsing
2016-10-01 17:17:38 -07:00
David Tolnay
47a877c90f
Static and const parsing
2016-10-01 17:01:06 -07:00
David Tolnay
759d2ffd71
Boolean literals
2016-10-01 16:18:15 -07:00
David Tolnay
56d6213cbf
Byte string parsing
2016-10-01 16:14:54 -07:00
David Tolnay
14cbdeb5ca
Comment parsing
2016-10-01 15:37:12 -07:00
David Tolnay
4a51dc70fc
Round trip testing
2016-10-01 09:41:33 -07:00
David Tolnay
627e3d5328
Implement ToTokens for raw string
2016-10-01 08:27:31 -07:00
David Tolnay
210884d386
Raw string literals
2016-10-01 08:18:42 -07:00
Gregory Katz
3e562cc986
Added while loop parser and (currently ignored) tests.
2016-09-28 18:33:02 -04:00
Gregory Katz
1b69f68303
addressed review comments
2016-09-27 21:06:09 -04:00
Gregory Katz
e5f3568a7f
Added an infinite loop parser and tests.
2016-09-27 19:36:30 -04:00
David Tolnay
fa0edf2303
More expression parsing
2016-09-23 22:58:24 -07:00
David Tolnay
f38cdf6bc3
Other item kinds
2016-09-23 19:15:01 -07:00
David Tolnay
f4bbbd9f19
Expressions
2016-09-23 17:38:38 -07:00
David Tolnay
5533772670
Things needed by serde_derive
2016-09-11 17:36:30 -07:00
David Tolnay
62a8b69243
Rebrand as 'syn'
2016-09-07 08:19:28 -07:00
David Tolnay
ee89c1baa2
Test items from serde_codegen test suite
2016-09-04 16:27:18 -07:00
David Tolnay
f6ccb8370a
Fix incomplete errors
2016-09-04 15:44:15 -07:00
David Tolnay
42f5029fee
Newtype ident
2016-09-04 13:54:21 -07:00
David Tolnay
cef990c749
Parse doc comments
2016-09-04 10:21:36 -07:00
David Tolnay
7ebb9fbbfc
More nom
2016-09-03 16:32:35 -07:00
David Tolnay
35161fff39
item::parse
2016-09-03 11:33:15 -07:00