Skip to content

Does not report FAIL on whole match expression #24

@drforr

Description

@drforr

The test below fails (correctly) when attempting to match an expression with a trailing semicolon, and the tracer correctly reports MATCH on and terms. Yet it doesn't report FAIL on the overall rule.

--cut here--
use v6;
use Test;
use Grammar::Tracer;

grammar Trivially::Broken
{
token ECHO { 'echo' }
token DIGITS { \d+ }
rule TOP
{

}
}

my $g = Trivially::Broken.new;
ok $g.parse('echo 32;'); # Notice the final semicolon, which breaks the overall match.
--cut here--

Output here:
--cut here--
perl6 -Ilib t/02-corpus.t
TOP
| ECHO
| * MATCH "echo"
| DIGITS
| * MATCH "32"

  • MATCH "echo 32"
    not ok 1 -
    --cut here--

Rule did match correctly, so in one sense the grammar "did its job". But it didn't match the whole expression, and the overall parse fails. I suspect that requires overriding or monkeypatching the parse() method which is outside of the scope of the debugger, and that's fine by me, but it's an inconsistency I thought worth pointing out.

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