amplify-education / python-hcl2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error parsing empty blocks with newlines

santoshankr opened this issue · comments

The following is valid HCL

variable "options" {
  type        = map
  default = {
    # explanatory comment
  }
}

However, this fails with:

  File "python3.8/site-packages/lark/parsers/lalr_parser.py", line 89, in feed_token
    raise UnexpectedToken(token, expected, state=state, puppet=None)
lark.exceptions.UnexpectedToken: Unexpected token Token('RBRACE', '}') at line 29, column 3.

The problem seems to be objects on the value side of an expression that contain newlines, but no keys. The snippet above is parsed correctly if the defaultvalue is instead written as default = {}