Gramatica
Template ::= (Text | Interpolation | Tag | Comment)*
Text ::= [^{]+ ; Cualquier cosa que no empiece con '{'
Interpolation ::= '{{' Expr '}}'
Expr ::= [^}]+ ; Variable o expresión dinámica
Tag ::= '{' Modifier? TagName Attrs* ('/}' | '}') Content? ('{/' TagName '}')
Comment ::= '{-' .*? '-}'
Modifier ::= '~' | '#' | '@' | '$'
TagName ::= [\w_][\w0-9_]* ; Ejemplos: "Card", "cs", "Block"
Attrs ::= AttrKey '=' AttrValue
| '[' AttrKey ']'
| AttrKey ; Booleano implícito
AttrKey ::= [\w_][\w0-9_]* ; p1, user.name, etc.
AttrValue ::= '"' ([^"\r\n] | '\\"')* '"'
| "'" ([^'\r\n] | "\\'")* "'"
| '[' ArrayValue ']'
ArrayValue ::= (AttrKey '=' AttrValue | AttrKey | Interpolation)*
Comentarios
Publicar un comentario