-
-
Save omega/6765af670a7371835a3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The problem is that the test of paragraph ends up in a never ending loop, and I don't really understand why.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
grammar JIRA::Formater::Wiki::Grammar { | |
token TOP { | |
<?DEBUG(1)> | |
<paragraph>* | |
} | |
regex blankline { \s* <.eol> } | |
regex pline { <?DEBUG(1)> (.*) <.eol> } | |
regex eof { $ } | |
regex eol { [ \n | <.eof> ] } | |
regex paragraph { <pline>+ } #[ <.blankline> | <.eof> ] } | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Test; | |
BEGIN { push @*INC, './lib';} | |
use JIRA::Formater::Wiki::Grammar; | |
plan *; | |
my @strings = | |
"This is the first\nparagraph", | |
"This is the first\nparagraph\n\nAnd this is another one", | |
"This is the first\nparagraph\n\n* list\n\nAnd this is another one", | |
; | |
for @strings { | |
#my $match = JIRA::Formater::Wiki::Grammar.parse($_); | |
#isa_ok $match, Match, "the parser works for a full text"; | |
#diag($match.perl); | |
} | |
ok JIRA::Formater::Wiki::Grammar.parse("", :rule<eol>), "empty string matches <eol>"; | |
ok JIRA::Formater::Wiki::Grammar.parse("\n", :rule<eol>), "single new line matches <eol>"; | |
ok JIRA::Formater::Wiki::Grammar.parse("This is a line", :rule<pline>), "single line matches pline"; | |
ok JIRA::Formater::Wiki::Grammar.parse("This is a line", :rule<paragraph>), "single line matches paragraph"; | |
#is($f->convert('* list'), "\\begin{itemize}\n\\item list\n\\end{itemize}"); | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment