Skip to content

The grammar returns an error if begin is used in a vector #127

@ronisbr

Description

@ronisbr

Hi!

The following code:

v = 1:10
for k in 1:10
    v[begin + k - 1]
end

is not parsed correctly by the current grammar:

(assignment) ; [1:1 - 8]
 (identifier) ; [1:1 - 1]
 (operator) ; [1:3 - 3]
 (range_expression) ; [1:5 - 8]
  (integer_literal) ; [1:5 - 5]
  (integer_literal) ; [1:7 - 8]
(for_statement) ; [2:1 - 4:3]
 (for_binding) ; [2:5 - 13]
  (identifier) ; [2:5 - 5]
  (range_expression) ; [2:10 - 13]
   (integer_literal) ; [2:10 - 10]
   (integer_literal) ; [2:12 - 13]
 (index_expression) ; [3:5 - 20]
  (identifier) ; [3:5 - 5]
  (vector_expression) ; [3:6 - 20]
   (identifier) ; [3:7 - 11]
   (ERROR) ; [3:13 - 19]
    (binary_expression) ; [3:13 - 19]
     (unary_expression) ; [3:13 - 15]
      (operator) ; [3:13 - 13]
      (identifier) ; [3:15 - 15]
     (operator) ; [3:17 - 17]
     (integer_literal) ; [3:19 - 19]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions