Skip to content

Commit

Permalink
Implement .parsefile method on Grammar.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 11, 2009
1 parent 1b7a3e3 commit cad0468
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/classes/Grammar.pir
Expand Up @@ -54,6 +54,20 @@ Invokes the TOP rule in the grammar on the given topic.
'die'("The grammar has no TOP rule to invoke.")
.end


=item parsefile(filename)

Reads in the file in filename and then invokes the TOP rule in the
grammar on it.

=cut

.sub 'parsefile' :method
.param string filename
$S0 = 'slurp'(filename)
.tailcall self.'parse'($S0)
.end

=back

=cut
Expand Down

0 comments on commit cad0468

Please sign in to comment.