Skip to content

Commit

Permalink
allow empty line as well
Browse files Browse the repository at this point in the history
  • Loading branch information
szabgab committed Jul 31, 2009
1 parent 39bd43b commit 9c3510d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions lib/Perl6/Conf/Grammar.pm
Expand Up @@ -4,10 +4,16 @@ grammar Perl6::Conf::Grammar {
<comment>* <section>* <comment>*
}
token comment {
^^ <ws> [ '#' \N* ]? $$ \n?
# {{ print "comment\n" }}
<el> | <cl>
}
token el {
^^ [ \s | \t | \n ]+ $$
# {{ print "el\n" }}
}
token cl {
^^ [\s | \t ]* [ '#' \N* ] $$ \n?
# {{ print "cl\n" }}
}

token section {
<header> [<comment> | <entry>]*
}
Expand Down
6 changes: 3 additions & 3 deletions t/grammar.t
Expand Up @@ -2,13 +2,13 @@ use v6;

use Test;

plan => 20;
plan => 21;

use Perl6::Conf::Grammar;
ok(1, 'loaded Perl6::Conf::Grammar and still alive');

# Perl6::Conf::Grammar.parse('');
# is($/, '', 'empty string is ok');
Perl6::Conf::Grammar.parse('');
is($/, '', 'empty string is ok');

Perl6::Conf::Grammar.parse('abc');
is($/, '', 'abc does not match');
Expand Down

0 comments on commit 9c3510d

Please sign in to comment.