Skip to content

bug: non semicolon-terminated invocations get parsed as expressions rather than statements #6

@simonvic

Description

@simonvic

Details

A non semicolon-terminated invocation gets parsed as an expression rather than a statement

void foo() {
	bar()
}

Expected parse tree

[statement] / statement_expression / invokation

(compilation_unit ; [0, 0] - [3, 0]
  (decl_method ; [0, 0] - [2, 1]
    return_type: (type_void) ; [0, 0] - [0, 4]
    name: (identifier) ; [0, 5] - [0, 8]
    body: (block ; [0, 11] - [2, 1]
      (statement_expression ; [1, 1] - [1, 7]
        (invokation ; [1, 1] - [1, 6]
          invoked: (identifier) ; [1, 1] - [1, 4]
          (actual_parameters)))))) ; [1, 4] - [1, 6]

Actual parse tree

[_expression] / invokation

(compilation_unit ; [0, 0] - [3, 0]
  (decl_method ; [0, 0] - [2, 1]
    return_type: (type_void) ; [0, 0] - [0, 4]
    name: (identifier) ; [0, 5] - [0, 8]
    body: (block ; [0, 11] - [2, 1]
      (invokation ; [1, 1] - [1, 6]
        invoked: (identifier) ; [1, 1] - [1, 4]
        (actual_parameters))))) ; [1, 4] - [1, 6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions