rust/crates/parser/src
Aleksey Kladov 2bf81922f7 internal: more reasonable grammar for blocks
Consider these expples

        { 92 }
  async { 92 }
    'a: { 92 }
   #[a] { 92 }

Previously the tree for them were

  BLOCK_EXPR
    { ... }

  EFFECT_EXPR
    async
    BLOCK_EXPR
      { ... }

  EFFECT_EXPR
    'a:
    BLOCK_EXPR
      { ... }

  BLOCK_EXPR
    #[a]
    { ... }

As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers

  BLOCK_EXPR
    STMT_LIST
      { ... }

  BLOCK_EXPR
    async
    STMT_LIST
      { ... }

  BLOCK_EXPR
    'a:
    STMT_LIST
      { ... }

  BLOCK_EXPR
    #[a]
    STMT_LIST
      { ... }
2021-09-26 19:16:09 +03:00
..
grammar internal: more reasonable grammar for blocks 2021-09-26 19:16:09 +03:00
syntax_kind internal: more reasonable grammar for blocks 2021-09-26 19:16:09 +03:00
event.rs fix: correct extend_to logic in parser 2021-09-25 22:09:50 +03:00
grammar.rs feat: allow attributes on all expressions 2021-09-25 22:19:27 +03:00
lib.rs minor: modernize 2021-09-06 18:54:16 +03:00
parser.rs feat: allow attributes on all expressions 2021-09-25 22:19:27 +03:00
syntax_kind.rs minor: modernize 2021-09-06 18:54:16 +03:00
token_set.rs CONST LOOPS ARE HERE 2020-08-27 18:12:01 +02:00