Created
July 14, 2014 06:28
-
-
Save pvande/3e59ef36a1f6a67b9716 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
# Casual Grammar | |
/{{\s*\W?\s*\w+\s*}}|{{!.*?}}|{{{\s*(\w+)\s*}}}/g | |
# Informal Grammar | |
<template> ::= (<static-content> <tag>)* <static-content> | |
<static-content> ::= <text>+ | |
<tag> ::= "{{" <whitespace>* [<tag-type>] <whitespace>* <tag-name> <whitespace>* "}}" | | |
"{{!" <text>* "}}" | | |
"{{{" <whitespace>* <tag-name> <whitespace>* "}}}" | |
<tag-type> ::= "#" | "^" | "/" | "&" | ">" | |
<tag-name> ::= <non-whitespace>+ ["." <tag-name>] | |
# Formal Grammar | |
<template> ::= (<static-content> <tag>)* <static-content> | |
<static-content> ::= <text>+ | |
<tag-content> ::= <whitespace>* <tag-name> <whitespace>* | |
<tag-name> ::= <non-whitespace>+ ["." <tag-name>] | |
<tag> ::= <tag:comment> | | |
<tag:raw-interpolation> | | |
<tag:escaped-interpolation> | | |
<tag:section> | | |
<tag:inverted-section> | | |
<tag:section-close> | | |
<tag:partial> | |
<tag:comment> ::= "{{!" <text>* "}}" | |
<tag:raw-interpolation> ::= "{{{" <tag-content> "}}}" | | |
"{{" <whitespace>* "&" <tag-content> "}}" | |
<tag:escaped-interpolation> ::= "{{" <tag-content> "}}" | |
<tag:section> ::= "{{" <whitespace>* "#" <tag-content> "}}" | |
<tag:inverted-section> ::= "{{" <whitespace>* "^" <tag-content> "}}" | |
<tag:section-close> ::= "{{" <whitespace>* "/" <tag-content> "}}" | |
<tag:partial> ::= "{{" <whitespace>* ">" <tag-content> "}}" | |
# Super Formal Grammar | |
<tag-delimiter:open> ::= "{{" | |
<tag-delimiter:close> ::= "}}" | |
<template> ::= (<text> <tag>)* <text> | |
<tag-name> ::= <non-whitespace>+ ["." <tag-name>] | |
<tag-open> ::= <tag-delimiter:open> <whitespace>* | |
<tag-close> ::= <whitespace>* <tag-delimiter:close> | |
<tag> ::= <tag:comment> | | |
<tag:change-delimiter> | | |
<tag:raw-interpolation> | | |
<tag:escaped-interpolation> | | |
<tag:section> | | |
<tag:inverted-section> | | |
<tag:section-close> | | |
<tag:partial> | |
<tag:comment> ::= <tag-open> "!" <text>* <tag-close> | |
<tag:change-delimiter> ::= <tag-delimiter:open> "=" <whitespace>* <new-delimiters> <whitespace>* "=" <tag-delimiter:close> | |
<new-delimiters> ::= <new-delimiter:open> <whitespace>+ <new-delimiter:close> | |
<new-delimiter:open> ::= <non-whitespace>+ | |
<new-delimiter:close> ::= <non-whitespace>+ | |
<tag:raw-interpolation> ::= <tag-delimiter:open> "{" <whitespace>* <tag-name> <whitespace>* "}" <tag-delimiter:close> | | |
<tag-open> "&" <whitespace>* <tag-name> <tag-close> | |
<tag:escaped-interpolation> ::= <tag-open> <tag-name> <tag-close> | |
<tag:section> ::= <tag-open> "#" <whitespace>* <tag-name> <tag-close> | |
<tag:inverted-section> ::= <tag-open> "^" <whitespace>* <tag-name> <tag-close> | |
<tag:section-close> ::= <tag-open> "/" <whitespace>* <tag-name> <tag-close> | |
<tag:partial> ::= <tag-open> ">" <whitespace>* <tag-name> <tag-close> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is awesome, but will it work with this spec? It looks like there's weird stuff with "standalone" tags.