Add recursive loop to support tree-like structures
[tedtools.git] / tmpl_gram.y
index 3335903..9bc2f71 100644 (file)
@@ -49,7 +49,7 @@ static GList *makeList2(void *a, void *b);
 %token <str>                   LEXEME
 %token <str>                   VAR_OPEN VAR_CLOSE EXPR_OPEN EXPR_CLOSE 
                                                INCLUDE_OPEN INCLUDE_CLOSE
-%token <str>                   HTMLESCAPE URLESCAPE IF_P ELSE_P LOOP_P ENDIF_P ENDLOOP_P 
+%token <str>                   HTMLESCAPE URLESCAPE IF_P ELSE_P LOOP_P ENDIF_P ENDLOOP_P SELF_P 
 %token         <str>                   CMP_P
 
 %token <intval>                        INTEGER
@@ -225,6 +225,10 @@ node:
                                $$->type = IncludeNode;
                                $$->nodeData.includeFile = $2;
                        }
+       | EXPR_OPEN     SELF_P EXPR_CLOSE {
+                               $$ = mc0alloc( curTmpl->templateContext, sizeof(TemplateNodeData) );
+                               $$->type = NestNode;
+                       }
        | EXPR_OPEN     LOOP_P varname EXPR_CLOSE listnodes EXPR_OPEN ENDLOOP_P EXPR_CLOSE {
                                $$ = mc0alloc( curTmpl->templateContext, sizeof(TemplateNodeData) );
                                $$->type = LoopNode;