001    /* Generated By:JavaCC: Do not edit this line. FMParser.java */
002    package freemarker.core;
003    
004    import freemarker.template.Configuration;
005    import freemarker.template.Template;
006    import freemarker.template.TemplateBooleanModel;
007    import freemarker.template.TemplateCollectionModel;
008    import freemarker.template.TemplateHashModelEx;
009    import freemarker.template.TemplateModel;
010    import freemarker.template.TemplateModelException;
011    import freemarker.template.TemplateModelIterator;
012    import freemarker.template.TemplateScalarModel;
013    import freemarker.template.utility.DeepUnwrap;
014    import freemarker.template.utility.StringUtil;
015    
016    import java.io.InputStream;
017    import java.io.Reader;
018    import java.io.StringReader;
019    import java.util.ArrayList;
020    import java.util.Enumeration;
021    import java.util.HashMap;
022    import java.util.LinkedList;
023    import java.util.Map;
024    import java.util.StringTokenizer;
025    import java.util.Vector;
026    
027    /**
028     * This class is generated by JavaCC from a grammar file.
029     */
030    public class FMParser implements FMParserConstants {
031    
032    // Necessary for adding macros and setting location info.
033      Template template;
034      private String templateName;
035    
036    // variables that keep track of whether we are in a loop or a switch.
037      private int loopNesting, switchNesting;
038      private boolean inMacro, inFunction, stripWhitespace, stripText;
039      private LinkedList escapes = new LinkedList();
040      private int contentNesting; // for stripText
041    
042      /**
043       * Create an FM expression parser using a string.
044       */
045      static public FMParser createExpressionParser(String s) {
046          SimpleCharStream scs = new SimpleCharStream(new StringReader(s), 1, 1, s.length());
047          FMParserTokenManager token_source = new FMParserTokenManager(scs);
048          token_source.SwitchTo(FMParserConstants.FM_EXPRESSION);
049          return new FMParser(token_source);
050      }
051    
052      /**
053       * Constructs a new parser object.
054       * @param template The template associated with this parser.
055       * @param reader The character stream to use as input
056       * @param strictEscapeSyntax Whether FreeMarker directives must start with a #
057       */
058      public FMParser(Template template, Reader reader, boolean strictEscapeSyntax, boolean stripWhitespace) {
059          this(reader);
060          this.template = template;
061          token_source.strictEscapeSyntax = strictEscapeSyntax;
062          this.templateName = template != null ? template.getName() : "";
063          token_source.templateName = templateName;
064          this.stripWhitespace = stripWhitespace;
065      }
066    
067      public FMParser(Template template, Reader reader, boolean strictEscapeSyntax, boolean stripWhitespace, int tagSyntax) {
068          this(template, reader, strictEscapeSyntax, stripWhitespace);
069          switch (tagSyntax) {
070              case Configuration.AUTO_DETECT_TAG_SYNTAX :
071                 token_source.autodetectTagSyntax = true;
072                 break;
073              case Configuration.ANGLE_BRACKET_TAG_SYNTAX :
074                 token_source.altDirectiveSyntax = false;
075                 break;
076              case Configuration.SQUARE_BRACKET_TAG_SYNTAX :
077                 token_source.altDirectiveSyntax = true;
078                 break;
079              default : throw new IllegalArgumentException("Illegal argument for tagSyntax");
080          }
081      }
082    
083      public FMParser(String template) {
084          this(null, new StringReader(template), true, true);
085      }
086    
087      private String getErrorStart(Token t) {
088          return "Error in template: " + template.getName()
089                + "\non line " + t.beginLine + ", column " + t.beginColumn;
090      }
091    
092      /**
093       * Throw an exception if the expression passed in is a String
094       * Literal
095       */
096      private void notStringLiteral(Expression exp, String expected) throws ParseException {
097          if (exp instanceof StringLiteral) {
098             String msg = "Error " + exp.getStartLocation()
099                         + "\nFound string literal: " + exp
100                         + "\nExpecting: " + expected;
101             throw new ParseException(msg, exp);
102          }
103      }
104    
105      /**
106       * Throw an exception if the expression passed in is a Number
107       * Literal
108       */
109      private void notNumberLiteral(Expression exp, String expected) throws ParseException {
110          if (exp instanceof NumberLiteral) {
111             String msg = "Error " + exp.getStartLocation()
112                         + "\nFound number literal: " + exp.getCanonicalForm()
113                         + "\nExpecting " + expected;
114             throw new ParseException(msg, exp);
115          }
116      }
117    
118      /**
119       * Throw an exception if the expression passed in is a boolean
120       * Literal
121       */
122      private void notBooleanLiteral(Expression exp, String expected) throws ParseException {
123          if (exp instanceof BooleanLiteral) {
124             String msg = "Error " + exp.getStartLocation()
125                         + "\nFound: " + exp.getCanonicalForm()
126                         + "\nExpecting " + expected;
127             throw new ParseException(msg, exp);
128          }
129      }
130    
131      /**
132       * Throw an exception if the expression passed in is a Hash
133       * Literal
134       */
135      private void notHashLiteral(Expression exp, String expected) throws ParseException {
136            if (exp instanceof HashLiteral) {
137             String msg = "Error " + exp.getStartLocation()
138                         + "\nFound hash literal: " + exp.getCanonicalForm()
139                         + "\nExpecting " + expected;
140             throw new ParseException(msg, exp);
141          }
142      }
143    
144      /**
145       * Throw an exception if the expression passed in is a List
146       * Literal
147       */
148    
149      private void notListLiteral(Expression exp, String expected)
150          throws ParseException
151      {
152            if (exp instanceof ListLiteral) {
153             String msg = "Error " + exp.getStartLocation()
154                         + "\nFound list literal: " + exp.getCanonicalForm()
155                         + "\nExpecting " + expected;
156             throw new ParseException(msg, exp);
157          }
158      }
159      /**
160       * Throw an exception if the expression passed in is a literal
161       * other than of the numerical type
162       */
163      private void numberLiteralOnly(Expression exp) throws ParseException {
164          notStringLiteral(exp, "number");
165          notListLiteral(exp, "number");
166          notHashLiteral(exp, "number");
167          notBooleanLiteral(exp, "number");
168      }
169    
170      /**
171       * Throw an exception if the expression passed in is
172       * not a string.
173       */
174      private void stringLiteralOnly(Expression exp) throws ParseException {
175          notNumberLiteral(exp, "number");
176          notListLiteral(exp, "number");
177          notHashLiteral(exp, "number");
178          notBooleanLiteral(exp, "number");
179      }
180    
181      /**
182       * Throw an exception if the expression passed in is a literal
183       * other than of the boolean type
184       */
185      private void booleanLiteralOnly(Expression exp) throws ParseException {
186          notStringLiteral(exp, "boolean (true/false)");
187          notListLiteral(exp, "boolean (true/false)");
188          notHashLiteral(exp, "boolean (true/false)");
189          notNumberLiteral(exp, "boolean (true/false)");
190      }
191    
192      private Expression escapedExpression(Expression exp) {
193          if(!escapes.isEmpty()) {
194              return ((EscapeBlock)escapes.getFirst()).doEscape(exp);
195          }
196          return exp;
197      }
198    
199      private boolean getBoolean(Expression exp) throws ParseException {
200          TemplateModel tm = null;
201          try {
202              tm = exp.getAsTemplateModel(null);
203          } catch (Exception e) {
204             throw new ParseException(e.getMessage()
205                                      + "\nCould not evaluate expression: "
206                                      + exp.getCanonicalForm()
207                                      + exp.getStartLocation(), exp);
208          }
209          if (tm instanceof TemplateBooleanModel) {
210              try {
211                 return ((TemplateBooleanModel) tm).getAsBoolean();
212              } catch (TemplateModelException tme) {
213              }
214          }
215          if (tm instanceof TemplateScalarModel) {
216              try {
217                  return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString());
218              } catch (Exception e) {
219                  throw new ParseException(e.getMessage()
220                                           + "\nExpecting yes/no, found: " + exp.getCanonicalForm()
221                                           + exp.getStartLocation(), exp);
222              }
223          }
224          throw new ParseException("Expecting boolean (yes/no) parameter" + exp.getStartLocation(), exp);
225      }
226    
227    // Now the actual parsing code, starting
228    // with the productions for FreeMarker's
229    // expression syntax.
230    
231    /**
232     * This is the same as OrExpression, since
233     * the OR is the operator with the lowest
234     * precedence.
235     */
236      final public Expression Expression() throws ParseException {
237       Expression exp;
238        exp = OrExpression();
239          {if (true) return exp;}
240        throw new Error("Missing return statement in function");
241      }
242    
243    /**
244     * Lowest level expression, a literal, a variable,
245     * or a possibly more complex expression bounded
246     * by parentheses.
247     */
248      final public Expression PrimaryExpression() throws ParseException {
249       Expression exp;
250        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
251        case INTEGER:
252        case DECIMAL:
253          exp = NumberLiteral();
254          break;
255        case OPEN_BRACE:
256          exp = HashLiteral();
257          break;
258        case STRING_LITERAL:
259        case RAW_STRING:
260          exp = StringLiteral(true);
261          break;
262        case FALSE:
263        case TRUE:
264          exp = BooleanLiteral();
265          break;
266        case OPEN_BRACKET:
267          exp = ListLiteral();
268          break;
269        case ID:
270          exp = Identifier();
271          break;
272        case OPEN_PAREN:
273          exp = Parenthesis();
274          break;
275        case DOT:
276          exp = BuiltinVariable();
277          break;
278        default:
279          jj_la1[0] = jj_gen;
280          jj_consume_token(-1);
281          throw new ParseException();
282        }
283        label_1:
284        while (true) {
285          if (jj_2_1(2147483647)) {
286            ;
287          } else {
288            break label_1;
289          }
290          exp = AddSubExpression(exp);
291        }
292         {if (true) return exp;}
293        throw new Error("Missing return statement in function");
294      }
295    
296      final public Expression Parenthesis() throws ParseException {
297       Expression exp, result;
298       Token start, end;
299        start = jj_consume_token(OPEN_PAREN);
300        exp = Expression();
301        end = jj_consume_token(CLOSE_PAREN);
302           result = new ParentheticalExpression(exp);
303           result.setLocation(template, start, end);
304           {if (true) return result;}
305        throw new Error("Missing return statement in function");
306      }
307    
308    /**
309     * A primary expression preceded by zero or
310     * more unary operators. (The only unary operator we
311     * currently have is the NOT.)
312     */
313      final public Expression UnaryExpression() throws ParseException {
314       Expression exp, result;
315       boolean haveNot = false;
316       Token t = null, start=null;
317        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
318        case PLUS:
319        case MINUS:
320          result = UnaryPlusMinusExpression();
321          break;
322        case EXCLAM:
323          result = NotExpression();
324          break;
325        case STRING_LITERAL:
326        case RAW_STRING:
327        case FALSE:
328        case TRUE:
329        case INTEGER:
330        case DECIMAL:
331        case DOT:
332        case OPEN_BRACKET:
333        case OPEN_PAREN:
334        case OPEN_BRACE:
335        case ID:
336          result = PrimaryExpression();
337          break;
338        default:
339          jj_la1[1] = jj_gen;
340          jj_consume_token(-1);
341          throw new ParseException();
342        }
343         {if (true) return result;}
344        throw new Error("Missing return statement in function");
345      }
346    
347      final public Expression NotExpression() throws ParseException {
348       Token t;
349       Expression exp, result=null;
350       ArrayList nots = new ArrayList();
351        label_2:
352        while (true) {
353          t = jj_consume_token(EXCLAM);
354                      nots.add(t);
355          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
356          case EXCLAM:
357            ;
358            break;
359          default:
360            jj_la1[2] = jj_gen;
361            break label_2;
362          }
363        }
364        exp = PrimaryExpression();
365          for (int i=0; i<nots.size(); i++) {
366             result = new NotExpression(exp);
367             Token tok = (Token) nots.get(nots.size() -i -1);
368             result.setLocation(template, tok, exp);
369             exp = result;
370          }
371          {if (true) return result;}
372        throw new Error("Missing return statement in function");
373      }
374    
375      final public Expression UnaryPlusMinusExpression() throws ParseException {
376       Expression exp, result;
377       boolean isMinus = false;
378       Token t;
379        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
380        case PLUS:
381          t = jj_consume_token(PLUS);
382          break;
383        case MINUS:
384          t = jj_consume_token(MINUS);
385                     isMinus = true;
386          break;
387        default:
388          jj_la1[3] = jj_gen;
389          jj_consume_token(-1);
390          throw new ParseException();
391        }
392        exp = PrimaryExpression();
393          result = new UnaryPlusMinusExpression(exp, isMinus);
394          result.setLocation(template, t, exp);
395          {if (true) return result;}
396        throw new Error("Missing return statement in function");
397      }
398    
399      final public Expression AdditiveExpression() throws ParseException {
400       Expression lhs, rhs, result;
401       boolean plus;
402        lhs = MultiplicativeExpression();
403                                       result = lhs;
404        label_3:
405        while (true) {
406          if (jj_2_2(2147483647)) {
407            ;
408          } else {
409            break label_3;
410          }
411          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
412          case PLUS:
413            jj_consume_token(PLUS);
414                     plus = true;
415            break;
416          case MINUS:
417            jj_consume_token(MINUS);
418                      plus = false;
419            break;
420          default:
421            jj_la1[4] = jj_gen;
422            jj_consume_token(-1);
423            throw new ParseException();
424          }
425          rhs = MultiplicativeExpression();
426             if (plus) {
427               // plus is treated separately, since it is also
428               // used for concatenation.
429                 result = new AddConcatExpression(lhs, rhs);
430             }
431             else {
432                 numberLiteralOnly(lhs);
433                 numberLiteralOnly(rhs);
434                 result = new ArithmeticExpression(lhs,
435                                                rhs,
436                                                ArithmeticExpression.SUBSTRACTION);
437             }
438             result.setLocation(template, lhs, rhs);
439             lhs = result;
440        }
441          {if (true) return result;}
442        throw new Error("Missing return statement in function");
443      }
444    
445    /**
446     * A unary expression followed by zero or more
447     * unary expressions with operators in between.
448     */
449      final public Expression MultiplicativeExpression() throws ParseException {
450       Expression lhs, rhs, result;
451       int operation = ArithmeticExpression.MULTIPLICATION;
452        lhs = UnaryExpression();
453                              result = lhs;
454        label_4:
455        while (true) {
456          if (jj_2_3(2147483647)) {
457            ;
458          } else {
459            break label_4;
460          }
461          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
462          case TIMES:
463            jj_consume_token(TIMES);
464                      operation = ArithmeticExpression.MULTIPLICATION;
465            break;
466          case DIVIDE:
467            jj_consume_token(DIVIDE);
468                       operation = ArithmeticExpression.DIVISION;
469            break;
470          case PERCENT:
471            jj_consume_token(PERCENT);
472                       operation = ArithmeticExpression.MODULUS;
473            break;
474          default:
475            jj_la1[5] = jj_gen;
476            jj_consume_token(-1);
477            throw new ParseException();
478          }
479          rhs = UnaryExpression();
480             numberLiteralOnly(lhs);
481             numberLiteralOnly(rhs);
482             result = new ArithmeticExpression(lhs, rhs, operation);
483             result.setLocation(template, lhs, rhs);
484             lhs = result;
485        }
486          {if (true) return result;}
487        throw new Error("Missing return statement in function");
488      }
489    
490      final public Expression EqualityExpression() throws ParseException {
491       Expression lhs, rhs, result;
492       Token t;
493        lhs = RelationalExpression();
494                                   result = lhs;
495        if (jj_2_4(2147483647)) {
496          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
497          case NOT_EQUALS:
498            t = jj_consume_token(NOT_EQUALS);
499            break;
500          case EQUALS:
501            t = jj_consume_token(EQUALS);
502            break;
503          case DOUBLE_EQUALS:
504            t = jj_consume_token(DOUBLE_EQUALS);
505            break;
506          default:
507            jj_la1[6] = jj_gen;
508            jj_consume_token(-1);
509            throw new ParseException();
510          }
511          rhs = RelationalExpression();
512            notHashLiteral(lhs, "scalar");
513            notHashLiteral(rhs, "scalar");
514            notListLiteral(lhs, "scalar");
515            notListLiteral(rhs, "scalar");
516            result = new ComparisonExpression(lhs, rhs, t.image);
517            result.setLocation(template, lhs, rhs);
518        } else {
519          ;
520        }
521          {if (true) return result;}
522        throw new Error("Missing return statement in function");
523      }
524    
525      final public Expression RelationalExpression() throws ParseException {
526       Expression lhs, rhs, result;
527       Token t;
528        lhs = RangeExpression();
529                              result = lhs;
530        if (jj_2_5(2147483647)) {
531          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
532          case NATURAL_GTE:
533            t = jj_consume_token(NATURAL_GTE);
534            break;
535          case ESCAPED_GTE:
536            t = jj_consume_token(ESCAPED_GTE);
537            break;
538          case NATURAL_GT:
539            t = jj_consume_token(NATURAL_GT);
540            break;
541          case ESCAPED_GT:
542            t = jj_consume_token(ESCAPED_GT);
543            break;
544          case LESS_THAN_EQUALS:
545            t = jj_consume_token(LESS_THAN_EQUALS);
546            break;
547          case LESS_THAN:
548            t = jj_consume_token(LESS_THAN);
549            break;
550          default:
551            jj_la1[7] = jj_gen;
552            jj_consume_token(-1);
553            throw new ParseException();
554          }
555          rhs = RangeExpression();
556            notHashLiteral(lhs, "scalar");
557            notHashLiteral(rhs, "scalar");
558            notListLiteral(lhs, "scalar");
559            notListLiteral(rhs, "scalar");
560            notStringLiteral(lhs, "number");
561            notStringLiteral(rhs, "number");
562            result = new ComparisonExpression(lhs, rhs, t.image);
563            result.setLocation(template, lhs, rhs);
564        } else {
565          ;
566        }
567          {if (true) return result;}
568        throw new Error("Missing return statement in function");
569      }
570    
571      final public Expression RangeExpression() throws ParseException {
572       Expression lhs, rhs=null, result;
573        lhs = AdditiveExpression();
574                                  result = lhs;
575        if (jj_2_7(2147483647)) {
576          jj_consume_token(DOT_DOT);
577          if (jj_2_6(2147483647)) {
578            rhs = AdditiveExpression();
579          } else {
580            ;
581          }
582               numberLiteralOnly(lhs);
583               if (rhs != null) {
584                   numberLiteralOnly(rhs);
585               }
586               Range range = new Range(lhs, rhs);
587               if (rhs != null) {
588                   range.setLocation(template, lhs, rhs);
589               } else {
590                  range.setLocation(template, lhs, lhs);
591               }
592               result = range;
593        } else {
594          ;
595        }
596            {if (true) return result;}
597        throw new Error("Missing return statement in function");
598      }
599    
600      final public Expression AndExpression() throws ParseException {
601       Expression lhs, rhs, result;
602        lhs = EqualityExpression();
603                                 result = lhs;
604        label_5:
605        while (true) {
606          if (jj_2_8(2147483647)) {
607            ;
608          } else {
609            break label_5;
610          }
611          jj_consume_token(AND);
612          rhs = EqualityExpression();
613             booleanLiteralOnly(lhs);
614             booleanLiteralOnly(rhs);
615             result = new AndExpression(lhs, rhs);
616             result.setLocation(template, lhs, rhs);
617             lhs = result;
618        }
619          {if (true) return result;}
620        throw new Error("Missing return statement in function");
621      }
622    
623      final public Expression OrExpression() throws ParseException {
624       Expression lhs, rhs, result;
625        lhs = AndExpression();
626                            result = lhs;
627        label_6:
628        while (true) {
629          if (jj_2_9(2147483647)) {
630            ;
631          } else {
632            break label_6;
633          }
634          jj_consume_token(OR);
635          rhs = AndExpression();
636             booleanLiteralOnly(lhs);
637             booleanLiteralOnly(rhs);
638             result = new OrExpression(lhs, rhs);
639             result.setLocation(template, lhs, rhs);
640             lhs = result;
641        }
642          {if (true) return result;}
643        throw new Error("Missing return statement in function");
644      }
645    
646      final public ListLiteral ListLiteral() throws ParseException {
647       ArrayList values = new ArrayList();
648       Token begin, end;
649        begin = jj_consume_token(OPEN_BRACKET);
650        values = PositionalArgs();
651        end = jj_consume_token(CLOSE_BRACKET);
652            ListLiteral result = new ListLiteral(values);
653            result.setLocation(template, begin, end);
654            {if (true) return result;}
655        throw new Error("Missing return statement in function");
656      }
657    
658      final public Expression NumberLiteral() throws ParseException {
659       Token op = null, t;
660        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
661        case INTEGER:
662          t = jj_consume_token(INTEGER);
663          break;
664        case DECIMAL:
665          t = jj_consume_token(DECIMAL);
666          break;
667        default:
668          jj_la1[8] = jj_gen;
669          jj_consume_token(-1);
670          throw new ParseException();
671        }
672           String s = t.image;
673           Expression result = new NumberLiteral(template.getArithmeticEngine().toNumber(s));
674           Token startToken = (op != null) ? op : t;
675           result.setLocation(template, startToken, t);
676           {if (true) return result;}
677        throw new Error("Missing return statement in function");
678      }
679    
680      final public Identifier Identifier() throws ParseException {
681        Token t;
682        t = jj_consume_token(ID);
683            Identifier id = new Identifier(t.image);
684            id.setLocation(template, t, t);
685            {if (true) return id;}
686        throw new Error("Missing return statement in function");
687      }
688    
689      final public Expression IdentifierOrStringLiteral() throws ParseException {
690       Expression exp;
691        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
692        case ID:
693          exp = Identifier();
694          break;
695        case STRING_LITERAL:
696        case RAW_STRING:
697          exp = StringLiteral(false);
698          break;
699        default:
700          jj_la1[9] = jj_gen;
701          jj_consume_token(-1);
702          throw new ParseException();
703        }
704          {if (true) return exp;}
705        throw new Error("Missing return statement in function");
706      }
707    
708      final public BuiltinVariable BuiltinVariable() throws ParseException {
709       Token dot, name;
710        dot = jj_consume_token(DOT);
711        name = jj_consume_token(ID);
712          BuiltinVariable result = null;
713          try {
714              result = new BuiltinVariable(name.image);
715          } catch (ParseException pe) {
716              pe.lineNumber = dot.beginLine;
717              pe.columnNumber = dot.beginColumn;
718              {if (true) throw pe;}
719          }
720          result.setLocation(template, dot, name);
721          {if (true) return result;}
722        throw new Error("Missing return statement in function");
723      }
724    
725    /**
726     * Production that builds up an expression
727     * using the dot or dynamic key name
728     * or the args list if this is a method invocation.
729     */
730      final public Expression AddSubExpression(Expression exp) throws ParseException {
731       Expression result = null;
732        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
733        case DOT:
734          result = DotVariable(exp);
735          break;
736        case OPEN_BRACKET:
737          result = DynamicKey(exp);
738          break;
739        case OPEN_PAREN:
740          result = MethodArgs(exp);
741          break;
742        case BUILT_IN:
743          result = BuiltIn(exp);
744          break;
745        case EXCLAM:
746        case TERMINATING_EXCLAM:
747          result = DefaultTo(exp);
748          break;
749        case EXISTS:
750          result = Exists(exp);
751          break;
752        default:
753          jj_la1[10] = jj_gen;
754          jj_consume_token(-1);
755          throw new ParseException();
756        }
757            {if (true) return result;}
758        throw new Error("Missing return statement in function");
759      }
760    
761      final public Expression DefaultTo(Expression exp) throws ParseException {
762       Expression rhs = null;
763       Token t;
764        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
765        case TERMINATING_EXCLAM:
766          t = jj_consume_token(TERMINATING_EXCLAM);
767          break;
768        case EXCLAM:
769          t = jj_consume_token(EXCLAM);
770          if (jj_2_10(2147483647)) {
771            rhs = Expression();
772          } else {
773            ;
774          }
775          break;
776        default:
777          jj_la1[11] = jj_gen;
778          jj_consume_token(-1);
779          throw new ParseException();
780        }
781          DefaultToExpression result = new DefaultToExpression(exp, rhs);
782          if (rhs ==null) {
783              result.setLocation(template, exp, t);
784          }
785          else {
786              result.setLocation(template, exp, rhs);
787          }
788          {if (true) return result;}
789        throw new Error("Missing return statement in function");
790      }
791    
792      final public Expression Exists(Expression exp) throws ParseException {
793       Token t;
794        t = jj_consume_token(EXISTS);
795           ExistsExpression result = new ExistsExpression(exp);
796           result.setLocation(template, exp, t);
797           {if (true) return result;}
798        throw new Error("Missing return statement in function");
799      }
800    
801      final public Expression BuiltIn(Expression exp) throws ParseException {
802       Token t=null;
803        jj_consume_token(BUILT_IN);
804        t = jj_consume_token(ID);
805           BuiltIn result = null;
806           try {
807               result = BuiltIn.newBuiltIn(exp, t.image, t, templateName);
808           } catch (ParseException pe) {
809               pe.lineNumber = t.beginLine;
810               pe.columnNumber = t.beginColumn;
811               {if (true) throw pe;}
812           }
813           result.setLocation(template, exp, t);
814           {if (true) return result;}
815        throw new Error("Missing return statement in function");
816      }
817    
818    /**
819     * production for when a key is specified by <DOT> + keyname
820     */
821      final public Expression DotVariable(Expression exp) throws ParseException {
822      Token t;
823        jj_consume_token(DOT);
824        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
825        case ID:
826          t = jj_consume_token(ID);
827          break;
828        case TIMES:
829          t = jj_consume_token(TIMES);
830          break;
831        case DOUBLE_STAR:
832          t = jj_consume_token(DOUBLE_STAR);
833          break;
834        case FALSE:
835        case TRUE:
836        case LESS_THAN:
837        case LESS_THAN_EQUALS:
838        case ESCAPED_GT:
839        case ESCAPED_GTE:
840        case IN:
841        case AS:
842        case USING:
843          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
844          case LESS_THAN:
845            t = jj_consume_token(LESS_THAN);
846            break;
847          case LESS_THAN_EQUALS:
848            t = jj_consume_token(LESS_THAN_EQUALS);
849            break;
850          case ESCAPED_GT:
851            t = jj_consume_token(ESCAPED_GT);
852            break;
853          case ESCAPED_GTE:
854            t = jj_consume_token(ESCAPED_GTE);
855            break;
856          case FALSE:
857            t = jj_consume_token(FALSE);
858            break;
859          case TRUE:
860            t = jj_consume_token(TRUE);
861            break;
862          case IN:
863            t = jj_consume_token(IN);
864            break;
865          case AS:
866            t = jj_consume_token(AS);
867            break;
868          case USING:
869            t = jj_consume_token(USING);
870            break;
871          default:
872            jj_la1[12] = jj_gen;
873            jj_consume_token(-1);
874            throw new ParseException();
875          }
876                if (!Character.isLetter(t.image.charAt(0))) {
877                    String msg = getErrorStart(t)
878                                + "\n" + t.image + " is not a valid identifier.";
879                    {if (true) throw new ParseException(msg, t.beginLine, t.beginColumn);}
880                }
881          break;
882        default:
883          jj_la1[13] = jj_gen;
884          jj_consume_token(-1);
885          throw new ParseException();
886        }
887             notListLiteral(exp, "hash");
888             notStringLiteral(exp, "hash");
889             notBooleanLiteral(exp, "hash");
890             Dot dot = new Dot(exp, t.image);
891             dot.setLocation(template, exp, t);
892             {if (true) return dot;}
893        throw new Error("Missing return statement in function");
894      }
895    
896    /**
897     * production for when the key is specified
898     * in brackets.
899     */
900      final public Expression DynamicKey(Expression exp) throws ParseException {
901       Expression arg;
902       Token t;
903        jj_consume_token(OPEN_BRACKET);
904        arg = Expression();
905        t = jj_consume_token(CLOSE_BRACKET);
906           notBooleanLiteral(exp, "list or hash");
907           notNumberLiteral(exp, "list or hash");
908           DynamicKeyName dkn = new DynamicKeyName(exp, arg);
909           dkn.setLocation(template, exp, t);
910           {if (true) return dkn;}
911        throw new Error("Missing return statement in function");
912      }
913    
914    /**
915     * production for an arglist part of a method invocation.
916     */
917      final public MethodCall MethodArgs(Expression exp) throws ParseException {
918         ArrayList args = new ArrayList();
919         Token end;
920        jj_consume_token(OPEN_PAREN);
921        args = PositionalArgs();
922        end = jj_consume_token(CLOSE_PAREN);
923            args.trimToSize();
924            MethodCall result = new MethodCall(exp, args);
925            result.setLocation(template, exp, end);
926            {if (true) return result;}
927        throw new Error("Missing return statement in function");
928      }
929    
930      final public StringLiteral StringLiteral(boolean interpolate) throws ParseException {
931      Token t;
932      boolean raw = false;
933        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
934        case STRING_LITERAL:
935          t = jj_consume_token(STRING_LITERAL);
936          break;
937        case RAW_STRING:
938          t = jj_consume_token(RAW_STRING);
939                         raw = true;
940          break;
941        default:
942          jj_la1[14] = jj_gen;
943          jj_consume_token(-1);
944          throw new ParseException();
945        }
946           String s = t.image;
947           // Get rid of the quotes.
948           s = s.substring(1, s.length() -1);
949           if (raw) {
950               s=s.substring(1);
951           }
952           else try {
953              s = StringUtil.FTLStringLiteralDec(s);
954           } catch (ParseException pe) {
955              pe.lineNumber = t.beginLine;
956              pe.columnNumber = t.beginColumn;
957              {if (true) throw pe;}
958           }
959           StringLiteral result = new StringLiteral(s);
960           result.setLocation(template, t, t);
961           if (interpolate && !raw) {
962               if (t.image.indexOf("${") >=0 || t.image.indexOf("#{") >=0)
963                  result.checkInterpolation();
964           }
965           {if (true) return result;}
966        throw new Error("Missing return statement in function");
967      }
968    
969      final public Expression BooleanLiteral() throws ParseException {
970       Token t;
971       Expression result;
972        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
973        case FALSE:
974          t = jj_consume_token(FALSE);
975                      result = new BooleanLiteral(false);
976          break;
977        case TRUE:
978          t = jj_consume_token(TRUE);
979                     result = new BooleanLiteral(true);
980          break;
981        default:
982          jj_la1[15] = jj_gen;
983          jj_consume_token(-1);
984          throw new ParseException();
985        }
986           result.setLocation(template, t, t);
987           {if (true) return result;}
988        throw new Error("Missing return statement in function");
989      }
990    
991      final public HashLiteral HashLiteral() throws ParseException {
992       Token begin, end;
993       Expression key, value;
994       ArrayList keys = new ArrayList();
995       ArrayList values = new ArrayList();
996        begin = jj_consume_token(OPEN_BRACE);
997        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
998        case STRING_LITERAL:
999        case RAW_STRING:
1000        case FALSE:
1001        case TRUE:
1002        case INTEGER:
1003        case DECIMAL:
1004        case DOT:
1005        case PLUS:
1006        case MINUS:
1007        case EXCLAM:
1008        case OPEN_BRACKET:
1009        case OPEN_PAREN:
1010        case OPEN_BRACE:
1011        case ID:
1012          key = Expression();
1013          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1014          case COMMA:
1015            jj_consume_token(COMMA);
1016            break;
1017          case COLON:
1018            jj_consume_token(COLON);
1019            break;
1020          default:
1021            jj_la1[16] = jj_gen;
1022            jj_consume_token(-1);
1023            throw new ParseException();
1024          }
1025          value = Expression();
1026              stringLiteralOnly(key);
1027              keys.add(key);
1028              values.add(value);
1029          label_7:
1030          while (true) {
1031            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1032            case COMMA:
1033              ;
1034              break;
1035            default:
1036              jj_la1[17] = jj_gen;
1037              break label_7;
1038            }
1039            jj_consume_token(COMMA);
1040            key = Expression();
1041            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1042            case COMMA:
1043              jj_consume_token(COMMA);
1044              break;
1045            case COLON:
1046              jj_consume_token(COLON);
1047              break;
1048            default:
1049              jj_la1[18] = jj_gen;
1050              jj_consume_token(-1);
1051              throw new ParseException();
1052            }
1053            value = Expression();
1054                   stringLiteralOnly(key);
1055                   keys.add(key);
1056                   values.add(value);
1057          }
1058          break;
1059        default:
1060          jj_la1[19] = jj_gen;
1061          ;
1062        }
1063        end = jj_consume_token(CLOSE_BRACE);
1064          HashLiteral result = new HashLiteral(keys, values);
1065          result.setLocation(template, begin, end);
1066          {if (true) return result;}
1067        throw new Error("Missing return statement in function");
1068      }
1069    
1070    /**
1071     * A production representing the ${...}
1072     * that outputs a variable.
1073     */
1074      final public DollarVariable StringOutput() throws ParseException {
1075       Expression exp;
1076       Token begin, end;
1077        begin = jj_consume_token(OUTPUT_ESCAPE);
1078        exp = Expression();
1079          notHashLiteral(exp, "scalar");
1080          notListLiteral(exp, "scalar");
1081          notBooleanLiteral(exp, "scalar");
1082        end = jj_consume_token(CLOSE_BRACE);
1083          DollarVariable result = new DollarVariable(exp, escapedExpression(exp));
1084          result.setLocation(template, begin, end);
1085          {if (true) return result;}
1086        throw new Error("Missing return statement in function");
1087      }
1088    
1089      final public NumericalOutput NumericalOutput() throws ParseException {
1090       Expression exp;
1091       Token fmt = null, begin, end;
1092        begin = jj_consume_token(NUMERICAL_ESCAPE);
1093        exp = Expression();
1094                         numberLiteralOnly(exp);
1095        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1096        case SEMICOLON:
1097          jj_consume_token(SEMICOLON);
1098          fmt = jj_consume_token(ID);
1099          break;
1100        default:
1101          jj_la1[20] = jj_gen;
1102          ;
1103        }
1104        end = jj_consume_token(CLOSE_BRACE);
1105          NumericalOutput result;
1106          if (fmt != null) {
1107             int minFrac = -1;  // -1 indicates that the value has not been set
1108             int maxFrac = -1;
1109    
1110             StringTokenizer st = new StringTokenizer(fmt.image, "mM", true);
1111             char type = '-';
1112             while (st.hasMoreTokens()) {
1113                 String token = st.nextToken();
1114                 try {
1115                    if (type != '-') {
1116                        switch (type) {
1117                        case 'm':
1118                           if (minFrac != -1) {if (true) throw new ParseException("invalid formatting string", fmt.beginLine, fmt.beginColumn);}
1119                           minFrac = Integer.parseInt(token);
1120                           break;
1121                        case 'M':
1122                           if (maxFrac != -1) {if (true) throw new ParseException("invalid formatting string", fmt.beginLine, fmt.beginColumn);}
1123                           maxFrac = Integer.parseInt(token);
1124                           break;
1125                        default:
1126                           {if (true) throw new ParseException();}
1127                        }
1128                        type = '-';
1129                    } else if (token.equals("m")) {
1130                       type = 'm';
1131                    } else if (token.equals("M")) {
1132                       type = 'M';
1133                    } else {
1134                       {if (true) throw new ParseException();}
1135                    }
1136                 }
1137                 catch (ParseException e) {
1138                    String msg = getErrorStart(fmt)
1139                          + "\nInvalid format specifier "
1140                          + fmt.image;
1141                    {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1142                 }
1143                 catch (NumberFormatException e) {
1144                    String msg = getErrorStart(fmt)
1145                          + "\nInvalid number in the format specifier "
1146                          + fmt.image;
1147                    {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1148                 }
1149             }
1150    
1151             if (maxFrac == -1) {
1152                if (minFrac == -1) {
1153                   String msg = getErrorStart(fmt)
1154                         + "\nInvalid format specification, at least one of m and M must be specified!";
1155                   {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1156                }
1157                maxFrac = minFrac;
1158             } else if (minFrac == -1) {
1159                minFrac = 0;
1160             }
1161             if (minFrac > maxFrac) {
1162                String msg = getErrorStart(fmt)
1163                      + "\nInvalid format specification, min cannot be greater than max!";
1164                {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1165             }
1166             if (minFrac > 50 || maxFrac > 50) {// sanity check
1167                   String msg = getErrorStart(fmt)
1168                   + "\nCannot specify more than 50 fraction digits";
1169                 {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1170             }
1171             result = new NumericalOutput(exp, minFrac, maxFrac);
1172          } else {  // if format != null
1173             result = new NumericalOutput(exp);
1174          }
1175          result.setLocation(template, begin, end);
1176          {if (true) return result;}
1177        throw new Error("Missing return statement in function");
1178      }
1179    
1180      final public TemplateElement If() throws ParseException {
1181        Token start, end, t;
1182        Expression condition;
1183        TemplateElement block;
1184        IfBlock ifBlock;
1185        ConditionalBlock cblock;
1186        start = jj_consume_token(IF);
1187        condition = Expression();
1188        jj_consume_token(DIRECTIVE_END);
1189        block = OptionalBlock();
1190          cblock = new ConditionalBlock(condition, block, true);
1191          cblock.setLocation(template, start, block);
1192          ifBlock = new IfBlock(cblock);
1193        label_8:
1194        while (true) {
1195          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1196          case ELSE_IF:
1197            ;
1198            break;
1199          default:
1200            jj_la1[21] = jj_gen;
1201            break label_8;
1202          }
1203          t = jj_consume_token(ELSE_IF);
1204          condition = Expression();
1205          LooseDirectiveEnd();
1206          block = OptionalBlock();
1207              cblock = new ConditionalBlock(condition, block, false);
1208              cblock.setLocation(template, t, block);
1209              ifBlock.addBlock(cblock);
1210        }
1211        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1212        case ELSE:
1213          t = jj_consume_token(ELSE);
1214          block = OptionalBlock();
1215                cblock = new ConditionalBlock(null, block, false);
1216                cblock.setLocation(template, t, block);
1217                ifBlock.addBlock(cblock);
1218          break;
1219        default:
1220          jj_la1[22] = jj_gen;
1221          ;
1222        }
1223        end = jj_consume_token(END_IF);
1224           ifBlock.setLocation(template, start, end);
1225           {if (true) return ifBlock;}
1226        throw new Error("Missing return statement in function");
1227      }
1228    
1229      final public AttemptBlock Attempt() throws ParseException {
1230       Token start, end;
1231       TemplateElement block, recoveryBlock;
1232        start = jj_consume_token(ATTEMPT);
1233        block = OptionalBlock();
1234        recoveryBlock = Recover();
1235        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1236        case END_RECOVER:
1237          end = jj_consume_token(END_RECOVER);
1238          break;
1239        case END_ATTEMPT:
1240          end = jj_consume_token(END_ATTEMPT);
1241          break;
1242        default:
1243          jj_la1[23] = jj_gen;
1244          jj_consume_token(-1);
1245          throw new ParseException();
1246        }
1247          AttemptBlock result = new AttemptBlock(block, recoveryBlock);
1248          result.setLocation(template, start, end);
1249          {if (true) return result;}
1250        throw new Error("Missing return statement in function");
1251      }
1252    
1253      final public RecoveryBlock Recover() throws ParseException {
1254       Token start;
1255       TemplateElement block;
1256        start = jj_consume_token(RECOVER);
1257        block = OptionalBlock();
1258          RecoveryBlock result = new RecoveryBlock(block);
1259          result.setLocation(template, start, block);
1260          {if (true) return result;}
1261        throw new Error("Missing return statement in function");
1262      }
1263    
1264      final public IteratorBlock List() throws ParseException {
1265        Expression exp;
1266        Token index, start, end;
1267        TemplateElement block;
1268        start = jj_consume_token(LIST);
1269                     ++loopNesting;
1270        exp = Expression();
1271        jj_consume_token(AS);
1272        index = jj_consume_token(ID);
1273        jj_consume_token(DIRECTIVE_END);
1274        block = OptionalBlock();
1275        end = jj_consume_token(END_LIST);
1276         --loopNesting;
1277         IteratorBlock result = new IteratorBlock(exp,
1278                                                  index.image,
1279                                                  block,
1280                                                  false);
1281         result.setLocation(template, start, end);
1282         {if (true) return result;}
1283        throw new Error("Missing return statement in function");
1284      }
1285    
1286      final public IteratorBlock ForEach() throws ParseException {
1287         Expression exp;
1288         Token index, start, end;
1289         TemplateElement block;
1290        start = jj_consume_token(FOREACH);
1291                        ++loopNesting;
1292        index = jj_consume_token(ID);
1293        jj_consume_token(IN);
1294        exp = Expression();
1295        jj_consume_token(DIRECTIVE_END);
1296        block = OptionalBlock();
1297        end = jj_consume_token(END_FOREACH);
1298         --loopNesting;
1299         IteratorBlock result = new IteratorBlock(exp,
1300                                                  index.image,
1301                                                  block,
1302                                                  true);
1303         result.setLocation(template, start, end);
1304         {if (true) return result;}
1305        throw new Error("Missing return statement in function");
1306      }
1307    
1308      final public VisitNode Visit() throws ParseException {
1309       Token start, end;
1310       Expression targetNode, namespaces=null;
1311        start = jj_consume_token(VISIT);
1312        targetNode = Expression();
1313        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1314        case USING:
1315          jj_consume_token(USING);
1316          namespaces = Expression();
1317          break;
1318        default:
1319          jj_la1[24] = jj_gen;
1320          ;
1321        }
1322        end = LooseDirectiveEnd();
1323           VisitNode result = new VisitNode(targetNode, namespaces);
1324           result.setLocation(template, start, end);
1325           {if (true) return result;}
1326        throw new Error("Missing return statement in function");
1327      }
1328    
1329      final public RecurseNode Recurse() throws ParseException {
1330       Token start, end = null;
1331       Expression node=null, namespaces=null;
1332        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1333        case SIMPLE_RECURSE:
1334          start = jj_consume_token(SIMPLE_RECURSE);
1335          break;
1336        case RECURSE:
1337          start = jj_consume_token(RECURSE);
1338          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1339          case STRING_LITERAL:
1340          case RAW_STRING:
1341          case FALSE:
1342          case TRUE:
1343          case INTEGER:
1344          case DECIMAL:
1345          case DOT:
1346          case PLUS:
1347          case MINUS:
1348          case EXCLAM:
1349          case OPEN_BRACKET:
1350          case OPEN_PAREN:
1351          case OPEN_BRACE:
1352          case ID:
1353            node = Expression();
1354            break;
1355          default:
1356            jj_la1[25] = jj_gen;
1357            ;
1358          }
1359          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1360          case USING:
1361            jj_consume_token(USING);
1362            namespaces = Expression();
1363            break;
1364          default:
1365            jj_la1[26] = jj_gen;
1366            ;
1367          }
1368          end = LooseDirectiveEnd();
1369          break;
1370        default:
1371          jj_la1[27] = jj_gen;
1372          jj_consume_token(-1);
1373          throw new ParseException();
1374        }
1375           if (end == null) end = start;
1376           RecurseNode result = new RecurseNode(node, namespaces);
1377           result.setLocation(template, start, end);
1378           {if (true) return result;}
1379        throw new Error("Missing return statement in function");
1380      }
1381    
1382      final public FallbackInstruction FallBack() throws ParseException {
1383       Token tok;
1384        tok = jj_consume_token(FALLBACK);
1385          if (!inMacro) {
1386              {if (true) throw new ParseException(getErrorStart(tok)
1387                                       + "\nCannot fall back "
1388                                       + " outside a macro.",
1389                                       tok.beginLine, tok.beginColumn);}
1390    
1391          }
1392          FallbackInstruction result = new FallbackInstruction();
1393          result.setLocation(template, tok, tok);
1394          {if (true) return result;}
1395        throw new Error("Missing return statement in function");
1396      }
1397    
1398    /**
1399     * Production used to break out of a loop or a switch block.
1400     */
1401      final public BreakInstruction Break() throws ParseException {
1402       Token start;
1403        start = jj_consume_token(BREAK);
1404           if (loopNesting < 1 && switchNesting <1)
1405           {
1406              String msg = getErrorStart(start) + "\n"
1407                           + start.image
1408                           + " occurred outside a loop or a switch block.";
1409              {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1410           }
1411           BreakInstruction result = new BreakInstruction();
1412           result.setLocation(template, start, start);
1413           {if (true) return result;}
1414        throw new Error("Missing return statement in function");
1415      }
1416    
1417    /**
1418     * Production used to jump out of a macro.
1419     * The stop instruction terminates the rendering of the template.
1420     */
1421      final public ReturnInstruction Return() throws ParseException {
1422       Token start, end=null;
1423       Expression exp = null;
1424        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1425        case SIMPLE_RETURN:
1426          start = jj_consume_token(SIMPLE_RETURN);
1427                                end = start;
1428          break;
1429        case RETURN:
1430          start = jj_consume_token(RETURN);
1431          exp = Expression();
1432          end = LooseDirectiveEnd();
1433          break;
1434        default:
1435          jj_la1[28] = jj_gen;
1436          jj_consume_token(-1);
1437          throw new ParseException();
1438        }
1439          if (inMacro) {
1440             if (exp != null) {
1441                String msg = getErrorStart(start)
1442                             + "\nA macro cannot return a value";
1443                {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1444             }
1445          }
1446          else if (inFunction) {
1447             if (exp == null) {
1448                String msg = getErrorStart(start)
1449                             + "\nA function must return a value";
1450                {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1451             }
1452          }
1453          else {
1454             if (exp == null) {
1455                String msg = getErrorStart(start)
1456                             + "\nA return instruction can only occur inside a macro of function";
1457                {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1458             }
1459          }
1460          ReturnInstruction result = new ReturnInstruction(exp);
1461          result.setLocation(template, start, end);
1462          {if (true) return result;}
1463        throw new Error("Missing return statement in function");
1464      }
1465    
1466      final public StopInstruction Stop() throws ParseException {
1467       Token start = null;
1468       Expression exp = null;
1469        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1470        case HALT:
1471          start = jj_consume_token(HALT);
1472          break;
1473        case STOP:
1474          start = jj_consume_token(STOP);
1475          exp = Expression();
1476          LooseDirectiveEnd();
1477          break;
1478        default:
1479          jj_la1[29] = jj_gen;
1480          jj_consume_token(-1);
1481          throw new ParseException();
1482        }
1483           StopInstruction result = new StopInstruction(exp);
1484           result.setLocation(template, start, start);
1485           {if (true) return result;}
1486        throw new Error("Missing return statement in function");
1487      }
1488    
1489      final public TemplateElement Nested() throws ParseException {
1490      Token t, end;
1491      ArrayList bodyParameters;
1492      BodyInstruction result = null;
1493        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1494        case SIMPLE_NESTED:
1495          t = jj_consume_token(SIMPLE_NESTED);
1496                result = new BodyInstruction(null);
1497                result.setLocation(template, t, t);
1498          break;
1499        case NESTED:
1500          t = jj_consume_token(NESTED);
1501          bodyParameters = PositionalArgs();
1502          end = LooseDirectiveEnd();
1503                 result = new BodyInstruction(bodyParameters);
1504                 result.setLocation(template, t, end);
1505          break;
1506        default:
1507          jj_la1[30] = jj_gen;
1508          jj_consume_token(-1);
1509          throw new ParseException();
1510        }
1511           if (!inMacro) {
1512              {if (true) throw new ParseException(getErrorStart(t)
1513                                       + "\nCannot use a "
1514                                       + t.image
1515                                       + " instruction outside a macro.",
1516                                       t.beginLine, t.beginColumn);}
1517           }
1518           {if (true) return result;}
1519        throw new Error("Missing return statement in function");
1520      }
1521    
1522      final public TemplateElement Flush() throws ParseException {
1523      Token t;
1524        t = jj_consume_token(FLUSH);
1525           FlushInstruction result = new FlushInstruction();
1526           result.setLocation(template, t, t);
1527           {if (true) return result;}
1528        throw new Error("Missing return statement in function");
1529      }
1530    
1531      final public TemplateElement Trim() throws ParseException {
1532      Token t;
1533      TrimInstruction result=null;
1534        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1535        case TRIM:
1536          t = jj_consume_token(TRIM);
1537                   result = new TrimInstruction(true, true);
1538          break;
1539        case LTRIM:
1540          t = jj_consume_token(LTRIM);
1541                    result = new TrimInstruction(true, false);
1542          break;
1543        case RTRIM:
1544          t = jj_consume_token(RTRIM);
1545                    result = new TrimInstruction(false, true);
1546          break;
1547        case NOTRIM:
1548          t = jj_consume_token(NOTRIM);
1549                     result = new TrimInstruction(false, false);
1550          break;
1551        default:
1552          jj_la1[31] = jj_gen;
1553          jj_consume_token(-1);
1554          throw new ParseException();
1555        }
1556           result.setLocation(template, t, t);
1557           {if (true) return result;}
1558        throw new Error("Missing return statement in function");
1559      }
1560    
1561      final public TemplateElement Assign() throws ParseException {
1562       Token start, end;
1563       int scope;
1564       Token id=null;
1565       Expression nameExp, exp, nsExp=null;
1566       String varName;
1567       ArrayList assignments = new ArrayList();
1568       Assignment ass;
1569       TemplateElement block;
1570        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1571        case ASSIGN:
1572          start = jj_consume_token(ASSIGN);
1573                          scope = Assignment.NAMESPACE;
1574          break;
1575        case GLOBALASSIGN:
1576          start = jj_consume_token(GLOBALASSIGN);
1577                               scope = Assignment.GLOBAL;
1578          break;
1579        case LOCALASSIGN:
1580          start = jj_consume_token(LOCALASSIGN);
1581                               scope = Assignment.LOCAL;
1582              scope = Assignment.LOCAL;
1583              if (!inMacro && !inFunction) {
1584                 String msg = getErrorStart(start)
1585                              + "\nLocal variable assigned outside a macro.";
1586                 {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1587              }
1588          break;
1589        default:
1590          jj_la1[32] = jj_gen;
1591          jj_consume_token(-1);
1592          throw new ParseException();
1593        }
1594        nameExp = IdentifierOrStringLiteral();
1595           varName = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1596        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1597        case EQUALS:
1598          jj_consume_token(EQUALS);
1599          exp = Expression();
1600              ass = new Assignment(varName, exp, scope);
1601              ass.setLocation(template, nameExp, exp);
1602              assignments.add(ass);
1603          label_9:
1604          while (true) {
1605            if (jj_2_11(2147483647)) {
1606              ;
1607            } else {
1608              break label_9;
1609            }
1610            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1611            case COMMA:
1612              jj_consume_token(COMMA);
1613              break;
1614            default:
1615              jj_la1[33] = jj_gen;
1616              ;
1617            }
1618            nameExp = IdentifierOrStringLiteral();
1619                   varName = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1620            jj_consume_token(EQUALS);
1621            exp = Expression();
1622                   ass = new Assignment(varName, exp, scope);
1623                   ass.setLocation(template, nameExp, exp);
1624                   assignments.add(ass);
1625          }
1626          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1627          case IN:
1628            id = jj_consume_token(IN);
1629            nsExp = Expression();
1630                                  if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(id) + "\nCannot assign to namespace here.", id.beginLine, id.beginColumn);}
1631            break;
1632          default:
1633            jj_la1[34] = jj_gen;
1634            ;
1635          }
1636          end = LooseDirectiveEnd();
1637               AssignmentInstruction ai = new AssignmentInstruction(scope);
1638               for (int i = 0; i< assignments.size(); i++) {
1639                    ai.addAssignment((Assignment) assignments.get(i));
1640               }
1641               ai.setNamespaceExp(nsExp);
1642               ai.setLocation(template, start, end);
1643               {if (true) return ai;}
1644          break;
1645        case IN:
1646        case DIRECTIVE_END:
1647          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1648          case IN:
1649            id = jj_consume_token(IN);
1650            nsExp = Expression();
1651                                  if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(id) + "\nCannot assign to namespace here.", id.beginLine, id.beginColumn);}
1652            break;
1653          default:
1654            jj_la1[35] = jj_gen;
1655            ;
1656          }
1657          jj_consume_token(DIRECTIVE_END);
1658          block = OptionalBlock();
1659          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1660          case END_LOCAL:
1661            end = jj_consume_token(END_LOCAL);
1662                               if (scope != Assignment.LOCAL) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags.", end.beginLine, end.beginColumn);}
1663            break;
1664          case END_ASSIGN:
1665            end = jj_consume_token(END_ASSIGN);
1666                                if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags.", end.beginLine, end.beginColumn);}
1667            break;
1668          case END_GLOBAL:
1669            end = jj_consume_token(END_GLOBAL);
1670                                if (scope != Assignment.GLOBAL) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags", end.beginLine, end.beginColumn);}
1671            break;
1672          default:
1673            jj_la1[36] = jj_gen;
1674            jj_consume_token(-1);
1675            throw new ParseException();
1676          }
1677              BlockAssignment ba = new BlockAssignment(block, varName, scope, nsExp);
1678              ba.setLocation(template, start, end);
1679              {if (true) return ba;}
1680          break;
1681        default:
1682          jj_la1[37] = jj_gen;
1683          jj_consume_token(-1);
1684          throw new ParseException();
1685        }
1686        throw new Error("Missing return statement in function");
1687      }
1688    
1689      final public Include Include() throws ParseException {
1690       Expression nameExp;
1691       Token att, start, end;
1692       Expression exp, parseExp = null, encodingExp = null;
1693        start = jj_consume_token(_INCLUDE);
1694        nameExp = Expression();
1695        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1696        case SEMICOLON:
1697          jj_consume_token(SEMICOLON);
1698          break;
1699        default:
1700          jj_la1[38] = jj_gen;
1701          ;
1702        }
1703        label_10:
1704        while (true) {
1705          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1706          case ID:
1707            ;
1708            break;
1709          default:
1710            jj_la1[39] = jj_gen;
1711            break label_10;
1712          }
1713          att = jj_consume_token(ID);
1714          jj_consume_token(EQUALS);
1715          exp = Expression();
1716                 String attString = att.image;
1717                 if (attString.equalsIgnoreCase("parse")) {
1718                    parseExp = exp;
1719                 }
1720                 else if (attString.equalsIgnoreCase("encoding")) {
1721                    encodingExp = exp;
1722                 }
1723                 else {
1724                     String msg = getErrorStart(att)
1725                           + "\nexpecting parse= or encoding= to be specified.";
1726                     {if (true) throw new ParseException(msg, att.beginLine, att.beginColumn);}
1727                 }
1728        }
1729        end = LooseDirectiveEnd();
1730           Include result = new Include(template, nameExp, encodingExp, parseExp);
1731           result.setLocation(template, start, end);
1732           {if (true) return result;}
1733        throw new Error("Missing return statement in function");
1734      }
1735    
1736      final public LibraryLoad Import() throws ParseException {
1737       Token start, end, ns;
1738       Expression nameExp;
1739        start = jj_consume_token(IMPORT);
1740        nameExp = Expression();
1741        jj_consume_token(AS);
1742        ns = jj_consume_token(ID);
1743        end = LooseDirectiveEnd();
1744           LibraryLoad result = new LibraryLoad(template, nameExp, ns.image);
1745           result.setLocation(template, start, end);
1746           template.addImport(result);
1747           {if (true) return result;}
1748        throw new Error("Missing return statement in function");
1749      }
1750    
1751      final public Macro Macro() throws ParseException {
1752       Token arg, start, end;
1753       Expression nameExp;
1754       String name;
1755       ArrayList argNames = new ArrayList();
1756       HashMap args = new HashMap();
1757       ArrayList defNames = new ArrayList();
1758       Expression defValue=null;
1759       TemplateElement block;
1760       boolean isFunction = false, hasDefaults=false;
1761       boolean isCatchAll = false;
1762       String catchAll = null;
1763        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1764        case MACRO:
1765          start = jj_consume_token(MACRO);
1766          break;
1767        case FUNCTION:
1768          start = jj_consume_token(FUNCTION);
1769                              isFunction = true;
1770          break;
1771        default:
1772          jj_la1[40] = jj_gen;
1773          jj_consume_token(-1);
1774          throw new ParseException();
1775        }
1776           if (inMacro || inFunction) {
1777             {if (true) throw new ParseException(getErrorStart(start)
1778                         + "\nMacros cannot be nested.", start.beginLine, start.endLine);}
1779           }
1780           if (isFunction) inFunction = true; else inMacro = true;
1781        nameExp = IdentifierOrStringLiteral();
1782           name = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1783        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1784        case OPEN_PAREN:
1785          jj_consume_token(OPEN_PAREN);
1786          break;
1787        default:
1788          jj_la1[41] = jj_gen;
1789          ;
1790        }
1791        label_11:
1792        while (true) {
1793          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1794          case ID:
1795            ;
1796            break;
1797          default:
1798            jj_la1[42] = jj_gen;
1799            break label_11;
1800          }
1801          arg = jj_consume_token(ID);
1802                        defValue = null;
1803          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1804          case ELLIPSIS:
1805            jj_consume_token(ELLIPSIS);
1806                            isCatchAll = true;
1807            break;
1808          default:
1809            jj_la1[43] = jj_gen;
1810            ;
1811          }
1812          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1813          case EQUALS:
1814            jj_consume_token(EQUALS);
1815            defValue = Expression();
1816                  defNames.add(arg.image);
1817                  hasDefaults = true;
1818            break;
1819          default:
1820            jj_la1[44] = jj_gen;
1821            ;
1822          }
1823          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1824          case COMMA:
1825            jj_consume_token(COMMA);
1826            break;
1827          default:
1828            jj_la1[45] = jj_gen;
1829            ;
1830          }
1831              if (catchAll != null) {
1832                  {if (true) throw new ParseException(getErrorStart(arg)
1833                    + "\nThere may only be one \"catch-all\" parameter in a macro declaration, "
1834                    + "and it must be the last parameter.", arg.beginLine, arg.endLine);}
1835              }
1836              if (isCatchAll) {
1837                  if (defValue != null) {
1838                      {if (true) throw new ParseException(getErrorStart(arg)
1839                        + "\n\"Catch-all\" macro parameter may not have a default value.",
1840                        arg.beginLine, arg.endLine);}
1841                  }
1842                  catchAll = arg.image;
1843              } else {
1844                  argNames.add(arg.image);
1845                  if (hasDefaults && defValue == null) {
1846                      {if (true) throw new ParseException(getErrorStart(arg)
1847                        + "\nIn a macro declaration, parameters without a default value "
1848                        + "must all occur before the parameters with default values.",
1849                        arg.beginLine, arg.endLine);}
1850                  }
1851                  args.put(arg.image, defValue);
1852              }
1853        }
1854        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1855        case CLOSE_PAREN:
1856          jj_consume_token(CLOSE_PAREN);
1857          break;
1858        default:
1859          jj_la1[46] = jj_gen;
1860          ;
1861        }
1862        jj_consume_token(DIRECTIVE_END);
1863        block = OptionalBlock();
1864        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1865        case END_MACRO:
1866          end = jj_consume_token(END_MACRO);
1867                              if(isFunction) {if (true) throw new ParseException(getErrorStart(start) + "\nExpected function end tag here.", start.beginLine, start.endLine);}
1868          break;
1869        case END_FUNCTION:
1870          end = jj_consume_token(END_FUNCTION);
1871                                 if(!isFunction) {if (true) throw new ParseException(getErrorStart(start) + "\nExpected macro end tag here.", start.beginLine, start.endLine);}
1872          break;
1873        default:
1874          jj_la1[47] = jj_gen;
1875          jj_consume_token(-1);
1876          throw new ParseException();
1877        }
1878           inMacro = inFunction = false;
1879           Macro result = new Macro(name, argNames, args, block);
1880           result.setCatchAll(catchAll);
1881           result.isFunction = isFunction;
1882           result.setLocation(template, start, end);
1883           template.addMacro(result);
1884           {if (true) return result;}
1885        throw new Error("Missing return statement in function");
1886      }
1887    
1888      final public CompressedBlock Compress() throws ParseException {
1889       TemplateElement block;
1890       Token start, end;
1891        start = jj_consume_token(COMPRESS);
1892        block = OptionalBlock();
1893        end = jj_consume_token(END_COMPRESS);
1894           CompressedBlock cb = new CompressedBlock(block);
1895           cb.setLocation(template, start, end);
1896           {if (true) return cb;}
1897        throw new Error("Missing return statement in function");
1898      }
1899    
1900      final public TemplateElement UnifiedMacroTransform() throws ParseException {
1901       Token start=null, end, t;
1902       HashMap namedArgs = null;
1903       ArrayList positionalArgs = null, bodyParameters = null;
1904       String directiveName = null;
1905       TemplateElement nestedBlock = null;
1906       Expression exp;
1907        start = jj_consume_token(UNIFIED_CALL);
1908        exp = Expression();
1909            if (exp instanceof Identifier || (exp instanceof Dot && ((Dot) exp).onlyHasIdentifiers())) {
1910               directiveName = exp.getCanonicalForm();
1911            }
1912        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1913        case TERMINATING_WHITESPACE:
1914          jj_consume_token(TERMINATING_WHITESPACE);
1915          break;
1916        default:
1917          jj_la1[48] = jj_gen;
1918          ;
1919        }
1920        if (jj_2_12(2147483647)) {
1921          namedArgs = NamedArgs();
1922        } else {
1923          positionalArgs = PositionalArgs();
1924        }
1925        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1926        case SEMICOLON:
1927          jj_consume_token(SEMICOLON);
1928                       bodyParameters = new ArrayList();
1929          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1930          case ID:
1931          case TERMINATING_WHITESPACE:
1932            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1933            case TERMINATING_WHITESPACE:
1934              jj_consume_token(TERMINATING_WHITESPACE);
1935              break;
1936            default:
1937              jj_la1[49] = jj_gen;
1938              ;
1939            }
1940            t = jj_consume_token(ID);
1941                                                 bodyParameters.add(t.image);
1942            label_12:
1943            while (true) {
1944              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1945              case COMMA:
1946              case TERMINATING_WHITESPACE:
1947                ;
1948                break;
1949              default:
1950                jj_la1[50] = jj_gen;
1951                break label_12;
1952              }
1953              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1954              case TERMINATING_WHITESPACE:
1955                jj_consume_token(TERMINATING_WHITESPACE);
1956                break;
1957              default:
1958                jj_la1[51] = jj_gen;
1959                ;
1960              }
1961              jj_consume_token(COMMA);
1962              switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1963              case TERMINATING_WHITESPACE:
1964                jj_consume_token(TERMINATING_WHITESPACE);
1965                break;
1966              default:
1967                jj_la1[52] = jj_gen;
1968                ;
1969              }
1970              t = jj_consume_token(ID);
1971                                                      bodyParameters.add(t.image);
1972            }
1973            break;
1974          default:
1975            jj_la1[53] = jj_gen;
1976            ;
1977          }
1978          break;
1979        default:
1980          jj_la1[54] = jj_gen;
1981          ;
1982        }
1983        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1984        case EMPTY_DIRECTIVE_END:
1985          end = jj_consume_token(EMPTY_DIRECTIVE_END);
1986          break;
1987        case DIRECTIVE_END:
1988          jj_consume_token(DIRECTIVE_END);
1989          nestedBlock = OptionalBlock();
1990          end = jj_consume_token(UNIFIED_CALL_END);
1991               String s = end.image.substring(3);
1992               s = s.substring(0, s.length() -1).trim();
1993               if (s.length() >0 && !s.equals(directiveName)) {
1994                  String msg = getErrorStart(end);
1995                  if (directiveName == null) {
1996                        {if (true) throw new ParseException(msg + "\nExpecting </@>", end.beginLine, end.beginColumn);}
1997                  }
1998                  else {
1999                      {if (true) throw new ParseException(msg + "\nExpecting </@> or </@" + directiveName + ">", end.beginLine, end.beginColumn);}
2000                  }
2001               }
2002          break;
2003        default:
2004          jj_la1[55] = jj_gen;
2005          jj_consume_token(-1);
2006          throw new ParseException();
2007        }
2008           TemplateElement result = (positionalArgs != null) ? new UnifiedCall(exp, positionalArgs, nestedBlock, bodyParameters)
2009                                             : new UnifiedCall(exp, namedArgs, nestedBlock, bodyParameters);
2010           result.setLocation(template, start, end);
2011           {if (true) return result;}
2012        throw new Error("Missing return statement in function");
2013      }
2014    
2015      final public TemplateElement Call() throws ParseException {
2016       Token start, end, id;
2017       HashMap namedArgs = null;
2018       ArrayList positionalArgs = null;
2019       String macroName= null;
2020        start = jj_consume_token(CALL);
2021        id = jj_consume_token(ID);
2022                 macroName = id.image;
2023        if (jj_2_14(2147483647)) {
2024          namedArgs = NamedArgs();
2025        } else {
2026          if (jj_2_13(2147483647)) {
2027            jj_consume_token(OPEN_PAREN);
2028          } else {
2029            ;
2030          }
2031          positionalArgs = PositionalArgs();
2032          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2033          case CLOSE_PAREN:
2034            jj_consume_token(CLOSE_PAREN);
2035            break;
2036          default:
2037            jj_la1[56] = jj_gen;
2038            ;
2039          }
2040        }
2041        end = LooseDirectiveEnd();
2042           UnifiedCall result = null;
2043           if (positionalArgs != null) {
2044              result = new UnifiedCall(new Identifier(macroName), positionalArgs, null, null);
2045           }
2046           else {
2047              result = new UnifiedCall(new Identifier(macroName), namedArgs, null, null);
2048           }
2049           result.legacySyntax = true;
2050           result.setLocation(template, start, end);
2051           {if (true) return result;}
2052        throw new Error("Missing return statement in function");
2053      }
2054    
2055      final public HashMap NamedArgs() throws ParseException {
2056        HashMap result = new HashMap();
2057        Token t;
2058        Expression exp;
2059        label_13:
2060        while (true) {
2061          t = jj_consume_token(ID);
2062          jj_consume_token(EQUALS);
2063             token_source.SwitchTo(token_source.NAMED_PARAMETER_EXPRESSION);
2064             token_source.inInvocation = true;
2065          exp = Expression();
2066            result.put(t.image, exp);
2067          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2068          case ID:
2069            ;
2070            break;
2071          default:
2072            jj_la1[57] = jj_gen;
2073            break label_13;
2074          }
2075        }
2076          token_source.inInvocation = false;
2077         {if (true) return result;}
2078        throw new Error("Missing return statement in function");
2079      }
2080    
2081      final public ArrayList PositionalArgs() throws ParseException {
2082      ArrayList result = new ArrayList();
2083      Expression arg;
2084        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2085        case STRING_LITERAL:
2086        case RAW_STRING:
2087        case FALSE:
2088        case TRUE:
2089        case INTEGER:
2090        case DECIMAL:
2091        case DOT:
2092        case PLUS:
2093        case MINUS:
2094        case EXCLAM:
2095        case OPEN_BRACKET:
2096        case OPEN_PAREN:
2097        case OPEN_BRACE:
2098        case ID:
2099          arg = Expression();
2100                            result.add(arg);
2101          label_14:
2102          while (true) {
2103            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2104            case STRING_LITERAL:
2105            case RAW_STRING:
2106            case FALSE:
2107            case TRUE:
2108            case INTEGER:
2109            case DECIMAL:
2110            case DOT:
2111            case PLUS:
2112            case MINUS:
2113            case EXCLAM:
2114            case COMMA:
2115            case OPEN_BRACKET:
2116            case OPEN_PAREN:
2117            case OPEN_BRACE:
2118            case ID:
2119              ;
2120              break;
2121            default:
2122              jj_la1[58] = jj_gen;
2123              break label_14;
2124            }
2125            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2126            case COMMA:
2127              jj_consume_token(COMMA);
2128              break;
2129            default:
2130              jj_la1[59] = jj_gen;
2131              ;
2132            }
2133            arg = Expression();
2134                               result.add(arg);
2135          }
2136          break;
2137        default:
2138          jj_la1[60] = jj_gen;
2139          ;
2140        }
2141         {if (true) return result;}
2142        throw new Error("Missing return statement in function");
2143      }
2144    
2145      final public Comment Comment() throws ParseException {
2146       Token start, end;
2147       StringBuffer buf = new StringBuffer();
2148        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2149        case COMMENT:
2150          start = jj_consume_token(COMMENT);
2151          break;
2152        case TERSE_COMMENT:
2153          start = jj_consume_token(TERSE_COMMENT);
2154          break;
2155        default:
2156          jj_la1[61] = jj_gen;
2157          jj_consume_token(-1);
2158          throw new ParseException();
2159        }
2160        end = UnparsedContent(buf);
2161           Comment result = new Comment(buf.toString());
2162           result.setLocation(template, start, end);
2163           {if (true) return result;}
2164        throw new Error("Missing return statement in function");
2165      }
2166    
2167      final public TextBlock NoParse() throws ParseException {
2168       Token start, end;
2169       StringBuffer buf = new StringBuffer();
2170        start = jj_consume_token(NOPARSE);
2171        end = UnparsedContent(buf);
2172            TextBlock result = new TextBlock(buf.toString(), true);
2173            result.setLocation(template, start, end);
2174            {if (true) return result;}
2175        throw new Error("Missing return statement in function");
2176      }
2177    
2178      final public TransformBlock Transform() throws ParseException {
2179       Token start, end, argName;
2180       Expression exp, argExp;
2181       TemplateElement content = null;
2182       HashMap args = null;
2183        start = jj_consume_token(TRANSFORM);
2184        exp = Expression();
2185        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2186        case SEMICOLON:
2187          jj_consume_token(SEMICOLON);
2188          break;
2189        default:
2190          jj_la1[62] = jj_gen;
2191          ;
2192        }
2193        label_15:
2194        while (true) {
2195          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2196          case ID:
2197            ;
2198            break;
2199          default:
2200            jj_la1[63] = jj_gen;
2201            break label_15;
2202          }
2203          argName = jj_consume_token(ID);
2204          jj_consume_token(EQUALS);
2205          argExp = Expression();
2206               if (args == null) args = new HashMap();
2207               args.put(argName.image, argExp);
2208        }
2209        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2210        case EMPTY_DIRECTIVE_END:
2211          end = jj_consume_token(EMPTY_DIRECTIVE_END);
2212          break;
2213        case DIRECTIVE_END:
2214          jj_consume_token(DIRECTIVE_END);
2215          content = OptionalBlock();
2216          end = jj_consume_token(END_TRANSFORM);
2217          break;
2218        default:
2219          jj_la1[64] = jj_gen;
2220          jj_consume_token(-1);
2221          throw new ParseException();
2222        }
2223           TransformBlock result = new TransformBlock(exp, args, content);
2224           result.setLocation(template, start, end);
2225           {if (true) return result;}
2226        throw new Error("Missing return statement in function");
2227      }
2228    
2229      final public SwitchBlock Switch() throws ParseException {
2230        SwitchBlock switchBlock;
2231        Case caseIns;
2232        Expression switchExp;
2233        Token start, end;
2234        boolean defaultFound = false;
2235        start = jj_consume_token(SWITCH);
2236        switchExp = Expression();
2237        jj_consume_token(DIRECTIVE_END);
2238          ++switchNesting;
2239          switchBlock = new SwitchBlock(switchExp);
2240        label_16:
2241        while (true) {
2242          if (jj_2_15(2)) {
2243            ;
2244          } else {
2245            break label_16;
2246          }
2247          caseIns = Case();
2248            if (caseIns.isDefault) {
2249               if (defaultFound) {
2250                    String msg = getErrorStart(start)
2251                                + "\nYou can only have one default case in a switch statement";
2252                    {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
2253               }
2254               defaultFound = true;
2255            }
2256            switchBlock.addCase(caseIns);
2257        }
2258        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2259        case WHITESPACE:
2260          jj_consume_token(WHITESPACE);
2261          break;
2262        default:
2263          jj_la1[65] = jj_gen;
2264          ;
2265        }
2266        end = jj_consume_token(END_SWITCH);
2267          --switchNesting;
2268          switchBlock.setLocation(template, start, end);
2269          {if (true) return switchBlock;}
2270        throw new Error("Missing return statement in function");
2271      }
2272    
2273      final public Case Case() throws ParseException {
2274        Expression exp = null;
2275        TemplateElement block;
2276        boolean isDefault = false;
2277        Token start;
2278        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2279        case WHITESPACE:
2280          jj_consume_token(WHITESPACE);
2281          break;
2282        default:
2283          jj_la1[66] = jj_gen;
2284          ;
2285        }
2286        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2287        case CASE:
2288          start = jj_consume_token(CASE);
2289          exp = Expression();
2290          jj_consume_token(DIRECTIVE_END);
2291          break;
2292        case DEFAUL:
2293          start = jj_consume_token(DEFAUL);
2294                         isDefault = true;
2295          break;
2296        default:
2297          jj_la1[67] = jj_gen;
2298          jj_consume_token(-1);
2299          throw new ParseException();
2300        }
2301        block = OptionalBlock();
2302           Case result = new Case(exp, block, isDefault);
2303           result.setLocation(template, start, block);
2304           {if (true) return result;}
2305        throw new Error("Missing return statement in function");
2306      }
2307    
2308      final public EscapeBlock Escape() throws ParseException {
2309        Token variable, start, end;
2310        Expression escapeExpr;
2311        TemplateElement content;
2312        start = jj_consume_token(ESCAPE);
2313        variable = jj_consume_token(ID);
2314        jj_consume_token(AS);
2315        escapeExpr = Expression();
2316        jj_consume_token(DIRECTIVE_END);
2317            EscapeBlock result = new EscapeBlock(variable.image, escapeExpr, escapedExpression(escapeExpr));
2318            escapes.addFirst(result);
2319        content = OptionalBlock();
2320            result.setContent(content);
2321            escapes.removeFirst();
2322        end = jj_consume_token(END_ESCAPE);
2323           result.setLocation(template, start, end);
2324           {if (true) return result;}
2325        throw new Error("Missing return statement in function");
2326      }
2327    
2328      final public NoEscapeBlock NoEscape() throws ParseException {
2329        Token start, end;
2330        TemplateElement content;
2331        start = jj_consume_token(NOESCAPE);
2332            if(escapes.isEmpty()) {
2333                    String msg = getErrorStart(start)
2334                                      + "\nnoescape with no matching escape encountered.";
2335                {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
2336            }
2337            Object escape = escapes.removeFirst();
2338        content = OptionalBlock();
2339        end = jj_consume_token(END_NOESCAPE);
2340           escapes.addFirst(escape);
2341           NoEscapeBlock result = new NoEscapeBlock(content);
2342           result.setLocation(template, start, end);
2343           {if (true) return result;}
2344        throw new Error("Missing return statement in function");
2345      }
2346    
2347    /**
2348     * Production to terminate potentially empty elements. Either a ">" or "/>"
2349     */
2350      final public Token LooseDirectiveEnd() throws ParseException {
2351        Token t;
2352        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2353        case DIRECTIVE_END:
2354          t = jj_consume_token(DIRECTIVE_END);
2355          break;
2356        case EMPTY_DIRECTIVE_END:
2357          t = jj_consume_token(EMPTY_DIRECTIVE_END);
2358          break;
2359        default:
2360          jj_la1[68] = jj_gen;
2361          jj_consume_token(-1);
2362          throw new ParseException();
2363        }
2364          {if (true) return t;}
2365        throw new Error("Missing return statement in function");
2366      }
2367    
2368      final public PropertySetting Setting() throws ParseException {
2369       Token start, end, key;
2370       Expression value;
2371        start = jj_consume_token(SETTING);
2372        key = jj_consume_token(ID);
2373        jj_consume_token(EQUALS);
2374        value = Expression();
2375        end = LooseDirectiveEnd();
2376          PropertySetting result = new PropertySetting(key.image, value);
2377          result.setLocation(template, start, end);
2378          {if (true) return result;}
2379        throw new Error("Missing return statement in function");
2380      }
2381    
2382    /**
2383     * A production for FreeMarker directives.
2384     */
2385      final public TemplateElement FreemarkerDirective() throws ParseException {
2386       TemplateElement tp;
2387        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2388        case IF:
2389          tp = If();
2390          break;
2391        case LIST:
2392          tp = List();
2393          break;
2394        case FOREACH:
2395          tp = ForEach();
2396          break;
2397        case ASSIGN:
2398        case GLOBALASSIGN:
2399        case LOCALASSIGN:
2400          tp = Assign();
2401          break;
2402        case _INCLUDE:
2403          tp = Include();
2404          break;
2405        case IMPORT:
2406          tp = Import();
2407          break;
2408        case FUNCTION:
2409        case MACRO:
2410          tp = Macro();
2411          break;
2412        case COMPRESS:
2413          tp = Compress();
2414          break;
2415        case UNIFIED_CALL:
2416          tp = UnifiedMacroTransform();
2417          break;
2418        case CALL:
2419          tp = Call();
2420          break;
2421        case COMMENT:
2422        case TERSE_COMMENT:
2423          tp = Comment();
2424          break;
2425        case NOPARSE:
2426          tp = NoParse();
2427          break;
2428        case TRANSFORM:
2429          tp = Transform();
2430          break;
2431        case SWITCH:
2432          tp = Switch();
2433          break;
2434        case SETTING:
2435          tp = Setting();
2436          break;
2437        case BREAK:
2438          tp = Break();
2439          break;
2440        case RETURN:
2441        case SIMPLE_RETURN:
2442          tp = Return();
2443          break;
2444        case STOP:
2445        case HALT:
2446          tp = Stop();
2447          break;
2448        case FLUSH:
2449          tp = Flush();
2450          break;
2451        case TRIM:
2452        case LTRIM:
2453        case RTRIM:
2454        case NOTRIM:
2455          tp = Trim();
2456          break;
2457        case SIMPLE_NESTED:
2458        case NESTED:
2459          tp = Nested();
2460          break;
2461        case ESCAPE:
2462          tp = Escape();
2463          break;
2464        case NOESCAPE:
2465          tp = NoEscape();
2466          break;
2467        case VISIT:
2468          tp = Visit();
2469          break;
2470        case SIMPLE_RECURSE:
2471        case RECURSE:
2472          tp = Recurse();
2473          break;
2474        case FALLBACK:
2475          tp = FallBack();
2476          break;
2477        case ATTEMPT:
2478          tp = Attempt();
2479          break;
2480        default:
2481          jj_la1[69] = jj_gen;
2482          jj_consume_token(-1);
2483          throw new ParseException();
2484        }
2485          {if (true) return tp;}
2486        throw new Error("Missing return statement in function");
2487      }
2488    
2489    /**
2490     * Production for a block of raw text
2491     * i.e. text that contains no
2492     * FreeMarker directives.
2493     */
2494      final public TextBlock PCData() throws ParseException {
2495        StringBuffer buf = new StringBuffer();
2496        Token t=null, start=null, prevToken = null;
2497        label_17:
2498        while (true) {
2499          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2500          case WHITESPACE:
2501              prevToken = t;
2502            t = jj_consume_token(WHITESPACE);
2503            break;
2504          case PRINTABLE_CHARS:
2505            t = jj_consume_token(PRINTABLE_CHARS);
2506            break;
2507          case FALSE_ALERT:
2508            t = jj_consume_token(FALSE_ALERT);
2509            break;
2510          default:
2511            jj_la1[70] = jj_gen;
2512            jj_consume_token(-1);
2513            throw new ParseException();
2514          }
2515             buf.append(t.image);
2516             if (start == null) start = t;
2517             {if (prevToken != null) prevToken.next = null;}
2518          if (jj_2_16(2147483647)) {
2519            ;
2520          } else {
2521            break label_17;
2522          }
2523        }
2524             if (stripText && contentNesting == 1)
2525                 {if (true) return TextBlock.EMPTY_BLOCK;}
2526    
2527             TextBlock result = new TextBlock(buf.toString(), false);
2528             result.setLocation(template, start, t);
2529             {if (true) return result;}
2530        throw new Error("Missing return statement in function");
2531      }
2532    
2533    /**
2534     * Production for dealing with unparsed content,
2535     * i.e. what is inside a comment or noparse tag.
2536     * It returns the ending token. The content
2537     * of the tag is put in buf.
2538     */
2539      final public Token UnparsedContent(StringBuffer buf) throws ParseException {
2540       Token t;
2541        label_18:
2542        while (true) {
2543          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2544          case KEEP_GOING:
2545            t = jj_consume_token(KEEP_GOING);
2546            break;
2547          case MAYBE_END:
2548            t = jj_consume_token(MAYBE_END);
2549            break;
2550          case TERSE_COMMENT_END:
2551            t = jj_consume_token(TERSE_COMMENT_END);
2552            break;
2553          case LONE_LESS_THAN_OR_DASH:
2554            t = jj_consume_token(LONE_LESS_THAN_OR_DASH);
2555            break;
2556          default:
2557            jj_la1[71] = jj_gen;
2558            jj_consume_token(-1);
2559            throw new ParseException();
2560          }
2561           buf.append(t.image);
2562          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2563          case TERSE_COMMENT_END:
2564          case MAYBE_END:
2565          case KEEP_GOING:
2566          case LONE_LESS_THAN_OR_DASH:
2567            ;
2568            break;
2569          default:
2570            jj_la1[72] = jj_gen;
2571            break label_18;
2572          }
2573        }
2574          buf.setLength(buf.length() - t.image.length());
2575          {if (true) return t;}
2576        throw new Error("Missing return statement in function");
2577      }
2578    
2579      final public TemplateElement Content() throws ParseException {
2580        MixedContent nodes = new MixedContent();
2581        TemplateElement elem, begin=null;
2582        contentNesting++;
2583        label_19:
2584        while (true) {
2585          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2586          case WHITESPACE:
2587          case PRINTABLE_CHARS:
2588          case FALSE_ALERT:
2589            elem = PCData();
2590            break;
2591          case OUTPUT_ESCAPE:
2592            elem = StringOutput();
2593            break;
2594          case NUMERICAL_ESCAPE:
2595            elem = NumericalOutput();
2596            break;
2597          case ATTEMPT:
2598          case IF:
2599          case LIST:
2600          case FOREACH:
2601          case SWITCH:
2602          case ASSIGN:
2603          case GLOBALASSIGN:
2604          case LOCALASSIGN:
2605          case _INCLUDE:
2606          case IMPORT:
2607          case FUNCTION:
2608          case MACRO:
2609          case TRANSFORM:
2610          case VISIT:
2611          case STOP:
2612          case RETURN:
2613          case CALL:
2614          case SETTING:
2615          case COMPRESS:
2616          case COMMENT:
2617          case TERSE_COMMENT:
2618          case NOPARSE:
2619          case BREAK:
2620          case SIMPLE_RETURN:
2621          case HALT:
2622          case FLUSH:
2623          case TRIM:
2624          case LTRIM:
2625          case RTRIM:
2626          case NOTRIM:
2627          case SIMPLE_NESTED:
2628          case NESTED:
2629          case SIMPLE_RECURSE:
2630          case RECURSE:
2631          case FALLBACK:
2632          case ESCAPE:
2633          case NOESCAPE:
2634          case UNIFIED_CALL:
2635            elem = FreemarkerDirective();
2636            break;
2637          default:
2638            jj_la1[73] = jj_gen;
2639            jj_consume_token(-1);
2640            throw new ParseException();
2641          }
2642                if (begin == null) {
2643                   begin = elem;
2644                }
2645                nodes.addElement(elem);
2646          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2647          case ATTEMPT:
2648          case IF:
2649          case LIST:
2650          case FOREACH:
2651          case SWITCH:
2652          case ASSIGN:
2653          case GLOBALASSIGN:
2654          case LOCALASSIGN:
2655          case _INCLUDE:
2656          case IMPORT:
2657          case FUNCTION:
2658          case MACRO:
2659          case TRANSFORM:
2660          case VISIT:
2661          case STOP:
2662          case RETURN:
2663          case CALL:
2664          case SETTING:
2665          case COMPRESS:
2666          case COMMENT:
2667          case TERSE_COMMENT:
2668          case NOPARSE:
2669          case BREAK:
2670          case SIMPLE_RETURN:
2671          case HALT:
2672          case FLUSH:
2673          case TRIM:
2674          case LTRIM:
2675          case RTRIM:
2676          case NOTRIM:
2677          case SIMPLE_NESTED:
2678          case NESTED:
2679          case SIMPLE_RECURSE:
2680          case RECURSE:
2681          case FALLBACK:
2682          case ESCAPE:
2683          case NOESCAPE:
2684          case UNIFIED_CALL:
2685          case WHITESPACE:
2686          case PRINTABLE_CHARS:
2687          case FALSE_ALERT:
2688          case OUTPUT_ESCAPE:
2689          case NUMERICAL_ESCAPE:
2690            ;
2691            break;
2692          default:
2693            jj_la1[74] = jj_gen;
2694            break label_19;
2695          }
2696        }
2697            contentNesting--;
2698            nodes.setLocation(template, begin, elem);
2699            {if (true) return nodes;}
2700        throw new Error("Missing return statement in function");
2701      }
2702    
2703    /**
2704     * A production freemarker text that may contain
2705     * ${...} and #{...} but no directives.
2706     */
2707      final public TemplateElement FreeMarkerText() throws ParseException {
2708         MixedContent nodes = new MixedContent();
2709         TemplateElement elem, begin = null;
2710        label_20:
2711        while (true) {
2712          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2713          case WHITESPACE:
2714          case PRINTABLE_CHARS:
2715          case FALSE_ALERT:
2716            elem = PCData();
2717            break;
2718          case OUTPUT_ESCAPE:
2719            elem = StringOutput();
2720            break;
2721          case NUMERICAL_ESCAPE:
2722            elem = NumericalOutput();
2723            break;
2724          default:
2725            jj_la1[75] = jj_gen;
2726            jj_consume_token(-1);
2727            throw new ParseException();
2728          }
2729             if (begin == null) {
2730                begin = elem;
2731             }
2732             nodes.addElement(elem);
2733          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2734          case WHITESPACE:
2735          case PRINTABLE_CHARS:
2736          case FALSE_ALERT:
2737          case OUTPUT_ESCAPE:
2738          case NUMERICAL_ESCAPE:
2739            ;
2740            break;
2741          default:
2742            jj_la1[76] = jj_gen;
2743            break label_20;
2744          }
2745        }
2746           nodes.setLocation(template, begin, elem);
2747           {if (true) return nodes;}
2748        throw new Error("Missing return statement in function");
2749      }
2750    
2751    /**
2752     * A production for a block of optional content.
2753     * Returns an empty Text block if there is no
2754     * content.
2755     */
2756      final public TemplateElement OptionalBlock() throws ParseException {
2757       TemplateElement tp = TextBlock.EMPTY_BLOCK;
2758        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2759        case ATTEMPT:
2760        case IF:
2761        case LIST:
2762        case FOREACH:
2763        case SWITCH:
2764        case ASSIGN:
2765        case GLOBALASSIGN:
2766        case LOCALASSIGN:
2767        case _INCLUDE:
2768        case IMPORT:
2769        case FUNCTION:
2770        case MACRO:
2771        case TRANSFORM:
2772        case VISIT:
2773        case STOP:
2774        case RETURN:
2775        case CALL:
2776        case SETTING:
2777        case COMPRESS:
2778        case COMMENT:
2779        case TERSE_COMMENT:
2780        case NOPARSE:
2781        case BREAK:
2782        case SIMPLE_RETURN:
2783        case HALT:
2784        case FLUSH:
2785        case TRIM:
2786        case LTRIM:
2787        case RTRIM:
2788        case NOTRIM:
2789        case SIMPLE_NESTED:
2790        case NESTED:
2791        case SIMPLE_RECURSE:
2792        case RECURSE:
2793        case FALLBACK:
2794        case ESCAPE:
2795        case NOESCAPE:
2796        case UNIFIED_CALL:
2797        case WHITESPACE:
2798        case PRINTABLE_CHARS:
2799        case FALSE_ALERT:
2800        case OUTPUT_ESCAPE:
2801        case NUMERICAL_ESCAPE:
2802          // has no effect but to get rid of a spurious warning.
2803                   tp = Content();
2804          break;
2805        default:
2806          jj_la1[77] = jj_gen;
2807          ;
2808        }
2809          {if (true) return tp;}
2810        throw new Error("Missing return statement in function");
2811      }
2812    
2813      final public void HeaderElement() throws ParseException {
2814       Token key;
2815       Expression exp = null;
2816        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2817        case WHITESPACE:
2818          jj_consume_token(WHITESPACE);
2819          break;
2820        default:
2821          jj_la1[78] = jj_gen;
2822          ;
2823        }
2824        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2825        case TRIVIAL_FTL_HEADER:
2826          jj_consume_token(TRIVIAL_FTL_HEADER);
2827          break;
2828        case FTL_HEADER:
2829          jj_consume_token(FTL_HEADER);
2830          label_21:
2831          while (true) {
2832            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2833            case ID:
2834              ;
2835              break;
2836            default:
2837              jj_la1[79] = jj_gen;
2838              break label_21;
2839            }
2840            key = jj_consume_token(ID);
2841            jj_consume_token(EQUALS);
2842            exp = Expression();
2843                 String ks = key.image;
2844                 TemplateModel value = null;
2845                 try {
2846                    value = exp.getAsTemplateModel(null);
2847                 } catch (Exception e) {
2848                    {if (true) throw new ParseException("Could not evaluate expression: "
2849                                             + exp.getCanonicalForm() + " "
2850                                             + exp.getStartLocation()
2851                                             + "\nUnderlying cause: " +
2852                                             e.getMessage(), exp);}
2853                 }
2854                 String vs = null;
2855                 if (value instanceof TemplateScalarModel) {
2856                    try {
2857                       vs = ((TemplateScalarModel) exp).getAsString();
2858                    } catch (TemplateModelException tme) {}
2859                 }
2860                 if (template != null) {
2861                     if (ks.equalsIgnoreCase("encoding")) {
2862                         if (vs == null) {
2863                            {if (true) throw new ParseException("expecting encoding string here: "
2864                                                     + exp.getStartLocation(), exp);}
2865                         }
2866                         String encoding = template.getEncoding();
2867                         if (encoding != null && !encoding.equals(vs)) {
2868                             {if (true) throw new Template.WrongEncodingException(vs);}
2869                         }
2870                     }
2871                     else if (ks.equalsIgnoreCase("STRIP_WHITESPACE")) {
2872                         this.stripWhitespace = getBoolean(exp);
2873                     }
2874                     else if (ks.equalsIgnoreCase("STRIP_TEXT")) {
2875                         this.stripText = getBoolean(exp);
2876                     }
2877                     else if (ks.equalsIgnoreCase("STRICT_SYNTAX")) {
2878                         this.token_source.strictEscapeSyntax = getBoolean(exp);
2879                     }
2880                     else if (ks.equalsIgnoreCase("ns_prefixes")) {
2881                         if (!(value instanceof TemplateHashModelEx)) {
2882                             {if (true) throw new ParseException("Expecting a hash of prefixes to namespace URI's here. " + exp.getStartLocation(), exp);}
2883                         }
2884                         TemplateHashModelEx prefixMap = (TemplateHashModelEx) value;
2885                         try {
2886                             TemplateCollectionModel keys = prefixMap.keys();
2887                             for (TemplateModelIterator it = keys.iterator(); it.hasNext();) {
2888                                 String prefix = ((TemplateScalarModel) it.next()).getAsString();
2889                                 TemplateModel valueModel = prefixMap.get(prefix);
2890                                 if (!(valueModel instanceof TemplateScalarModel)) {
2891                                     {if (true) throw new ParseException("Non-string value in prefix to namespace hash. " + exp.getStartLocation(), exp);}
2892                                 }
2893                                 String nsURI = ((TemplateScalarModel) valueModel).getAsString();
2894                                 try {
2895                                     template.addPrefixNSMapping(prefix, nsURI);
2896                                 } catch (IllegalArgumentException iae) {
2897                                     {if (true) throw new ParseException(iae.getMessage() + " " + exp.getStartLocation(), exp);}
2898                                 }
2899                             }
2900                         } catch (TemplateModelException tme) {
2901                         }
2902                     }
2903                     else if (ks.equalsIgnoreCase("attributes")) {
2904                         if (!(value instanceof TemplateHashModelEx)) {
2905                             {if (true) throw new ParseException("Expecting a hash of attribute names to values here. " + exp.getStartLocation(), exp);}
2906                         }
2907                         TemplateHashModelEx attributeMap = (TemplateHashModelEx) value;
2908                         try {
2909                             TemplateCollectionModel keys = attributeMap.keys();
2910                             for (TemplateModelIterator it = keys.iterator(); it.hasNext();) {
2911                                 String attName = ((TemplateScalarModel) it.next()).getAsString();
2912                                 Object attValue = DeepUnwrap.unwrap(attributeMap.get(attName));
2913                                 template.setCustomAttribute(attName, attValue);
2914                             }
2915                         } catch (TemplateModelException tme) {
2916                         }
2917                     }
2918                     else {
2919                         {if (true) throw new ParseException("Unknown FTL header parameter: " + key.image,
2920                                                   key.beginLine, key.beginColumn);}
2921                     }
2922                 }
2923          }
2924          LooseDirectiveEnd();
2925          break;
2926        default:
2927          jj_la1[80] = jj_gen;
2928          jj_consume_token(-1);
2929          throw new ParseException();
2930        }
2931      }
2932    
2933      final public Map ParamList() throws ParseException {
2934       Identifier id;
2935       Expression exp;
2936       Map result = new HashMap();
2937        label_22:
2938        while (true) {
2939          id = Identifier();
2940          jj_consume_token(EQUALS);
2941          exp = Expression();
2942                            result.put(id.toString(), exp);
2943          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2944          case COMMA:
2945            jj_consume_token(COMMA);
2946            break;
2947          default:
2948            jj_la1[81] = jj_gen;
2949            ;
2950          }
2951          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2952          case ID:
2953            ;
2954            break;
2955          default:
2956            jj_la1[82] = jj_gen;
2957            break label_22;
2958          }
2959        }
2960           {if (true) return result;}
2961        throw new Error("Missing return statement in function");
2962      }
2963    
2964    /**
2965     * Root production to be used when parsing
2966     * an entire file.
2967     */
2968      final public TemplateElement Root() throws ParseException {
2969       TemplateElement doc;
2970        if (jj_2_17(2147483647)) {
2971          HeaderElement();
2972        } else {
2973          ;
2974        }
2975        doc = OptionalBlock();
2976        jj_consume_token(0);
2977           doc.setParentRecursively(null);
2978           {if (true) return doc.postParseCleanup(stripWhitespace);}
2979        throw new Error("Missing return statement in function");
2980      }
2981    
2982      final private boolean jj_2_1(int xla) {
2983        jj_la = xla; jj_lastpos = jj_scanpos = token;
2984        try { return !jj_3_1(); }
2985        catch(LookaheadSuccess ls) { return true; }
2986        finally { jj_save(0, xla); }
2987      }
2988    
2989      final private boolean jj_2_2(int xla) {
2990        jj_la = xla; jj_lastpos = jj_scanpos = token;
2991        try { return !jj_3_2(); }
2992        catch(LookaheadSuccess ls) { return true; }
2993        finally { jj_save(1, xla); }
2994      }
2995    
2996      final private boolean jj_2_3(int xla) {
2997        jj_la = xla; jj_lastpos = jj_scanpos = token;
2998        try { return !jj_3_3(); }
2999        catch(LookaheadSuccess ls) { return true; }
3000        finally { jj_save(2, xla); }
3001      }
3002    
3003      final private boolean jj_2_4(int xla) {
3004        jj_la = xla; jj_lastpos = jj_scanpos = token;
3005        try { return !jj_3_4(); }
3006        catch(LookaheadSuccess ls) { return true; }
3007        finally { jj_save(3, xla); }
3008      }
3009    
3010      final private boolean jj_2_5(int xla) {
3011        jj_la = xla; jj_lastpos = jj_scanpos = token;
3012        try { return !jj_3_5(); }
3013        catch(LookaheadSuccess ls) { return true; }
3014        finally { jj_save(4, xla); }
3015      }
3016    
3017      final private boolean jj_2_6(int xla) {
3018        jj_la = xla; jj_lastpos = jj_scanpos = token;
3019        try { return !jj_3_6(); }
3020        catch(LookaheadSuccess ls) { return true; }
3021        finally { jj_save(5, xla); }
3022      }
3023    
3024      final private boolean jj_2_7(int xla) {
3025        jj_la = xla; jj_lastpos = jj_scanpos = token;
3026        try { return !jj_3_7(); }
3027        catch(LookaheadSuccess ls) { return true; }
3028        finally { jj_save(6, xla); }
3029      }
3030    
3031      final private boolean jj_2_8(int xla) {
3032        jj_la = xla; jj_lastpos = jj_scanpos = token;
3033        try { return !jj_3_8(); }
3034        catch(LookaheadSuccess ls) { return true; }
3035        finally { jj_save(7, xla); }
3036      }
3037    
3038      final private boolean jj_2_9(int xla) {
3039        jj_la = xla; jj_lastpos = jj_scanpos = token;
3040        try { return !jj_3_9(); }
3041        catch(LookaheadSuccess ls) { return true; }
3042        finally { jj_save(8, xla); }
3043      }
3044    
3045      final private boolean jj_2_10(int xla) {
3046        jj_la = xla; jj_lastpos = jj_scanpos = token;
3047        try { return !jj_3_10(); }
3048        catch(LookaheadSuccess ls) { return true; }
3049        finally { jj_save(9, xla); }
3050      }
3051    
3052      final private boolean jj_2_11(int xla) {
3053        jj_la = xla; jj_lastpos = jj_scanpos = token;
3054        try { return !jj_3_11(); }
3055        catch(LookaheadSuccess ls) { return true; }
3056        finally { jj_save(10, xla); }
3057      }
3058    
3059      final private boolean jj_2_12(int xla) {
3060        jj_la = xla; jj_lastpos = jj_scanpos = token;
3061        try { return !jj_3_12(); }
3062        catch(LookaheadSuccess ls) { return true; }
3063        finally { jj_save(11, xla); }
3064      }
3065    
3066      final private boolean jj_2_13(int xla) {
3067        jj_la = xla; jj_lastpos = jj_scanpos = token;
3068        try { return !jj_3_13(); }
3069        catch(LookaheadSuccess ls) { return true; }
3070        finally { jj_save(12, xla); }
3071      }
3072    
3073      final private boolean jj_2_14(int xla) {
3074        jj_la = xla; jj_lastpos = jj_scanpos = token;
3075        try { return !jj_3_14(); }
3076        catch(LookaheadSuccess ls) { return true; }
3077        finally { jj_save(13, xla); }
3078      }
3079    
3080      final private boolean jj_2_15(int xla) {
3081        jj_la = xla; jj_lastpos = jj_scanpos = token;
3082        try { return !jj_3_15(); }
3083        catch(LookaheadSuccess ls) { return true; }
3084        finally { jj_save(14, xla); }
3085      }
3086    
3087      final private boolean jj_2_16(int xla) {
3088        jj_la = xla; jj_lastpos = jj_scanpos = token;
3089        try { return !jj_3_16(); }
3090        catch(LookaheadSuccess ls) { return true; }
3091        finally { jj_save(15, xla); }
3092      }
3093    
3094      final private boolean jj_2_17(int xla) {
3095        jj_la = xla; jj_lastpos = jj_scanpos = token;
3096        try { return !jj_3_17(); }
3097        catch(LookaheadSuccess ls) { return true; }
3098        finally { jj_save(16, xla); }
3099      }
3100    
3101      final private boolean jj_3R_171() {
3102        if (jj_scan_token(OPEN_PAREN)) return true;
3103        if (jj_3R_160()) return true;
3104        if (jj_scan_token(CLOSE_PAREN)) return true;
3105        return false;
3106      }
3107    
3108      final private boolean jj_3R_36() {
3109        Token xsp;
3110        xsp = jj_scanpos;
3111        if (jj_scan_token(93)) {
3112        jj_scanpos = xsp;
3113        if (jj_scan_token(91)) {
3114        jj_scanpos = xsp;
3115        if (jj_scan_token(92)) return true;
3116        }
3117        }
3118        if (jj_3R_35()) return true;
3119        return false;
3120      }
3121    
3122      final private boolean jj_3R_132() {
3123        if (jj_scan_token(RECURSE)) return true;
3124        return false;
3125      }
3126    
3127      final private boolean jj_3R_32() {
3128        if (jj_3R_35()) return true;
3129        Token xsp;
3130        xsp = jj_scanpos;
3131        if (jj_3R_36()) jj_scanpos = xsp;
3132        return false;
3133      }
3134    
3135      final private boolean jj_3R_110() {
3136        Token xsp;
3137        xsp = jj_scanpos;
3138        if (jj_scan_token(56)) {
3139        jj_scanpos = xsp;
3140        if (jj_3R_132()) return true;
3141        }
3142        return false;
3143      }
3144    
3145      final private boolean jj_3R_108() {
3146        if (jj_scan_token(NOESCAPE)) return true;
3147        return false;
3148      }
3149    
3150      final private boolean jj_3R_170() {
3151        if (jj_scan_token(OPEN_BRACKET)) return true;
3152        if (jj_3R_23()) return true;
3153        if (jj_scan_token(CLOSE_BRACKET)) return true;
3154        return false;
3155      }
3156    
3157      final private boolean jj_3R_122() {
3158        if (jj_scan_token(FUNCTION)) return true;
3159        return false;
3160      }
3161    
3162      final private boolean jj_3_3() {
3163        Token xsp;
3164        xsp = jj_scanpos;
3165        if (jj_scan_token(100)) {
3166        jj_scanpos = xsp;
3167        if (jj_scan_token(103)) {
3168        jj_scanpos = xsp;
3169        if (jj_scan_token(104)) return true;
3170        }
3171        }
3172        return false;
3173      }
3174    
3175      final private boolean jj_3R_118() {
3176        if (jj_scan_token(PERCENT)) return true;
3177        return false;
3178      }
3179    
3180      final private boolean jj_3R_92() {
3181        Token xsp;
3182        xsp = jj_scanpos;
3183        if (jj_scan_token(20)) {
3184        jj_scanpos = xsp;
3185        if (jj_3R_122()) return true;
3186        }
3187        return false;
3188      }
3189    
3190      final private boolean jj_3R_117() {
3191        if (jj_scan_token(DIVIDE)) return true;
3192        return false;
3193      }
3194    
3195      final private boolean jj_3R_109() {
3196        if (jj_scan_token(VISIT)) return true;
3197        return false;
3198      }
3199    
3200      final private boolean jj_3R_116() {
3201        if (jj_scan_token(TIMES)) return true;
3202        return false;
3203      }
3204    
3205      final private boolean jj_3R_82() {
3206        Token xsp;
3207        xsp = jj_scanpos;
3208        if (jj_3R_116()) {
3209        jj_scanpos = xsp;
3210        if (jj_3R_117()) {
3211        jj_scanpos = xsp;
3212        if (jj_3R_118()) return true;
3213        }
3214        }
3215        if (jj_3R_81()) return true;
3216        return false;
3217      }
3218    
3219      final private boolean jj_3R_107() {
3220        if (jj_scan_token(ESCAPE)) return true;
3221        return false;
3222      }
3223    
3224      final private boolean jj_3R_50() {
3225        if (jj_3R_81()) return true;
3226        Token xsp;
3227        while (true) {
3228          xsp = jj_scanpos;
3229          if (jj_3R_82()) { jj_scanpos = xsp; break; }
3230        }
3231        return false;
3232      }
3233    
3234      final private boolean jj_3R_88() {
3235        if (jj_scan_token(FOREACH)) return true;
3236        return false;
3237      }
3238    
3239      final private boolean jj_3R_176() {
3240        Token xsp;
3241        xsp = jj_scanpos;
3242        if (jj_scan_token(94)) {
3243        jj_scanpos = xsp;
3244        if (jj_scan_token(95)) {
3245        jj_scanpos = xsp;
3246        if (jj_scan_token(96)) {
3247        jj_scanpos = xsp;
3248        if (jj_scan_token(97)) {
3249        jj_scanpos = xsp;
3250        if (jj_scan_token(83)) {
3251        jj_scanpos = xsp;
3252        if (jj_scan_token(84)) {
3253        jj_scanpos = xsp;
3254        if (jj_scan_token(117)) {
3255        jj_scanpos = xsp;
3256        if (jj_scan_token(118)) {
3257        jj_scanpos = xsp;
3258        if (jj_scan_token(119)) return true;
3259        }
3260        }
3261        }
3262        }
3263        }
3264        }
3265        }
3266        }
3267        return false;
3268      }
3269    
3270      final private boolean jj_3R_27() {
3271        if (jj_scan_token(DEFAUL)) return true;
3272        return false;
3273      }
3274    
3275      final private boolean jj_3R_26() {
3276        if (jj_scan_token(CASE)) return true;
3277        if (jj_3R_23()) return true;
3278        return false;
3279      }
3280    
3281      final private boolean jj_3R_91() {
3282        if (jj_scan_token(IMPORT)) return true;
3283        return false;
3284      }
3285    
3286      final private boolean jj_3R_169() {
3287        if (jj_scan_token(DOT)) return true;
3288        Token xsp;
3289        xsp = jj_scanpos;
3290        if (jj_scan_token(120)) {
3291        jj_scanpos = xsp;
3292        if (jj_scan_token(100)) {
3293        jj_scanpos = xsp;
3294        if (jj_scan_token(101)) {
3295        jj_scanpos = xsp;
3296        if (jj_3R_176()) return true;
3297        }
3298        }
3299        }
3300        return false;
3301      }
3302    
3303      final private boolean jj_3R_24() {
3304        Token xsp;
3305        xsp = jj_scanpos;
3306        if (jj_scan_token(68)) jj_scanpos = xsp;
3307        xsp = jj_scanpos;
3308        if (jj_3R_26()) {
3309        jj_scanpos = xsp;
3310        if (jj_3R_27()) return true;
3311        }
3312        if (jj_3R_28()) return true;
3313        return false;
3314      }
3315    
3316      final private boolean jj_3_2() {
3317        Token xsp;
3318        xsp = jj_scanpos;
3319        if (jj_scan_token(98)) {
3320        jj_scanpos = xsp;
3321        if (jj_scan_token(99)) return true;
3322        }
3323        return false;
3324      }
3325    
3326      final private boolean jj_3R_84() {
3327        if (jj_scan_token(MINUS)) return true;
3328        return false;
3329      }
3330    
3331      final private boolean jj_3R_83() {
3332        if (jj_scan_token(PLUS)) return true;
3333        return false;
3334      }
3335    
3336      final private boolean jj_3R_87() {
3337        if (jj_scan_token(LIST)) return true;
3338        return false;
3339      }
3340    
3341      final private boolean jj_3R_51() {
3342        Token xsp;
3343        xsp = jj_scanpos;
3344        if (jj_3R_83()) {
3345        jj_scanpos = xsp;
3346        if (jj_3R_84()) return true;
3347        }
3348        if (jj_3R_50()) return true;
3349        return false;
3350      }
3351    
3352      final private boolean jj_3R_44() {
3353        if (jj_3R_50()) return true;
3354        Token xsp;
3355        while (true) {
3356          xsp = jj_scanpos;
3357          if (jj_3R_51()) { jj_scanpos = xsp; break; }
3358        }
3359        return false;
3360      }
3361    
3362      final private boolean jj_3R_172() {
3363        if (jj_scan_token(BUILT_IN)) return true;
3364        if (jj_scan_token(ID)) return true;
3365        return false;
3366      }
3367    
3368      final private boolean jj_3_15() {
3369        if (jj_3R_24()) return true;
3370        return false;
3371      }
3372    
3373      final private boolean jj_3R_90() {
3374        if (jj_scan_token(_INCLUDE)) return true;
3375        return false;
3376      }
3377    
3378      final private boolean jj_3R_136() {
3379        if (jj_scan_token(MINUS)) return true;
3380        return false;
3381      }
3382    
3383      final private boolean jj_3R_99() {
3384        if (jj_scan_token(SWITCH)) return true;
3385        return false;
3386      }
3387    
3388      final private boolean jj_3R_174() {
3389        if (jj_scan_token(EXISTS)) return true;
3390        return false;
3391      }
3392    
3393      final private boolean jj_3R_133() {
3394        Token xsp;
3395        xsp = jj_scanpos;
3396        if (jj_scan_token(98)) {
3397        jj_scanpos = xsp;
3398        if (jj_3R_136()) return true;
3399        }
3400        if (jj_3R_135()) return true;
3401        return false;
3402      }
3403    
3404      final private boolean jj_3_10() {
3405        if (jj_3R_23()) return true;
3406        return false;
3407      }
3408    
3409      final private boolean jj_3R_112() {
3410        if (jj_scan_token(ATTEMPT)) return true;
3411        return false;
3412      }
3413    
3414      final private boolean jj_3R_178() {
3415        if (jj_3R_23()) return true;
3416        return false;
3417      }
3418    
3419      final private boolean jj_3R_137() {
3420        if (jj_scan_token(EXCLAM)) return true;
3421        return false;
3422      }
3423    
3424      final private boolean jj_3R_177() {
3425        if (jj_scan_token(EXCLAM)) return true;
3426        Token xsp;
3427        xsp = jj_scanpos;
3428        if (jj_3R_178()) jj_scanpos = xsp;
3429        return false;
3430      }
3431    
3432      final private boolean jj_3R_134() {
3433        Token xsp;
3434        if (jj_3R_137()) return true;
3435        while (true) {
3436          xsp = jj_scanpos;
3437          if (jj_3R_137()) { jj_scanpos = xsp; break; }
3438        }
3439        if (jj_3R_135()) return true;
3440        return false;
3441      }
3442    
3443      final private boolean jj_3R_173() {
3444        Token xsp;
3445        xsp = jj_scanpos;
3446        if (jj_scan_token(128)) {
3447        jj_scanpos = xsp;
3448        if (jj_3R_177()) return true;
3449        }
3450        return false;
3451      }
3452    
3453      final private boolean jj_3R_98() {
3454        if (jj_scan_token(TRANSFORM)) return true;
3455        return false;
3456      }
3457    
3458      final private boolean jj_3R_31() {
3459        if (jj_3R_34()) return true;
3460        return false;
3461      }
3462    
3463      final private boolean jj_3_11() {
3464        Token xsp;
3465        xsp = jj_scanpos;
3466        if (jj_scan_token(108)) jj_scanpos = xsp;
3467        xsp = jj_scanpos;
3468        if (jj_scan_token(120)) {
3469        jj_scanpos = xsp;
3470        if (jj_scan_token(81)) return true;
3471        }
3472        if (jj_scan_token(EQUALS)) return true;
3473        return false;
3474      }
3475    
3476      final private boolean jj_3R_28() {
3477        Token xsp;
3478        xsp = jj_scanpos;
3479        if (jj_3R_31()) jj_scanpos = xsp;
3480        return false;
3481      }
3482    
3483      final private boolean jj_3R_166() {
3484        if (jj_3R_174()) return true;
3485        return false;
3486      }
3487    
3488      final private boolean jj_3R_165() {
3489        if (jj_3R_173()) return true;
3490        return false;
3491      }
3492    
3493      final private boolean jj_3R_164() {
3494        if (jj_3R_172()) return true;
3495        return false;
3496      }
3497    
3498      final private boolean jj_3R_163() {
3499        if (jj_3R_171()) return true;
3500        return false;
3501      }
3502    
3503      final private boolean jj_3R_162() {
3504        if (jj_3R_170()) return true;
3505        return false;
3506      }
3507    
3508      final private boolean jj_3R_161() {
3509        if (jj_3R_169()) return true;
3510        return false;
3511      }
3512    
3513      final private boolean jj_3R_97() {
3514        if (jj_scan_token(NOPARSE)) return true;
3515        return false;
3516      }
3517    
3518      final private boolean jj_3R_155() {
3519        Token xsp;
3520        xsp = jj_scanpos;
3521        if (jj_3R_161()) {
3522        jj_scanpos = xsp;
3523        if (jj_3R_162()) {
3524        jj_scanpos = xsp;
3525        if (jj_3R_163()) {
3526        jj_scanpos = xsp;
3527        if (jj_3R_164()) {
3528        jj_scanpos = xsp;
3529        if (jj_3R_165()) {
3530        jj_scanpos = xsp;
3531        if (jj_3R_166()) return true;
3532        }
3533        }
3534        }
3535        }
3536        }
3537        return false;
3538      }
3539    
3540      final private boolean jj_3R_86() {
3541        if (jj_scan_token(IF)) return true;
3542        return false;
3543      }
3544    
3545      final private boolean jj_3R_115() {
3546        if (jj_3R_135()) return true;
3547        return false;
3548      }
3549    
3550      final private boolean jj_3R_114() {
3551        if (jj_3R_134()) return true;
3552        return false;
3553      }
3554    
3555      final private boolean jj_3R_113() {
3556        if (jj_3R_133()) return true;
3557        return false;
3558      }
3559    
3560      final private boolean jj_3R_81() {
3561        Token xsp;
3562        xsp = jj_scanpos;
3563        if (jj_3R_113()) {
3564        jj_scanpos = xsp;
3565        if (jj_3R_114()) {
3566        jj_scanpos = xsp;
3567        if (jj_3R_115()) return true;
3568        }
3569        }
3570        return false;
3571      }
3572    
3573      final private boolean jj_3R_96() {
3574        Token xsp;
3575        xsp = jj_scanpos;
3576        if (jj_scan_token(28)) {
3577        jj_scanpos = xsp;
3578        if (jj_scan_token(29)) return true;
3579        }
3580        return false;
3581      }
3582    
3583      final private boolean jj_3R_121() {
3584        if (jj_scan_token(LOCALASSIGN)) return true;
3585        return false;
3586      }
3587    
3588      final private boolean jj_3R_120() {
3589        if (jj_scan_token(GLOBALASSIGN)) return true;
3590        return false;
3591      }
3592    
3593      final private boolean jj_3R_119() {
3594        if (jj_scan_token(ASSIGN)) return true;
3595        return false;
3596      }
3597    
3598      final private boolean jj_3R_154() {
3599        if (jj_scan_token(DOT)) return true;
3600        if (jj_scan_token(ID)) return true;
3601        return false;
3602      }
3603    
3604      final private boolean jj_3R_89() {
3605        Token xsp;
3606        xsp = jj_scanpos;
3607        if (jj_3R_119()) {
3608        jj_scanpos = xsp;
3609        if (jj_3R_120()) {
3610        jj_scanpos = xsp;
3611        if (jj_3R_121()) return true;
3612        }
3613        }
3614        return false;
3615      }
3616    
3617      final private boolean jj_3R_175() {
3618        Token xsp;
3619        xsp = jj_scanpos;
3620        if (jj_scan_token(108)) jj_scanpos = xsp;
3621        if (jj_3R_23()) return true;
3622        return false;
3623      }
3624    
3625      final private boolean jj_3R_168() {
3626        if (jj_3R_23()) return true;
3627        Token xsp;
3628        while (true) {
3629          xsp = jj_scanpos;
3630          if (jj_3R_175()) { jj_scanpos = xsp; break; }
3631        }
3632        return false;
3633      }
3634    
3635      final private boolean jj_3R_153() {
3636        if (jj_scan_token(OPEN_PAREN)) return true;
3637        if (jj_3R_23()) return true;
3638        if (jj_scan_token(CLOSE_PAREN)) return true;
3639        return false;
3640      }
3641    
3642      final private boolean jj_3R_160() {
3643        Token xsp;
3644        xsp = jj_scanpos;
3645        if (jj_3R_168()) jj_scanpos = xsp;
3646        return false;
3647      }
3648    
3649      final private boolean jj_3R_43() {
3650        if (jj_3R_49()) return true;
3651        return false;
3652      }
3653    
3654      final private boolean jj_3R_42() {
3655        if (jj_3R_48()) return true;
3656        return false;
3657      }
3658    
3659      final private boolean jj_3_1() {
3660        Token xsp;
3661        xsp = jj_scanpos;
3662        if (jj_scan_token(87)) {
3663        jj_scanpos = xsp;
3664        if (jj_scan_token(111)) {
3665        jj_scanpos = xsp;
3666        if (jj_scan_token(113)) {
3667        jj_scanpos = xsp;
3668        if (jj_scan_token(89)) {
3669        jj_scanpos = xsp;
3670        if (jj_scan_token(107)) {
3671        jj_scanpos = xsp;
3672        if (jj_scan_token(128)) {
3673        jj_scanpos = xsp;
3674        if (jj_scan_token(90)) return true;
3675        }
3676        }
3677        }
3678        }
3679        }
3680        }
3681        return false;
3682      }
3683    
3684      final private boolean jj_3R_41() {
3685        if (jj_3R_47()) return true;
3686        return false;
3687      }
3688    
3689      final private boolean jj_3R_40() {
3690        if (jj_3R_46()) return true;
3691        return false;
3692      }
3693    
3694      final private boolean jj_3R_129() {
3695        if (jj_scan_token(NOTRIM)) return true;
3696        return false;
3697      }
3698    
3699      final private boolean jj_3R_128() {
3700        if (jj_scan_token(RTRIM)) return true;
3701        return false;
3702      }
3703    
3704      final private boolean jj_3R_37() {
3705        Token xsp;
3706        xsp = jj_scanpos;
3707        if (jj_3R_40()) {
3708        jj_scanpos = xsp;
3709        if (jj_3R_41()) {
3710        jj_scanpos = xsp;
3711        if (jj_3R_42()) {
3712        jj_scanpos = xsp;
3713        if (jj_3R_43()) return true;
3714        }
3715        }
3716        }
3717        return false;
3718      }
3719    
3720      final private boolean jj_3R_127() {
3721        if (jj_scan_token(LTRIM)) return true;
3722        return false;
3723      }
3724    
3725      final private boolean jj_3R_146() {
3726        if (jj_3R_155()) return true;
3727        return false;
3728      }
3729    
3730      final private boolean jj_3R_34() {
3731        Token xsp;
3732        if (jj_3R_37()) return true;
3733        while (true) {
3734          xsp = jj_scanpos;
3735          if (jj_3R_37()) { jj_scanpos = xsp; break; }
3736        }
3737        return false;
3738      }
3739    
3740      final private boolean jj_3R_126() {
3741        if (jj_scan_token(TRIM)) return true;
3742        return false;
3743      }
3744    
3745      final private boolean jj_3R_152() {
3746        if (jj_scan_token(ID)) return true;
3747        return false;
3748      }
3749    
3750      final private boolean jj_3R_145() {
3751        if (jj_3R_154()) return true;
3752        return false;
3753      }
3754    
3755      final private boolean jj_3R_105() {
3756        Token xsp;
3757        xsp = jj_scanpos;
3758        if (jj_3R_126()) {
3759        jj_scanpos = xsp;
3760        if (jj_3R_127()) {
3761        jj_scanpos = xsp;
3762        if (jj_3R_128()) {
3763        jj_scanpos = xsp;
3764        if (jj_3R_129()) return true;
3765        }
3766        }
3767        }
3768        return false;
3769      }
3770    
3771      final private boolean jj_3R_144() {
3772        if (jj_3R_153()) return true;
3773        return false;
3774      }
3775    
3776      final private boolean jj_3R_143() {
3777        if (jj_3R_152()) return true;
3778        return false;
3779      }
3780    
3781      final private boolean jj_3R_142() {
3782        if (jj_3R_151()) return true;
3783        return false;
3784      }
3785    
3786      final private boolean jj_3R_141() {
3787        if (jj_3R_150()) return true;
3788        return false;
3789      }
3790    
3791      final private boolean jj_3R_140() {
3792        if (jj_3R_149()) return true;
3793        return false;
3794      }
3795    
3796      final private boolean jj_3R_139() {
3797        if (jj_3R_148()) return true;
3798        return false;
3799      }
3800    
3801      final private boolean jj_3R_138() {
3802        if (jj_3R_147()) return true;
3803        return false;
3804      }
3805    
3806      final private boolean jj_3R_104() {
3807        if (jj_scan_token(FLUSH)) return true;
3808        return false;
3809      }
3810    
3811      final private boolean jj_3_13() {
3812        if (jj_scan_token(OPEN_PAREN)) return true;
3813        return false;
3814      }
3815    
3816      final private boolean jj_3R_135() {
3817        Token xsp;
3818        xsp = jj_scanpos;
3819        if (jj_3R_138()) {
3820        jj_scanpos = xsp;
3821        if (jj_3R_139()) {
3822        jj_scanpos = xsp;
3823        if (jj_3R_140()) {
3824        jj_scanpos = xsp;
3825        if (jj_3R_141()) {
3826        jj_scanpos = xsp;
3827        if (jj_3R_142()) {
3828        jj_scanpos = xsp;
3829        if (jj_3R_143()) {
3830        jj_scanpos = xsp;
3831        if (jj_3R_144()) {
3832        jj_scanpos = xsp;
3833        if (jj_3R_145()) return true;
3834        }
3835        }
3836        }
3837        }
3838        }
3839        }
3840        }
3841        while (true) {
3842          xsp = jj_scanpos;
3843          if (jj_3R_146()) { jj_scanpos = xsp; break; }
3844        }
3845        return false;
3846      }
3847    
3848      final private boolean jj_3R_147() {
3849        Token xsp;
3850        xsp = jj_scanpos;
3851        if (jj_scan_token(85)) {
3852        jj_scanpos = xsp;
3853        if (jj_scan_token(86)) return true;
3854        }
3855        return false;
3856      }
3857    
3858      final private boolean jj_3_14() {
3859        if (jj_scan_token(ID)) return true;
3860        if (jj_scan_token(EQUALS)) return true;
3861        return false;
3862      }
3863    
3864      final private boolean jj_3R_151() {
3865        if (jj_scan_token(OPEN_BRACKET)) return true;
3866        if (jj_3R_160()) return true;
3867        if (jj_scan_token(CLOSE_BRACKET)) return true;
3868        return false;
3869      }
3870    
3871      final private boolean jj_3R_23() {
3872        if (jj_3R_25()) return true;
3873        return false;
3874      }
3875    
3876      final private boolean jj_3R_131() {
3877        if (jj_scan_token(NESTED)) return true;
3878        return false;
3879      }
3880    
3881      final private boolean jj_3_16() {
3882        Token xsp;
3883        xsp = jj_scanpos;
3884        if (jj_scan_token(68)) {
3885        jj_scanpos = xsp;
3886        if (jj_scan_token(69)) {
3887        jj_scanpos = xsp;
3888        if (jj_scan_token(70)) return true;
3889        }
3890        }
3891        return false;
3892      }
3893    
3894      final private boolean jj_3R_48() {
3895        if (jj_scan_token(NUMERICAL_ESCAPE)) return true;
3896        return false;
3897      }
3898    
3899      final private boolean jj_3R_95() {
3900        if (jj_scan_token(CALL)) return true;
3901        return false;
3902      }
3903    
3904      final private boolean jj_3_9() {
3905        if (jj_scan_token(OR)) return true;
3906        return false;
3907      }
3908    
3909      final private boolean jj_3R_85() {
3910        if (jj_scan_token(WHITESPACE)) return true;
3911        return false;
3912      }
3913    
3914      final private boolean jj_3R_130() {
3915        if (jj_scan_token(SIMPLE_NESTED)) return true;
3916        return false;
3917      }
3918    
3919      final private boolean jj_3R_53() {
3920        Token xsp;
3921        xsp = jj_scanpos;
3922        if (jj_3R_85()) {
3923        jj_scanpos = xsp;
3924        if (jj_scan_token(69)) {
3925        jj_scanpos = xsp;
3926        if (jj_scan_token(70)) return true;
3927        }
3928        }
3929        return false;
3930      }
3931    
3932      final private boolean jj_3R_106() {
3933        Token xsp;
3934        xsp = jj_scanpos;
3935        if (jj_3R_130()) {
3936        jj_scanpos = xsp;
3937        if (jj_3R_131()) return true;
3938        }
3939        return false;
3940      }
3941    
3942      final private boolean jj_3R_46() {
3943        Token xsp;
3944        if (jj_3R_53()) return true;
3945        while (true) {
3946          xsp = jj_scanpos;
3947          if (jj_3R_53()) { jj_scanpos = xsp; break; }
3948        }
3949        return false;
3950      }
3951    
3952      final private boolean jj_3R_30() {
3953        if (jj_scan_token(OR)) return true;
3954        if (jj_3R_29()) return true;
3955        return false;
3956      }
3957    
3958      final private boolean jj_3R_25() {
3959        if (jj_3R_29()) return true;
3960        Token xsp;
3961        while (true) {
3962          xsp = jj_scanpos;
3963          if (jj_3R_30()) { jj_scanpos = xsp; break; }
3964        }
3965        return false;
3966      }
3967    
3968      final private boolean jj_3R_47() {
3969        if (jj_scan_token(OUTPUT_ESCAPE)) return true;
3970        return false;
3971      }
3972    
3973      final private boolean jj_3R_125() {
3974        if (jj_scan_token(STOP)) return true;
3975        return false;
3976      }
3977    
3978      final private boolean jj_3_8() {
3979        if (jj_scan_token(AND)) return true;
3980        return false;
3981      }
3982    
3983      final private boolean jj_3R_103() {
3984        Token xsp;
3985        xsp = jj_scanpos;
3986        if (jj_scan_token(47)) {
3987        jj_scanpos = xsp;
3988        if (jj_3R_125()) return true;
3989        }
3990        return false;
3991      }
3992    
3993      final private boolean jj_3R_80() {
3994        if (jj_3R_112()) return true;
3995        return false;
3996      }
3997    
3998      final private boolean jj_3R_79() {
3999        if (jj_3R_111()) return true;
4000        return false;
4001      }
4002    
4003      final private boolean jj_3R_78() {
4004        if (jj_3R_110()) return true;
4005        return false;
4006      }
4007    
4008      final private boolean jj_3R_33() {
4009        if (jj_scan_token(AND)) return true;
4010        if (jj_3R_32()) return true;
4011        return false;
4012      }
4013    
4014      final private boolean jj_3R_77() {
4015        if (jj_3R_109()) return true;
4016        return false;
4017      }
4018    
4019      final private boolean jj_3R_76() {
4020        if (jj_3R_108()) return true;
4021        return false;
4022      }
4023    
4024      final private boolean jj_3R_75() {
4025        if (jj_3R_107()) return true;
4026        return false;
4027      }
4028    
4029      final private boolean jj_3R_29() {
4030        if (jj_3R_32()) return true;
4031        Token xsp;
4032        while (true) {
4033          xsp = jj_scanpos;
4034          if (jj_3R_33()) { jj_scanpos = xsp; break; }
4035        }
4036        return false;
4037      }
4038    
4039      final private boolean jj_3_12() {
4040        if (jj_scan_token(ID)) return true;
4041        if (jj_scan_token(EQUALS)) return true;
4042        return false;
4043      }
4044    
4045      final private boolean jj_3R_74() {
4046        if (jj_3R_106()) return true;
4047        return false;
4048      }
4049    
4050      final private boolean jj_3R_73() {
4051        if (jj_3R_105()) return true;
4052        return false;
4053      }
4054    
4055      final private boolean jj_3R_167() {
4056        if (jj_scan_token(COMMA)) return true;
4057        if (jj_3R_23()) return true;
4058        Token xsp;
4059        xsp = jj_scanpos;
4060        if (jj_scan_token(108)) {
4061        jj_scanpos = xsp;
4062        if (jj_scan_token(110)) return true;
4063        }
4064        if (jj_3R_23()) return true;
4065        return false;
4066      }
4067    
4068      final private boolean jj_3R_72() {
4069        if (jj_3R_104()) return true;
4070        return false;
4071      }
4072    
4073      final private boolean jj_3R_71() {
4074        if (jj_3R_103()) return true;
4075        return false;
4076      }
4077    
4078      final private boolean jj_3R_70() {
4079        if (jj_3R_102()) return true;
4080        return false;
4081      }
4082    
4083      final private boolean jj_3R_69() {
4084        if (jj_3R_101()) return true;
4085        return false;
4086      }
4087    
4088      final private boolean jj_3R_68() {
4089        if (jj_3R_100()) return true;
4090        return false;
4091      }
4092    
4093      final private boolean jj_3_6() {
4094        if (jj_3R_23()) return true;
4095        return false;
4096      }
4097    
4098      final private boolean jj_3R_67() {
4099        if (jj_3R_99()) return true;
4100        return false;
4101      }
4102    
4103      final private boolean jj_3R_156() {
4104        if (jj_3R_23()) return true;
4105        Token xsp;
4106        xsp = jj_scanpos;
4107        if (jj_scan_token(108)) {
4108        jj_scanpos = xsp;
4109        if (jj_scan_token(110)) return true;
4110        }
4111        if (jj_3R_23()) return true;
4112        while (true) {
4113          xsp = jj_scanpos;
4114          if (jj_3R_167()) { jj_scanpos = xsp; break; }
4115        }
4116        return false;
4117      }
4118    
4119      final private boolean jj_3R_66() {
4120        if (jj_3R_98()) return true;
4121        return false;
4122      }
4123    
4124      final private boolean jj_3R_65() {
4125        if (jj_3R_97()) return true;
4126        return false;
4127      }
4128    
4129      final private boolean jj_3_7() {
4130        if (jj_scan_token(DOT_DOT)) return true;
4131        return false;
4132      }
4133    
4134      final private boolean jj_3R_64() {
4135        if (jj_3R_96()) return true;
4136        return false;
4137      }
4138    
4139      final private boolean jj_3R_148() {
4140        if (jj_scan_token(OPEN_BRACE)) return true;
4141        Token xsp;
4142        xsp = jj_scanpos;
4143        if (jj_3R_156()) jj_scanpos = xsp;
4144        if (jj_scan_token(CLOSE_BRACE)) return true;
4145        return false;
4146      }
4147    
4148      final private boolean jj_3R_124() {
4149        if (jj_scan_token(RETURN)) return true;
4150        return false;
4151      }
4152    
4153      final private boolean jj_3R_94() {
4154        if (jj_scan_token(UNIFIED_CALL)) return true;
4155        return false;
4156      }
4157    
4158      final private boolean jj_3R_63() {
4159        if (jj_3R_95()) return true;
4160        return false;
4161      }
4162    
4163      final private boolean jj_3R_123() {
4164        if (jj_scan_token(SIMPLE_RETURN)) return true;
4165        return false;
4166      }
4167    
4168      final private boolean jj_3R_52() {
4169        if (jj_3R_44()) return true;
4170        return false;
4171      }
4172    
4173      final private boolean jj_3R_62() {
4174        if (jj_3R_94()) return true;
4175        return false;
4176      }
4177    
4178      final private boolean jj_3R_61() {
4179        if (jj_3R_93()) return true;
4180        return false;
4181      }
4182    
4183      final private boolean jj_3R_102() {
4184        Token xsp;
4185        xsp = jj_scanpos;
4186        if (jj_3R_123()) {
4187        jj_scanpos = xsp;
4188        if (jj_3R_124()) return true;
4189        }
4190        return false;
4191      }
4192    
4193      final private boolean jj_3R_60() {
4194        if (jj_3R_92()) return true;
4195        return false;
4196      }
4197    
4198      final private boolean jj_3R_45() {
4199        if (jj_scan_token(DOT_DOT)) return true;
4200        Token xsp;
4201        xsp = jj_scanpos;
4202        if (jj_3R_52()) jj_scanpos = xsp;
4203        return false;
4204      }
4205    
4206      final private boolean jj_3R_59() {
4207        if (jj_3R_91()) return true;
4208        return false;
4209      }
4210    
4211      final private boolean jj_3R_58() {
4212        if (jj_3R_90()) return true;
4213        return false;
4214      }
4215    
4216      final private boolean jj_3R_38() {
4217        if (jj_3R_44()) return true;
4218        Token xsp;
4219        xsp = jj_scanpos;
4220        if (jj_3R_45()) jj_scanpos = xsp;
4221        return false;
4222      }
4223    
4224      final private boolean jj_3R_159() {
4225        if (jj_scan_token(TRUE)) return true;
4226        return false;
4227      }
4228    
4229      final private boolean jj_3R_57() {
4230        if (jj_3R_89()) return true;
4231        return false;
4232      }
4233    
4234      final private boolean jj_3R_158() {
4235        if (jj_scan_token(FALSE)) return true;
4236        return false;
4237      }
4238    
4239      final private boolean jj_3R_56() {
4240        if (jj_3R_88()) return true;
4241        return false;
4242      }
4243    
4244      final private boolean jj_3R_55() {
4245        if (jj_3R_87()) return true;
4246        return false;
4247      }
4248    
4249      final private boolean jj_3R_54() {
4250        if (jj_3R_86()) return true;
4251        return false;
4252      }
4253    
4254      final private boolean jj_3R_150() {
4255        Token xsp;
4256        xsp = jj_scanpos;
4257        if (jj_3R_158()) {
4258        jj_scanpos = xsp;
4259        if (jj_3R_159()) return true;
4260        }
4261        return false;
4262      }
4263    
4264      final private boolean jj_3R_93() {
4265        if (jj_scan_token(COMPRESS)) return true;
4266        return false;
4267      }
4268    
4269      final private boolean jj_3R_49() {
4270        Token xsp;
4271        xsp = jj_scanpos;
4272        if (jj_3R_54()) {
4273        jj_scanpos = xsp;
4274        if (jj_3R_55()) {
4275        jj_scanpos = xsp;
4276        if (jj_3R_56()) {
4277        jj_scanpos = xsp;
4278        if (jj_3R_57()) {
4279        jj_scanpos = xsp;
4280        if (jj_3R_58()) {
4281        jj_scanpos = xsp;
4282        if (jj_3R_59()) {
4283        jj_scanpos = xsp;
4284        if (jj_3R_60()) {
4285        jj_scanpos = xsp;
4286        if (jj_3R_61()) {
4287        jj_scanpos = xsp;
4288        if (jj_3R_62()) {
4289        jj_scanpos = xsp;
4290        if (jj_3R_63()) {
4291        jj_scanpos = xsp;
4292        if (jj_3R_64()) {
4293        jj_scanpos = xsp;
4294        if (jj_3R_65()) {
4295        jj_scanpos = xsp;
4296        if (jj_3R_66()) {
4297        jj_scanpos = xsp;
4298        if (jj_3R_67()) {
4299        jj_scanpos = xsp;
4300        if (jj_3R_68()) {
4301        jj_scanpos = xsp;
4302        if (jj_3R_69()) {
4303        jj_scanpos = xsp;
4304        if (jj_3R_70()) {
4305        jj_scanpos = xsp;
4306        if (jj_3R_71()) {
4307        jj_scanpos = xsp;
4308        if (jj_3R_72()) {
4309        jj_scanpos = xsp;
4310        if (jj_3R_73()) {
4311        jj_scanpos = xsp;
4312        if (jj_3R_74()) {
4313        jj_scanpos = xsp;
4314        if (jj_3R_75()) {
4315        jj_scanpos = xsp;
4316        if (jj_3R_76()) {
4317        jj_scanpos = xsp;
4318        if (jj_3R_77()) {
4319        jj_scanpos = xsp;
4320        if (jj_3R_78()) {
4321        jj_scanpos = xsp;
4322        if (jj_3R_79()) {
4323        jj_scanpos = xsp;
4324        if (jj_3R_80()) return true;
4325        }
4326        }
4327        }
4328        }
4329        }
4330        }
4331        }
4332        }
4333        }
4334        }
4335        }
4336        }
4337        }
4338        }
4339        }
4340        }
4341        }
4342        }
4343        }
4344        }
4345        }
4346        }
4347        }
4348        }
4349        }
4350        }
4351        return false;
4352      }
4353    
4354      final private boolean jj_3R_101() {
4355        if (jj_scan_token(BREAK)) return true;
4356        return false;
4357      }
4358    
4359      final private boolean jj_3_5() {
4360        Token xsp;
4361        xsp = jj_scanpos;
4362        if (jj_scan_token(126)) {
4363        jj_scanpos = xsp;
4364        if (jj_scan_token(97)) {
4365        jj_scanpos = xsp;
4366        if (jj_scan_token(125)) {
4367        jj_scanpos = xsp;
4368        if (jj_scan_token(96)) {
4369        jj_scanpos = xsp;
4370        if (jj_scan_token(95)) {
4371        jj_scanpos = xsp;
4372        if (jj_scan_token(95)) {
4373        jj_scanpos = xsp;
4374        if (jj_scan_token(94)) return true;
4375        }
4376        }
4377        }
4378        }
4379        }
4380        }
4381        return false;
4382      }
4383    
4384      final private boolean jj_3R_100() {
4385        if (jj_scan_token(SETTING)) return true;
4386        return false;
4387      }
4388    
4389      final private boolean jj_3R_39() {
4390        Token xsp;
4391        xsp = jj_scanpos;
4392        if (jj_scan_token(126)) {
4393        jj_scanpos = xsp;
4394        if (jj_scan_token(97)) {
4395        jj_scanpos = xsp;
4396        if (jj_scan_token(125)) {
4397        jj_scanpos = xsp;
4398        if (jj_scan_token(96)) {
4399        jj_scanpos = xsp;
4400        if (jj_scan_token(95)) {
4401        jj_scanpos = xsp;
4402        if (jj_scan_token(94)) return true;
4403        }
4404        }
4405        }
4406        }
4407        }
4408        if (jj_3R_38()) return true;
4409        return false;
4410      }
4411    
4412      final private boolean jj_3R_157() {
4413        if (jj_scan_token(RAW_STRING)) return true;
4414        return false;
4415      }
4416    
4417      final private boolean jj_3R_35() {
4418        if (jj_3R_38()) return true;
4419        Token xsp;
4420        xsp = jj_scanpos;
4421        if (jj_3R_39()) jj_scanpos = xsp;
4422        return false;
4423      }
4424    
4425      final private boolean jj_3R_111() {
4426        if (jj_scan_token(FALLBACK)) return true;
4427        return false;
4428      }
4429    
4430      final private boolean jj_3R_149() {
4431        Token xsp;
4432        xsp = jj_scanpos;
4433        if (jj_scan_token(81)) {
4434        jj_scanpos = xsp;
4435        if (jj_3R_157()) return true;
4436        }
4437        return false;
4438      }
4439    
4440      final private boolean jj_3_17() {
4441        Token xsp;
4442        xsp = jj_scanpos;
4443        if (jj_scan_token(68)) jj_scanpos = xsp;
4444        xsp = jj_scanpos;
4445        if (jj_scan_token(66)) {
4446        jj_scanpos = xsp;
4447        if (jj_scan_token(65)) return true;
4448        }
4449        return false;
4450      }
4451    
4452      final private boolean jj_3_4() {
4453        Token xsp;
4454        xsp = jj_scanpos;
4455        if (jj_scan_token(93)) {
4456        jj_scanpos = xsp;
4457        if (jj_scan_token(91)) {
4458        jj_scanpos = xsp;
4459        if (jj_scan_token(92)) return true;
4460        }
4461        }
4462        return false;
4463      }
4464    
4465      public FMParserTokenManager token_source;
4466      SimpleCharStream jj_input_stream;
4467      public Token token, jj_nt;
4468      private int jj_ntk;
4469      private Token jj_scanpos, jj_lastpos;
4470      private int jj_la;
4471      public boolean lookingAhead = false;
4472      private boolean jj_semLA;
4473      private int jj_gen;
4474      final private int[] jj_la1 = new int[83];
4475      static private int[] jj_la1_0;
4476      static private int[] jj_la1_1;
4477      static private int[] jj_la1_2;
4478      static private int[] jj_la1_3;
4479      static private int[] jj_la1_4;
4480      static {
4481          jj_la1_0();
4482          jj_la1_1();
4483          jj_la1_2();
4484          jj_la1_3();
4485          jj_la1_4();
4486       }
4487       private static void jj_la1_0() {
4488          jj_la1_0 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x800000,0x0,0x0,0x1c000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x180000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x30000000,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x7fffdd40,0x0,0x0,0x0,0x7fffdd40,0x7fffdd40,0x0,0x0,0x7fffdd40,0x0,0x0,0x0,0x0,0x0,};
4489       }
4490       private static void jj_la1_1() {
4491          jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x6,0x0,0x0,0x0,0x3000000,0x4000,0x8000,0xc00000,0x1e0000,0x0,0x0,0x0,0x0,0x70,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x180,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x200000,0x0,0xafdfe000,0x0,0x0,0x0,0xafdfe000,0xafdfe000,0x0,0x0,0xafdfe000,0x0,0x0,0x0,0x0,0x0,};
4492       }
4493       private static void jj_la1_2() {
4494          jj_la1_2 = new int[] {0xfe0000,0xfe0000,0x0,0x0,0x0,0x0,0x38000000,0xc0000000,0x600000,0x60000,0x6800000,0x0,0xc0180000,0xc0180000,0x60000,0x180000,0x0,0x0,0x0,0xfe0000,0x0,0x0,0x0,0x0,0x0,0xfe0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x8000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xfe0000,0x0,0xfe0000,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x0,0x70,0x0,0x0,0x1f0,0x1f0,0x1f0,0x1f0,0x1f0,0x10,0x0,0x6,0x0,0x0,};
4495       }
4496       private static void jj_la1_3() {
4497          jj_la1_3 = new int[] {0x10a8000,0x10a880c,0x800,0xc,0xc,0x190,0x0,0x60000003,0x0,0x1000000,0x28800,0x800,0xe00003,0x1e00033,0x0,0x0,0x5000,0x1000,0x5000,0x10a880c,0x2000,0x0,0x0,0x0,0x800000,0x10a880c,0x800000,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x200000,0x200000,0x0,0x8200000,0x2000,0x1000000,0x0,0x20000,0x1000000,0x40,0x0,0x1000,0x40000,0x0,0x80000000,0x80000000,0x80001000,0x80000000,0x80000000,0x81000000,0x2000,0x18000000,0x40000,0x1000000,0x10a980c,0x1000,0x10a880c,0x0,0x2000,0x1000000,0x18000000,0x0,0x0,0x0,0x18000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1000,0x1000000,};
4498       }
4499       private static void jj_la1_4() {
4500          jj_la1_4 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1e,0x1e,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
4501       }
4502      final private JJCalls[] jj_2_rtns = new JJCalls[17];
4503      private boolean jj_rescan = false;
4504      private int jj_gc = 0;
4505    
4506      public FMParser(InputStream stream) {
4507        jj_input_stream = new SimpleCharStream(stream, 1, 1);
4508        token_source = new FMParserTokenManager(jj_input_stream);
4509        token = new Token();
4510        jj_ntk = -1;
4511        jj_gen = 0;
4512        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4513        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4514      }
4515    
4516      public void ReInit(InputStream stream) {
4517        jj_input_stream.ReInit(stream, 1, 1);
4518        token_source.ReInit(jj_input_stream);
4519        token = new Token();
4520        jj_ntk = -1;
4521        jj_gen = 0;
4522        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4523        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4524      }
4525    
4526      public FMParser(Reader stream) {
4527        jj_input_stream = new SimpleCharStream(stream, 1, 1);
4528        token_source = new FMParserTokenManager(jj_input_stream);
4529        token = new Token();
4530        jj_ntk = -1;
4531        jj_gen = 0;
4532        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4533        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4534      }
4535    
4536      public void ReInit(Reader stream) {
4537        jj_input_stream.ReInit(stream, 1, 1);
4538        token_source.ReInit(jj_input_stream);
4539        token = new Token();
4540        jj_ntk = -1;
4541        jj_gen = 0;
4542        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4543        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4544      }
4545    
4546      public FMParser(FMParserTokenManager tm) {
4547        token_source = tm;
4548        token = new Token();
4549        jj_ntk = -1;
4550        jj_gen = 0;
4551        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4552        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4553      }
4554    
4555      public void ReInit(FMParserTokenManager tm) {
4556        token_source = tm;
4557        token = new Token();
4558        jj_ntk = -1;
4559        jj_gen = 0;
4560        for (int i = 0; i < 83; i++) jj_la1[i] = -1;
4561        for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4562      }
4563    
4564      final private Token jj_consume_token(int kind) throws ParseException {
4565        Token oldToken;
4566        if ((oldToken = token).next != null) token = token.next;
4567        else token = token.next = token_source.getNextToken();
4568        jj_ntk = -1;
4569        if (token.kind == kind) {
4570          jj_gen++;
4571          if (++jj_gc > 100) {
4572            jj_gc = 0;
4573            for (int i = 0; i < jj_2_rtns.length; i++) {
4574              JJCalls c = jj_2_rtns[i];
4575              while (c != null) {
4576                if (c.gen < jj_gen) c.first = null;
4577                c = c.next;
4578              }
4579            }
4580          }
4581          return token;
4582        }
4583        token = oldToken;
4584        jj_kind = kind;
4585        throw generateParseException();
4586      }
4587    
4588      static private final class LookaheadSuccess extends Error { }
4589      static final private LookaheadSuccess jj_ls = new LookaheadSuccess();
4590      final private boolean jj_scan_token(int kind) {
4591        if (jj_scanpos == jj_lastpos) {
4592          jj_la--;
4593          if (jj_scanpos.next == null) {
4594            jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
4595          } else {
4596            jj_lastpos = jj_scanpos = jj_scanpos.next;
4597          }
4598        } else {
4599          jj_scanpos = jj_scanpos.next;
4600        }
4601        if (jj_rescan) {
4602          int i = 0; Token tok = token;
4603          while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
4604          if (tok != null) jj_add_error_token(kind, i);
4605        }
4606        if (jj_scanpos.kind != kind) return true;
4607        if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
4608        return false;
4609      }
4610    
4611      final public Token getNextToken() {
4612        if (token.next != null) token = token.next;
4613        else token = token.next = token_source.getNextToken();
4614        jj_ntk = -1;
4615        jj_gen++;
4616        return token;
4617      }
4618    
4619      final public Token getToken(int index) {
4620        Token t = lookingAhead ? jj_scanpos : token;
4621        for (int i = 0; i < index; i++) {
4622          if (t.next != null) t = t.next;
4623          else t = t.next = token_source.getNextToken();
4624        }
4625        return t;
4626      }
4627    
4628      final private int jj_ntk() {
4629        if ((jj_nt=token.next) == null)
4630          return (jj_ntk = (token.next=token_source.getNextToken()).kind);
4631        else
4632          return (jj_ntk = jj_nt.kind);
4633      }
4634    
4635      private Vector jj_expentries = new Vector();
4636      private int[] jj_expentry;
4637      private int jj_kind = -1;
4638      private int[] jj_lasttokens = new int[100];
4639      private int jj_endpos;
4640    
4641      private void jj_add_error_token(int kind, int pos) {
4642        if (pos >= 100) return;
4643        if (pos == jj_endpos + 1) {
4644          jj_lasttokens[jj_endpos++] = kind;
4645        } else if (jj_endpos != 0) {
4646          jj_expentry = new int[jj_endpos];
4647          for (int i = 0; i < jj_endpos; i++) {
4648            jj_expentry[i] = jj_lasttokens[i];
4649          }
4650          boolean exists = false;
4651          for (Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
4652            int[] oldentry = (int[])(e.nextElement());
4653            if (oldentry.length == jj_expentry.length) {
4654              exists = true;
4655              for (int i = 0; i < jj_expentry.length; i++) {
4656                if (oldentry[i] != jj_expentry[i]) {
4657                  exists = false;
4658                  break;
4659                }
4660              }
4661              if (exists) break;
4662            }
4663          }
4664          if (!exists) jj_expentries.addElement(jj_expentry);
4665          if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
4666        }
4667      }
4668    
4669      public ParseException generateParseException() {
4670        jj_expentries.removeAllElements();
4671        boolean[] la1tokens = new boolean[133];
4672        for (int i = 0; i < 133; i++) {
4673          la1tokens[i] = false;
4674        }
4675        if (jj_kind >= 0) {
4676          la1tokens[jj_kind] = true;
4677          jj_kind = -1;
4678        }
4679        for (int i = 0; i < 83; i++) {
4680          if (jj_la1[i] == jj_gen) {
4681            for (int j = 0; j < 32; j++) {
4682              if ((jj_la1_0[i] & (1<<j)) != 0) {
4683                la1tokens[j] = true;
4684              }
4685              if ((jj_la1_1[i] & (1<<j)) != 0) {
4686                la1tokens[32+j] = true;
4687              }
4688              if ((jj_la1_2[i] & (1<<j)) != 0) {
4689                la1tokens[64+j] = true;
4690              }
4691              if ((jj_la1_3[i] & (1<<j)) != 0) {
4692                la1tokens[96+j] = true;
4693              }
4694              if ((jj_la1_4[i] & (1<<j)) != 0) {
4695                la1tokens[128+j] = true;
4696              }
4697            }
4698          }
4699        }
4700        for (int i = 0; i < 133; i++) {
4701          if (la1tokens[i]) {
4702            jj_expentry = new int[1];
4703            jj_expentry[0] = i;
4704            jj_expentries.addElement(jj_expentry);
4705          }
4706        }
4707        jj_endpos = 0;
4708        jj_rescan_token();
4709        jj_add_error_token(0, 0);
4710        int[][] exptokseq = new int[jj_expentries.size()][];
4711        for (int i = 0; i < jj_expentries.size(); i++) {
4712          exptokseq[i] = (int[])jj_expentries.elementAt(i);
4713        }
4714        return new ParseException(token, exptokseq, tokenImage);
4715      }
4716    
4717      final public void enable_tracing() {
4718      }
4719    
4720      final public void disable_tracing() {
4721      }
4722    
4723      final private void jj_rescan_token() {
4724        jj_rescan = true;
4725        for (int i = 0; i < 17; i++) {
4726          JJCalls p = jj_2_rtns[i];
4727          do {
4728            if (p.gen > jj_gen) {
4729              jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
4730              switch (i) {
4731                case 0: jj_3_1(); break;
4732                case 1: jj_3_2(); break;
4733                case 2: jj_3_3(); break;
4734                case 3: jj_3_4(); break;
4735                case 4: jj_3_5(); break;
4736                case 5: jj_3_6(); break;
4737                case 6: jj_3_7(); break;
4738                case 7: jj_3_8(); break;
4739                case 8: jj_3_9(); break;
4740                case 9: jj_3_10(); break;
4741                case 10: jj_3_11(); break;
4742                case 11: jj_3_12(); break;
4743                case 12: jj_3_13(); break;
4744                case 13: jj_3_14(); break;
4745                case 14: jj_3_15(); break;
4746                case 15: jj_3_16(); break;
4747                case 16: jj_3_17(); break;
4748              }
4749            }
4750            p = p.next;
4751          } while (p != null);
4752        }
4753        jj_rescan = false;
4754      }
4755    
4756      final private void jj_save(int index, int xla) {
4757        JJCalls p = jj_2_rtns[index];
4758        while (p.gen > jj_gen) {
4759          if (p.next == null) { p = p.next = new JJCalls(); break; }
4760          p = p.next;
4761        }
4762        p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
4763      }
4764    
4765      static final class JJCalls {
4766        int gen;
4767        Token first;
4768        int arg;
4769        JJCalls next;
4770      }
4771    
4772    }