aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/string_lexing.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-03-19 10:36:17 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-03-19 10:36:17 +0000
commit5b6ad0971c050981deb10c56ad2634293f104228 (patch)
tree7f76ce1da6ed9e245f5b4ef14257418c66f59577 /crates/ra_syntax/src/string_lexing.rs
parent91576afc7e64f11dde2bed14b578e4914d253a6a (diff)
parent4cf179c089aeed381cd67bcd265e76a27f11facd (diff)
Merge #996
996: Allow attributes on top level expressions r=matklad a=pcpthm This PR modifies parser to allow outer attributes on top level expression. Here, top level expression means either - Expression statement e.g. `foo();` - Last expression in a block without semicolon `bar()` in `{ foo(); bar() }`. Except for binary operation expressions and `if` expressions, which are errors (feature gated) in rustc. Attributes on inner expressions like `foo(#[a] 1)` are not implemented. I first tried to implement this by passing `Maker` to expression parsers. However, this implementation couldn't parse `#[attr] foo()` correctly as `CallExpr(Attr(..), PathExpr(..), ArgList(..))` and instead parsed incorrectly as `CallExpr(PathExpr(Attr(..), ..), ArgList(..))` due to the way left recursion is handled. In the end, I introduce `undo_completion` method. Which is not the suggested approach, but it seems not very bad. Fix #759. Co-authored-by: pcpthm <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/string_lexing.rs')
0 files changed, 0 insertions, 0 deletions