Created
November 9, 2010 23:38
-
-
Save derdewey/670054 to your computer and use it in GitHub Desktop.
Spits out tag/value pairs inside of package_list > package trees
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 Debian | |
rule package_list | |
(package "\n"?)+ | |
end | |
rule package | |
(tag / value)+ <DebianSyntaxNode::Package> | |
end | |
rule tag | |
tag_value tag_stop | |
end | |
rule tag_value | |
[\w\-]+ <DebianSyntaxNode::Tag> | |
end | |
rule tag_stop | |
": " | |
end | |
rule value | |
value_line value_stop | |
end | |
rule value_line | |
([\w \. " , \- ' : / < > @ ( ) = | \[ \] + ;])+ <DebianSyntaxNode::Value> | |
end | |
rule value_stop | |
"\n"? | |
end | |
# I should post to the mailing list about why this didn't work. | |
#rule entry_value | |
# ([\w \n\.",\-'":])+ | |
#end | |
#rule entry | |
# entry_value entry_stop | |
#end | |
#rule entry_stop | |
# "\n" &tag | |
#end | |
#rule tag | |
# "\n"? tag_value tag_stop | |
#end | |
#rule tag_value | |
# ([\w\-])+ | |
#end | |
#rule tag_stop | |
# ": " | |
#end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment