Skip to content

Instantly share code, notes, and snippets.

@softmoth
Created September 25, 2017 18:13
Show Gist options
  • Save softmoth/ab46fc0233d1981ec47d130c726a2224 to your computer and use it in GitHub Desktop.
Save softmoth/ab46fc0233d1981ec47d130c726a2224 to your computer and use it in GitHub Desktop.
YAMLish allow blank lines with less indentation
--- a/lib/YAMLish.pm6
+++ b/lib/YAMLish.pm6
@@ -223,7 +223,7 @@ grammar Grammar {
<.comment>? <.line-break>
:my $new-indent;
<?before $indent $<sp>=' '+ { $new-indent = $indent ~ $<sp> }>
- [ $new-indent $<content>=[ \N* ] | $indent <.before <.line-break> > ]+ % <.line-break>
+ [ $new-indent $<content>=[ \N* ] | ' ' ** { 0 .. $indent.chars } <.before <.line-break> > ]+ % <.line-break>
}
token yes {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment