Skip to content

Adding descriptions seems to mess up error reporting #302

@pragdave

Description

@pragdave

Given a simple grammar:

Myopic {
  Program  = ExpressionList
  ExpressionList  = Expression*
  Expression = BlockExpression   | number
  BlockExpression  = "block" "{"   ExpressionList "}" 
  number = digit+
}

I feed it a program with a deliberate error, and I get a beautiful error:

image

This is correct, the "?" is not a valid expression, and it is flagged as such.

However, if I add a description (to any of the rules),

Myopic {
  Program (p) = ExpressionList
  ExpressionList  = Expression*
  Expression = BlockExpression   | number
  BlockExpression  = "block" "{"   ExpressionList "}" 
  number = digit+
}

the error now gets shuffled up to the top-level:

image

Am I misunderstanding how this is supposed to work?

Cheers (and thanks for a very nice-looking project)

Dave Thomas
@pragdave

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions