summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2016-05-14syntax: Refactor parsing of method declarationsVadim Petrochenkov-144/+102
Fix spans and expected token lists, fix #33413 + other cosmetic improvements Add test for #33413 Convert between `Arg` and `ExplicitSelf` precisely Simplify pretty-printing for methods
2016-05-07Rollup merge of #33336 - birkenfeld:issue-27361, r=sfacklerSteve Klabnik-1/+1
parser: do not try to continue with `unsafe` on foreign fns The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: ``` self.expect_keyword(keywords::Fn)?; ``` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
2016-05-07Auto merge of #33333 - birkenfeld:issue-30318, r=Manishearthbors-1/+4
parser: show a helpful note on unexpected inner comment Fixes: #30318.
2016-05-06Auto merge of #33311 - birkenfeld:issue33262, r=nrcbors-9/+2
parser: fix suppression of syntax errors in range RHS Invalid expressions on the RHS were just swallowed without generating an error. The new version more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method below, where no cancel is done either. Fixes #33262.
2016-05-05Auto merge of #33128 - xen0n:more-confusing-unicode-chars, r=nagisabors-6/+53
Add more aliases for Unicode confusable chars Building upon #29837, this PR: * added aliases for space characters, * distinguished square brackets from parens, and * added common CJK punctuation characters as aliases. This will especially help CJK users who may have forgotten to switch off IME when coding.
2016-05-03parser: show a helpful note on unexpected inner commentGeorg Brandl-1/+4
Fixes: #30318.
2016-05-03Rollup merge of #33343 - birkenfeld:issue-32214, r=ManishearthManish Goregaokar-5/+1
parser: change warning into an error on `T<A=B, C>` part of #32214 This seems to be the obvious fix, and the error message is consistent with all the other parser errors ("expected x, found y").
2016-05-03Rollup merge of #33334 - birkenfeld:issue29088, r=ManishearthManish Goregaokar-5/+4
lexer: do not display char confusingly in error message Current code leads to messages like `... use a \xHH escape: \u{e4}` which is confusing. The printed span already points to the offending character, which should be enough to identify the non-ASCII problem. Fixes: #29088
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-19/+17
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-05-02parser: change warning into an error on `T<A=B, C>`Georg Brandl-5/+1
Fixes: #32214
2016-05-02parser: do not try to continue with `unsafe` on foreign fnsGeorg Brandl-1/+1
The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: `self.expect_keyword(keywords::Fn)?;` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
2016-05-02lexer: do not display char confusingly in error messageGeorg Brandl-5/+4
Current code leads to messages like "... use a \xHH escape: \u{e4}" which is confusing. The printed span already points to the offending character, which should be enough to identify the non-ASCII problem. Fixes: #29088
2016-05-01parser: fix suppression of syntax errors in range RHSGeorg Brandl-9/+2
Invalid expressions on the RHS were just swallowed without generating an error. The new code more closely mirrors the code for parsing `..x` in the `parse_prefix_range_expr` method, where no cancel is done either. Fixes #33262.
2016-04-28Rollup merge of #33218 - oli-obk:interned_str_cmp, r=nikomatsakisSteve Klabnik-0/+22
allow InternedString to be compared to &str directly
2016-04-28Auto merge of #33161 - jseyfried:parse_tuple_struct_field_vis, r=nikomatsakisbors-7/+38
Parse `pub(restricted)` visibilities on tuple struct fields Parse `pub(restricted)` on tuple struct fields (cc #32409). r? @nikomatsakis
2016-04-27Make some fatal lexer errors recoverablemitaa-66/+103
2016-04-26allow InternedString to be compared to &str directlyOliver Schneider-0/+22
2016-04-25parse `pub(restricted)` visibilities for struct fieldsJeffrey Seyfried-7/+38
2016-04-25Rollup merge of #33041 - petrochenkov:path, r=nrc,ManishearthManish Goregaokar-491/+292
Paths are mostly parsed without taking whitespaces into account, e.g. `std :: vec :: Vec :: new ()` parses successfully, however, there are some special cases involving keywords `super`, `self` and `Self`. For example, `self::` is considered a path start only if there are no spaces between `self` and `::`. These restrictions probably made sense when `self` and friends weren't keywords, but now they are unnecessary. The first two commits remove this special treatment of whitespaces by removing `token::IdentStyle` entirely and therefore fix https://github.com/rust-lang/rust/issues/14109. This change also affects naked `self` and `super` (which are not tightly followed by `::`, obviously) they can now be parsed as paths, however they are still not resolved correctly in imports (cc @jseyfried, see `compile-fail/use-keyword.rs`), so https://github.com/rust-lang/rust/issues/29036 is not completely fixed. The third commit also makes `super`, `self`, `Self` and `static` keywords nominally (before this they acted as keywords for all purposes) and removes most of remaining \"special idents\". The last commit (before tests) contains some small improvements - some qualified paths with type parameters are parsed correctly, `parse_path` is not used for parsing single identifiers, imports are sanity checked for absence of type parameters - such type parameters can be generated by syntax extensions or by macros when https://github.com/rust-lang/rust/issues/10415 is fixed (~~soon!~~already!). This patch changes some pretty basic things in `libsyntax`, like `token::Token` and the keyword list, so it's a plugin-[breaking-change]. r? @eddyb
2016-04-24Remove some old code from libsyntaxVadim Petrochenkov-3/+3
2016-04-24syntax: Make `is_path_start` precise and improve some error messages about ↵Vadim Petrochenkov-35/+62
unexpected tokens
2016-04-24syntax: Check paths in visibilities for type parametersVadim Petrochenkov-74/+61
syntax: Merge PathParsingMode::NoTypesAllowed and PathParsingMode::ImportPrefix syntax: Rename PathParsingMode and its variants to better express their purpose syntax: Remove obsolete error message about 'self lifetime syntax: Remove ALLOW_MODULE_PATHS workaround syntax/resolve: Adjust some error messages resolve: Compare unhygienic (not renamed) names with keywords::Invalid, invalid identifiers may appear to be valid after renaming
2016-04-24syntax: Merge keywords and remaining special idents in one listVadim Petrochenkov-137/+89
Simplify the macro used for generation of keywords Make `Keyword::ident` private
2016-04-24syntax: Don't parse idents with `parse_path`Vadim Petrochenkov-9/+12
Lift some restrictions on type parameters in paths Sanity check import paths for type parameters
2016-04-24syntax: Make static/super/self/Self keywords + special ident cleanupVadim Petrochenkov-127/+76
2016-04-24syntax: Get rid of token::IdentStyleVadim Petrochenkov-98/+59
2016-04-24syntax: Don't rely on token::IdentStyle in the parserVadim Petrochenkov-131/+53
2016-04-24thread tighter span for closures aroundNiko Matsakis-3/+6
Track the span corresponding to the `|...|` part of the closure.
2016-04-21add more confusable CJK square bracket aliasesWang Xuerui-0/+12
2016-04-21correct aliases for square bracketsWang Xuerui-6/+8
2016-04-21add confusable space charactersWang Xuerui-0/+17
2016-04-21add more characters easily inputtable with CJK IMEsWang Xuerui-0/+16
2016-04-17Rollup merge of #33044 - petrochenkov:prefix, r=eddybManish Goregaokar-111/+63
syntax: Parse import prefixes as paths Fixes https://github.com/rust-lang/rust/issues/10415 r? @eddyb (This partially intersects with https://github.com/rust-lang/rust/pull/33041)
2016-04-16Auto merge of #32909 - sanxiyn:unused-trait-import-2, r=alexcrichtonbors-2/+0
Remove unused trait imports
2016-04-17syntax: Parse import prefixes as pathsVadim Petrochenkov-111/+63
2016-04-16Auto merge of #32875 - jseyfried:1422_implementation, r=nikomatsakisbors-16/+25
Implement `pub(restricted)` privacy (RFC 1422) This implements `pub(restricted)` privacy from RFC 1422 (cc #32409) behind a feature gate. `pub(restricted)` paths currently cannot use re-exported modules both for simplicity of implementation and for future compatibility with RFC 1560 (cf #31783). r? @nikomatsakis
2016-04-14Improve message for raw pointer missing mut and constDavid Tolnay-2/+2
"Bare raw pointer" does not exist as a concept.
2016-04-14Parse `pub(restricted)`Jeffrey Seyfried-16/+25
2016-04-12Bare raw pointers have been disallowed foreverDavid Tolnay-3/+2
This change was in 0.12.0, a year and a half ago. Let's move on!
2016-04-12Remove unused trait importsSeo Sanghyeon-2/+0
2016-04-11Auto merge of #32711 - marcusklaas:try-shorthand-span-fix, r=nagisabors-1/+1
Fix the span for try shorthand expressions My five character contribution to the rust parser! Fixes https://github.com/rust-lang/rust/issues/32709.
2016-04-11Fix the span for try shorthand expressionsMarcus Klaas-1/+1
2016-04-06Rollup merge of #32727 - matklad:fix-comment, r=alexcrichtonSteve Klabnik-6/+6
minor: update old comments No more lifetimes in function types after https://github.com/rust-lang/rust/commit/f945190e6352a1bc965a117569532643319b400f
2016-04-06Rollup merge of #32570 - eddyb:tis-but-a-front, r=nikomatsakisManish Goregaokar-8/+12
r? @nikomatsakis Conflicts: src/librustc_save_analysis/lib.rs src/libsyntax/ast_util.rs
2016-04-06Move span into `StructField`Vadim Petrochenkov-7/+10
2016-04-06Get rid of ast::StructFieldKindVadim Petrochenkov-4/+4
2016-04-06syntax: dismantle ast_util.Eduard Burtescu-8/+12
2016-04-05Auto merge of #32688 - jseyfried:ast_groundwork_for_1422, r=pnkfelixbors-10/+10
[breaking-batch] Add support for `pub(restricted)` syntax in the AST This PR allows the AST to represent the `pub(restricted)` syntax from RFC 1422 (cc #32409). More specifically, it makes `ast::Visibility` non-`Copy` and adds two new variants, `Visibility::Crate` for `pub(crate)` and `Visitibility::Restricted { path: P<Path>, id: NodeId }` for `pub(path)`. plugin-[breaking-change] cc #31645 r? @pnkfelix
2016-04-05Fixes bug which accepting using `super` in use statemet.vlastachu-6/+6
Issue: #32225
2016-04-04minor: update old commentsAleksey Kladov-6/+6
No more lifetimes in function types after https://github.com/rust-lang/rust/commit/f945190e6352a1bc965a117569532643319b400f