Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement Grammar.parsefile, run a test for it
  • Loading branch information
moritz committed Oct 1, 2011
1 parent 4880cea commit 5a38367
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/core/Grammar.pm
Expand Up @@ -3,4 +3,10 @@ my class Grammar is Cursor {
my $*ACTIONS = $actions;
self."!cursor_init"($target, |%opt)."$rule"().MATCH;
}
method parsefile(Cool $filename as Str, *%opts) {
my $fh := open($filename);
my $match := self.parse($fh.slurp, |%opts);
$fh.close;
$match;
}
}
2 changes: 1 addition & 1 deletion t/spectest.data
Expand Up @@ -236,7 +236,7 @@ S05-grammar/action-stubs.t
S05-grammar/inheritance.t
S05-grammar/methods.t
# S05-grammar/namespace.t # err: regex assertion not terminated by angle bracket at line 50, near "::Deep::fo"
# S05-grammar/parse_and_parsefile.t # err: Could not locate compile-time value for symbol No::Such::Grammar
S05-grammar/parse_and_parsefile.t
# S05-grammar/protoregex.t # err: Quantifier quantifies nothing
# S05-grammar/protos.t # err: protoregexes not yet implemented at line 16, near "token fred"
# S05-grammar/signatures.t # err: Method 'list' not found for invocant of class 'Undef'
Expand Down

0 comments on commit 5a38367

Please sign in to comment.