Created
August 3, 2010 21:20
-
-
Save ocharles/507173 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
grammar OrgMode::Grammar { | |
token TOP { | |
<node>+ | |
} | |
token node { | |
^^ '*'+ \s+ $<text>=[\N*] \n | |
} | |
} | |
my $text = q{ | |
* Hello | |
** Hi world! | |
* How are you | |
* Test | |
* Another test | |
* Pattern? | |
* Here? | |
** Or here | |
*** Maybe here | |
* Here | |
* And | |
* Here | |
}; | |
my $match = OrgMode::Grammar.parse($text); | |
for $match<node> -> $node { | |
say "A node: $node<text>"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment