Created
January 6, 2010 01:17
-
-
Save bryan-ash/269915 to your computer and use it in GitHub Desktop.
Treetop rules for optional and mandatory spaces (thanks Clifford Heath)
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
rule s # Optional space | |
S? | |
end | |
rule S # Mandatory space | |
(white / comment_to_eol / comment_c_style)+ | |
end | |
rule white | |
[ \t\n\r]+ | |
end | |
rule comment_to_eol | |
'//' (!"\n" .)+ | |
end | |
rule comment_c_style | |
'/*' (!'*/' . )* '*/' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment