Skip to content

Instantly share code, notes, and snippets.

@titsuki
Created December 3, 2017 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save titsuki/fa7691c1464c24a17d773e5a511be660 to your computer and use it in GitHub Desktop.
Save titsuki/fa7691c1464c24a17d773e5a511be660 to your computer and use it in GitHub Desktop.
grammar Infobox::Grammar {
token TOP { <infobox> .+ } # (#1)
token infobox { '{{Infobox' <.ws> <name> \n <propertylist> '}}' }
token name { <-[\n]>+ }
token propertylist {
[
| <property> \n
| \n
]+
}
token property {
'|' <key=.key-content> '=' <value=.value-content-list>
}
token key-content { <-[=\n]>+ }
token value-content-list {
<value-content>+
}
token value-content { # (#6)
[
| <anchortext>
| <weblink>
| <rawtext>
| <delimiter>
]+
}
token anchortext { '[[' <-[\n]>+? ']]' } # (#2)
token weblink { '[' <-[\n]>+? ']' } # (#3)
token rawtext { <-[\|\[\]\n、\,\<\>\}\{]>+ } # (#4)
token delimiter { [ '、' | ',' ] } # (#5)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment