KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > core > FMParser


1 /* Generated By:JavaCC: Do not edit this line. FMParser.java */
2 package freemarker.core;
3
4 import freemarker.template.*;
5 import freemarker.template.utility.StringUtil;
6 import freemarker.template.utility.DeepUnwrap;
7 import java.io.*;
8 import java.util.*;
9
10 /**
11  * This class is generated by JavaCC from a grammar file.
12  */

13 public class FMParser implements FMParserConstants {
14
15 // Necessary for adding macros and setting location info.
16
Template template;
17   private String JavaDoc templateName;
18
19 // variables that keep track of whether we are in a loop or a switch.
20
private int loopNesting, switchNesting;
21   private boolean inMacro, inFunction, stripWhitespace, stripText;
22   private LinkedList escapes = new LinkedList();
23   private int contentNesting; // for stripText
24

25   /**
26    * Create an FM expression parser using a string.
27    */

28   static public FMParser createExpressionParser(String JavaDoc s) {
29       SimpleCharStream scs = new SimpleCharStream(new StringReader(s), 1, 1, s.length());
30       FMParserTokenManager token_source = new FMParserTokenManager(scs);
31       token_source.SwitchTo(FMParserConstants.FM_EXPRESSION);
32       return new FMParser(token_source);
33   }
34
35   /**
36    * Constructs a new parser object.
37    * @param template The template associated with this parser.
38    * @param reader The character stream to use as input
39    * @param strictEscapeSyntax Whether FreeMarker directives must start with a #
40    */

41   public FMParser(Template template, Reader reader, boolean strictEscapeSyntax, boolean stripWhitespace) {
42       this(reader);
43       this.template = template;
44       token_source.strictEscapeSyntax = strictEscapeSyntax;
45       this.templateName = template != null ? template.getName() : "";
46       token_source.templateName = templateName;
47       this.stripWhitespace = stripWhitespace;
48
49   }
50
51   public FMParser(String JavaDoc template) {
52       this(null, new StringReader(template), true, true);
53   }
54
55   private String JavaDoc getErrorStart(Token t) {
56       return "Error in template: " + template.getName()
57             + "\non line " + t.beginLine + ", column " + t.beginColumn;
58   }
59
60   /**
61    * Throw an exception if the expression passed in is a String
62    * Literal
63    */

64   private void notStringLiteral(Expression exp, String JavaDoc expected) throws ParseException {
65       if (exp instanceof StringLiteral) {
66          String JavaDoc msg = "Error " + exp.getStartLocation()
67                      + "\nFound string literal: " + exp
68                      + "\nExpecting: " + expected;
69          throw new ParseException(msg, exp);
70       }
71   }
72
73   /**
74    * Throw an exception if the expression passed in is a Number
75    * Literal
76    */

77   private void notNumberLiteral(Expression exp, String JavaDoc expected) throws ParseException {
78       if (exp instanceof NumberLiteral) {
79          String JavaDoc msg = "Error " + exp.getStartLocation()
80                      + "\nFound number literal: " + exp.getCanonicalForm()
81                      + "\nExpecting " + expected;
82          throw new ParseException(msg, exp);
83       }
84   }
85
86   /**
87    * Throw an exception if the expression passed in is a boolean
88    * Literal
89    */

90   private void notBooleanLiteral(Expression exp, String JavaDoc expected) throws ParseException {
91       if (exp instanceof BooleanLiteral) {
92          String JavaDoc msg = "Error " + exp.getStartLocation()
93                      + "\nFound: " + exp.getCanonicalForm()
94                      + "\nExpecting " + expected;
95          throw new ParseException(msg, exp);
96       }
97   }
98
99   /**
100    * Throw an exception if the expression passed in is a Hash
101    * Literal
102    */

103   private void notHashLiteral(Expression exp, String JavaDoc expected) throws ParseException {
104         if (exp instanceof HashLiteral) {
105          String JavaDoc msg = "Error " + exp.getStartLocation()
106                      + "\nFound hash literal: " + exp.getCanonicalForm()
107                      + "\nExpecting " + expected;
108          throw new ParseException(msg, exp);
109       }
110   }
111
112   /**
113    * Throw an exception if the expression passed in is a List
114    * Literal
115    */

116
117   private void notListLiteral(Expression exp, String JavaDoc expected)
118       throws ParseException
119   {
120         if (exp instanceof ListLiteral) {
121          String JavaDoc msg = "Error " + exp.getStartLocation()
122                      + "\nFound list literal: " + exp.getCanonicalForm()
123                      + "\nExpecting " + expected;
124          throw new ParseException(msg, exp);
125       }
126   }
127   /**
128    * Throw an exception if the expression passed in is a literal
129    * other than of the numerical type
130    */

131   private void numberLiteralOnly(Expression exp) throws ParseException {
132       notStringLiteral(exp, "number");
133       notListLiteral(exp, "number");
134       notHashLiteral(exp, "number");
135       notBooleanLiteral(exp, "number");
136   }
137
138   /**
139    * Throw an exception if the expression passed in is
140    * not a string.
141    */

142   private void stringLiteralOnly(Expression exp) throws ParseException {
143       notNumberLiteral(exp, "number");
144       notListLiteral(exp, "number");
145       notHashLiteral(exp, "number");
146       notBooleanLiteral(exp, "number");
147   }
148
149   /**
150    * Throw an exception if the expression passed in is a literal
151    * other than of the boolean type
152    */

153   private void booleanLiteralOnly(Expression exp) throws ParseException {
154       notStringLiteral(exp, "boolean (true/false)");
155       notListLiteral(exp, "boolean (true/false)");
156       notHashLiteral(exp, "boolean (true/false)");
157       notNumberLiteral(exp, "boolean (true/false)");
158   }
159
160   private Expression escapedExpression(Expression exp) {
161       if(!escapes.isEmpty()) {
162           return ((EscapeBlock)escapes.getFirst()).doEscape(exp);
163       }
164       return exp;
165   }
166
167   private boolean getBoolean(Expression exp) throws ParseException {
168       TemplateModel tm = null;
169       try {
170           tm = exp.getAsTemplateModel(null);
171       } catch (Exception JavaDoc e) {
172          throw new ParseException(e.getMessage()
173                                   + "\nCould not evaluate expression: "
174                                   + exp.getCanonicalForm()
175                                   + exp.getStartLocation(), exp);
176       }
177       if (tm instanceof TemplateBooleanModel) {
178           try {
179              return ((TemplateBooleanModel) tm).getAsBoolean();
180           } catch (TemplateModelException tme) {
181           }
182       }
183       if (tm instanceof TemplateScalarModel) {
184           try {
185               return StringUtil.getYesNo(((TemplateScalarModel) tm).getAsString());
186           } catch (Exception JavaDoc e) {
187               throw new ParseException(e.getMessage()
188                                        + "\nExpecting yes/no, found: " + exp.getCanonicalForm()
189                                        + exp.getStartLocation(), exp);
190           }
191       }
192       throw new ParseException("Expecting boolean (yes/no) parameter" + exp.getStartLocation(), exp);
193   }
194
195 // Now the actual parsing code, starting
196
// with the productions for FreeMarker's
197
// expression syntax.
198

199 /**
200  * This is the same as OrExpression, since
201  * the OR is the operator with the lowest
202  * precedence.
203  */

204   final public Expression Expression() throws ParseException {
205    Expression exp;
206     exp = OrExpression();
207       {if (true) return exp;}
208     throw new Error JavaDoc("Missing return statement in function");
209   }
210
211 /**
212  * Lowest level expression, a literal, a variable,
213  * or a possibly more complex expression bounded
214  * by parentheses.
215  */

216   final public Expression PrimaryExpression() throws ParseException {
217    Expression exp;
218     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
219     case INTEGER:
220     case DECIMAL:
221       exp = NumberLiteral();
222       break;
223     case OPEN_BRACE:
224       exp = HashLiteral();
225       break;
226     case STRING_LITERAL:
227     case RAW_STRING:
228       exp = StringLiteral(true);
229       break;
230     case FALSE:
231     case TRUE:
232       exp = BooleanLiteral();
233       break;
234     case OPEN_BRACKET:
235       exp = ListLiteral();
236       break;
237     case ID:
238       exp = Identifier();
239       break;
240     case OPEN_PAREN:
241       exp = Parenthesis();
242       break;
243     case DOT:
244       exp = BuiltinVariable();
245       break;
246     default:
247       jj_la1[0] = jj_gen;
248       jj_consume_token(-1);
249       throw new ParseException();
250     }
251     label_1:
252     while (true) {
253       if (jj_2_1(2147483647)) {
254         ;
255       } else {
256         break label_1;
257       }
258       exp = AddSubExpression(exp);
259     }
260      {if (true) return exp;}
261     throw new Error JavaDoc("Missing return statement in function");
262   }
263
264   final public Expression Parenthesis() throws ParseException {
265    Expression exp, result;
266    Token start, end;
267     start = jj_consume_token(OPEN_PAREN);
268     exp = Expression();
269     end = jj_consume_token(CLOSE_PAREN);
270        result = new ParentheticalExpression(exp);
271        result.setLocation(template, start, end);
272        {if (true) return result;}
273     throw new Error JavaDoc("Missing return statement in function");
274   }
275
276 /**
277  * A primary expression preceded by zero or
278  * more unary operators. (The only unary operator we
279  * currently have is the NOT.)
280  */

281   final public Expression UnaryExpression() throws ParseException {
282    Expression exp, result;
283    boolean haveNot = false;
284    Token t = null, start=null;
285     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
286     case PLUS:
287     case MINUS:
288       result = UnaryPlusMinusExpression();
289       break;
290     case NOT:
291       result = NotExpression();
292       break;
293     case STRING_LITERAL:
294     case RAW_STRING:
295     case FALSE:
296     case TRUE:
297     case INTEGER:
298     case DECIMAL:
299     case DOT:
300     case OPEN_BRACKET:
301     case OPEN_PAREN:
302     case OPEN_BRACE:
303     case ID:
304       result = PrimaryExpression();
305       break;
306     default:
307       jj_la1[1] = jj_gen;
308       jj_consume_token(-1);
309       throw new ParseException();
310     }
311      {if (true) return result;}
312     throw new Error JavaDoc("Missing return statement in function");
313   }
314
315   final public Expression NotExpression() throws ParseException {
316    Token t;
317    Expression exp, result=null;
318    ArrayList nots = new ArrayList();
319     label_2:
320     while (true) {
321       t = jj_consume_token(NOT);
322                nots.add(t);
323       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
324       case NOT:
325         ;
326         break;
327       default:
328         jj_la1[2] = jj_gen;
329         break label_2;
330       }
331     }
332     exp = PrimaryExpression();
333       for (int i=0; i<nots.size(); i++) {
334          result = new NotExpression(exp);
335          Token tok = (Token) nots.get(nots.size() -i -1);
336          result.setLocation(template, tok, exp);
337          exp = result;
338       }
339       {if (true) return result;}
340     throw new Error JavaDoc("Missing return statement in function");
341   }
342
343   final public Expression UnaryPlusMinusExpression() throws ParseException {
344    Expression exp, result;
345    boolean isMinus = false;
346    Token t;
347     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
348     case PLUS:
349       t = jj_consume_token(PLUS);
350       break;
351     case MINUS:
352       t = jj_consume_token(MINUS);
353                  isMinus = true;
354       break;
355     default:
356       jj_la1[3] = jj_gen;
357       jj_consume_token(-1);
358       throw new ParseException();
359     }
360     exp = PrimaryExpression();
361       result = new UnaryPlusMinusExpression(exp, isMinus);
362       result.setLocation(template, t, exp);
363       {if (true) return result;}
364     throw new Error JavaDoc("Missing return statement in function");
365   }
366
367   final public Expression AdditiveExpression() throws ParseException {
368    Expression lhs, rhs, result;
369    boolean plus;
370     lhs = MultiplicativeExpression();
371                                    result = lhs;
372     label_3:
373     while (true) {
374       if (jj_2_2(2147483647)) {
375         ;
376       } else {
377         break label_3;
378       }
379       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
380       case PLUS:
381         jj_consume_token(PLUS);
382                  plus = true;
383         break;
384       case MINUS:
385         jj_consume_token(MINUS);
386                   plus = false;
387         break;
388       default:
389         jj_la1[4] = jj_gen;
390         jj_consume_token(-1);
391         throw new ParseException();
392       }
393       rhs = MultiplicativeExpression();
394          if (plus) {
395            // plus is treated separately, since it is also
396
// used for concatenation.
397
result = new AddConcatExpression(lhs, rhs);
398          }
399          else {
400              numberLiteralOnly(lhs);
401              numberLiteralOnly(rhs);
402              result = new ArithmeticExpression(lhs,
403                                             rhs,
404                                             ArithmeticExpression.SUBSTRACTION);
405          }
406          result.setLocation(template, lhs, rhs);
407          lhs = result;
408     }
409       {if (true) return result;}
410     throw new Error JavaDoc("Missing return statement in function");
411   }
412
413 /**
414  * A unary expression followed by zero or more
415  * unary expressions with operators in between.
416  */

417   final public Expression MultiplicativeExpression() throws ParseException {
418    Expression lhs, rhs, result;
419    int operation = ArithmeticExpression.MULTIPLICATION;
420     lhs = UnaryExpression();
421                           result = lhs;
422     label_4:
423     while (true) {
424       if (jj_2_3(2147483647)) {
425         ;
426       } else {
427         break label_4;
428       }
429       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
430       case TIMES:
431         jj_consume_token(TIMES);
432                   operation = ArithmeticExpression.MULTIPLICATION;
433         break;
434       case DIVIDE:
435         jj_consume_token(DIVIDE);
436                    operation = ArithmeticExpression.DIVISION;
437         break;
438       case PERCENT:
439         jj_consume_token(PERCENT);
440                    operation = ArithmeticExpression.MODULUS;
441         break;
442       default:
443         jj_la1[5] = jj_gen;
444         jj_consume_token(-1);
445         throw new ParseException();
446       }
447       rhs = UnaryExpression();
448          numberLiteralOnly(lhs);
449          numberLiteralOnly(rhs);
450          result = new ArithmeticExpression(lhs, rhs, operation);
451          result.setLocation(template, lhs, rhs);
452          lhs = result;
453     }
454       {if (true) return result;}
455     throw new Error JavaDoc("Missing return statement in function");
456   }
457
458   final public Expression EqualityExpression() throws ParseException {
459    Expression lhs, rhs, result;
460    Token t;
461     lhs = RelationalExpression();
462                                result = lhs;
463     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
464     case EQUALS:
465     case DOUBLE_EQUALS:
466     case NOT_EQUALS:
467       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
468       case NOT_EQUALS:
469         t = jj_consume_token(NOT_EQUALS);
470         break;
471       case EQUALS:
472         t = jj_consume_token(EQUALS);
473         break;
474       case DOUBLE_EQUALS:
475         t = jj_consume_token(DOUBLE_EQUALS);
476         break;
477       default:
478         jj_la1[6] = jj_gen;
479         jj_consume_token(-1);
480         throw new ParseException();
481       }
482       rhs = RelationalExpression();
483         notHashLiteral(lhs, "scalar");
484         notHashLiteral(rhs, "scalar");
485         notListLiteral(lhs, "scalar");
486         notListLiteral(rhs, "scalar");
487         result = new ComparisonExpression(lhs, rhs, t.image);
488         result.setLocation(template, lhs, rhs);
489       break;
490     default:
491       jj_la1[7] = jj_gen;
492       ;
493     }
494       {if (true) return result;}
495     throw new Error JavaDoc("Missing return statement in function");
496   }
497
498   final public Expression RelationalExpression() throws ParseException {
499    Expression lhs, rhs, result;
500    Token t;
501     lhs = RangeExpression();
502                           result = lhs;
503     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
504     case LESS_THAN:
505     case LESS_THAN_EQUALS:
506     case ESCAPED_GT:
507     case ESCAPED_GTE:
508     case NATURAL_GT:
509     case NATURAL_GTE:
510       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
511       case NATURAL_GTE:
512         t = jj_consume_token(NATURAL_GTE);
513         break;
514       case ESCAPED_GTE:
515         t = jj_consume_token(ESCAPED_GTE);
516         break;
517       case NATURAL_GT:
518         t = jj_consume_token(NATURAL_GT);
519         break;
520       case ESCAPED_GT:
521         t = jj_consume_token(ESCAPED_GT);
522         break;
523       case LESS_THAN_EQUALS:
524         t = jj_consume_token(LESS_THAN_EQUALS);
525         break;
526       case LESS_THAN:
527         t = jj_consume_token(LESS_THAN);
528         break;
529       default:
530         jj_la1[8] = jj_gen;
531         jj_consume_token(-1);
532         throw new ParseException();
533       }
534       rhs = RangeExpression();
535         notHashLiteral(lhs, "scalar");
536         notHashLiteral(rhs, "scalar");
537         notListLiteral(lhs, "scalar");
538         notListLiteral(rhs, "scalar");
539         notStringLiteral(lhs, "number");
540         notStringLiteral(rhs, "number");
541         result = new ComparisonExpression(lhs, rhs, t.image);
542         result.setLocation(template, lhs, rhs);
543       break;
544     default:
545       jj_la1[9] = jj_gen;
546       ;
547     }
548       {if (true) return result;}
549     throw new Error JavaDoc("Missing return statement in function");
550   }
551
552   final public Expression RangeExpression() throws ParseException {
553    Expression lhs, rhs=null, result;
554     lhs = AdditiveExpression();
555                               result = lhs;
556     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
557     case DOT_DOT:
558       jj_consume_token(DOT_DOT);
559       if (jj_2_4(2147483647)) {
560         rhs = AdditiveExpression();
561       } else {
562         ;
563       }
564            numberLiteralOnly(lhs);
565            if (rhs != null) {
566                numberLiteralOnly(rhs);
567            }
568            Range range = new Range(lhs, rhs);
569            if (rhs != null) {
570                range.setLocation(template, lhs, rhs);
571            } else {
572               range.setLocation(template, lhs, lhs);
573            }
574            result = range;
575       break;
576     default:
577       jj_la1[10] = jj_gen;
578       ;
579     }
580         {if (true) return result;}
581     throw new Error JavaDoc("Missing return statement in function");
582   }
583
584   final public Expression AndExpression() throws ParseException {
585    Expression lhs, rhs, result;
586     lhs = EqualityExpression();
587                              result = lhs;
588     label_5:
589     while (true) {
590       if (jj_2_5(2147483647)) {
591         ;
592       } else {
593         break label_5;
594       }
595       jj_consume_token(AND);
596       rhs = EqualityExpression();
597          booleanLiteralOnly(lhs);
598          booleanLiteralOnly(rhs);
599          result = new AndExpression(lhs, rhs);
600          result.setLocation(template, lhs, rhs);
601          lhs = result;
602     }
603       {if (true) return result;}
604     throw new Error JavaDoc("Missing return statement in function");
605   }
606
607   final public Expression OrExpression() throws ParseException {
608    Expression lhs, rhs, result;
609     lhs = AndExpression();
610                         result = lhs;
611     label_6:
612     while (true) {
613       if (jj_2_6(2147483647)) {
614         ;
615       } else {
616         break label_6;
617       }
618       jj_consume_token(OR);
619       rhs = AndExpression();
620          booleanLiteralOnly(lhs);
621          booleanLiteralOnly(rhs);
622          result = new OrExpression(lhs, rhs);
623          result.setLocation(template, lhs, rhs);
624          lhs = result;
625     }
626       {if (true) return result;}
627     throw new Error JavaDoc("Missing return statement in function");
628   }
629
630   final public ListLiteral ListLiteral() throws ParseException {
631    ArrayList values = new ArrayList();
632    Token begin, end;
633     begin = jj_consume_token(OPEN_BRACKET);
634     values = PositionalArgs();
635     end = jj_consume_token(CLOSE_BRACKET);
636         ListLiteral result = new ListLiteral(values);
637         result.setLocation(template, begin, end);
638         {if (true) return result;}
639     throw new Error JavaDoc("Missing return statement in function");
640   }
641
642   final public Expression NumberLiteral() throws ParseException {
643    Token op = null, t;
644     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
645     case INTEGER:
646       t = jj_consume_token(INTEGER);
647       break;
648     case DECIMAL:
649       t = jj_consume_token(DECIMAL);
650       break;
651     default:
652       jj_la1[11] = jj_gen;
653       jj_consume_token(-1);
654       throw new ParseException();
655     }
656        String JavaDoc s = t.image;
657        Expression result = new NumberLiteral(template.getArithmeticEngine().toNumber(s));
658        Token startToken = (op != null) ? op : t;
659        result.setLocation(template, startToken, t);
660        {if (true) return result;}
661     throw new Error JavaDoc("Missing return statement in function");
662   }
663
664   final public Identifier Identifier() throws ParseException {
665     Token t;
666     t = jj_consume_token(ID);
667         Identifier id = new Identifier(t.image);
668         id.setLocation(template, t, t);
669         {if (true) return id;}
670     throw new Error JavaDoc("Missing return statement in function");
671   }
672
673   final public Expression IdentifierOrStringLiteral() throws ParseException {
674    Expression exp;
675     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
676     case ID:
677       exp = Identifier();
678       break;
679     case STRING_LITERAL:
680     case RAW_STRING:
681       exp = StringLiteral(false);
682       break;
683     default:
684       jj_la1[12] = jj_gen;
685       jj_consume_token(-1);
686       throw new ParseException();
687     }
688       {if (true) return exp;}
689     throw new Error JavaDoc("Missing return statement in function");
690   }
691
692   final public BuiltinVariable BuiltinVariable() throws ParseException {
693    Token dot, name;
694     dot = jj_consume_token(DOT);
695     name = jj_consume_token(ID);
696       BuiltinVariable result = null;
697       try {
698           result = new BuiltinVariable(name.image);
699       } catch (ParseException pe) {
700           pe.lineNumber = dot.beginLine;
701           pe.columnNumber = dot.beginColumn;
702           {if (true) throw pe;}
703       }
704       result.setLocation(template, dot, name);
705       {if (true) return result;}
706     throw new Error JavaDoc("Missing return statement in function");
707   }
708
709 /**
710  * Production that builds up an expression
711  * using the dot or dynamic key name
712  * or the args list if this is a method invocation.
713  */

714   final public Expression AddSubExpression(Expression exp) throws ParseException {
715    Expression result = null;
716     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
717     case DOT:
718       result = DotVariable(exp);
719       break;
720     case OPEN_BRACKET:
721       result = DynamicKey(exp);
722       break;
723     case OPEN_PAREN:
724       result = MethodArgs(exp);
725       break;
726     case BUILT_IN:
727       result = BuiltIn(exp);
728       break;
729     default:
730       jj_la1[13] = jj_gen;
731       jj_consume_token(-1);
732       throw new ParseException();
733     }
734         {if (true) return result;}
735     throw new Error JavaDoc("Missing return statement in function");
736   }
737
738   final public Expression BuiltIn(Expression exp) throws ParseException {
739    Token t=null;
740     jj_consume_token(BUILT_IN);
741     t = jj_consume_token(ID);
742        BuiltIn result = null;
743        try {
744            result = BuiltIn.newBuiltIn(exp, t.image, t, templateName);
745        } catch (ParseException pe) {
746            pe.lineNumber = t.beginLine;
747            pe.columnNumber = t.beginColumn;
748            {if (true) throw pe;}
749        }
750        result.setLocation(template, exp, t);
751        {if (true) return result;}
752     throw new Error JavaDoc("Missing return statement in function");
753   }
754
755 /**
756  * production for when a key is specified by <DOT> + keyname
757  */

758   final public Expression DotVariable(Expression exp) throws ParseException {
759   Token t;
760     jj_consume_token(DOT);
761     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
762     case ID:
763       t = jj_consume_token(ID);
764       break;
765     case TIMES:
766       t = jj_consume_token(TIMES);
767       break;
768     case DOUBLE_STAR:
769       t = jj_consume_token(DOUBLE_STAR);
770       break;
771     case FALSE:
772     case TRUE:
773     case LESS_THAN:
774     case LESS_THAN_EQUALS:
775     case ESCAPED_GT:
776     case ESCAPED_GTE:
777     case IN:
778     case AS:
779     case USING:
780       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
781       case LESS_THAN:
782         t = jj_consume_token(LESS_THAN);
783         break;
784       case LESS_THAN_EQUALS:
785         t = jj_consume_token(LESS_THAN_EQUALS);
786         break;
787       case ESCAPED_GT:
788         t = jj_consume_token(ESCAPED_GT);
789         break;
790       case ESCAPED_GTE:
791         t = jj_consume_token(ESCAPED_GTE);
792         break;
793       case FALSE:
794         t = jj_consume_token(FALSE);
795         break;
796       case TRUE:
797         t = jj_consume_token(TRUE);
798         break;
799       case IN:
800         t = jj_consume_token(IN);
801         break;
802       case AS:
803         t = jj_consume_token(AS);
804         break;
805       case USING:
806         t = jj_consume_token(USING);
807         break;
808       default:
809         jj_la1[14] = jj_gen;
810         jj_consume_token(-1);
811         throw new ParseException();
812       }
813             if (!Character.isLetter(t.image.charAt(0))) {
814                 String JavaDoc msg = getErrorStart(t)
815                             + "\n" + t.image + " is not a valid identifier.";
816                 {if (true) throw new ParseException(msg, t.beginLine, t.beginColumn);}
817             }
818       break;
819     default:
820       jj_la1[15] = jj_gen;
821       jj_consume_token(-1);
822       throw new ParseException();
823     }
824          notListLiteral(exp, "hash");
825          notStringLiteral(exp, "hash");
826          notBooleanLiteral(exp, "hash");
827          Dot dot = new Dot(exp, t.image);
828          dot.setLocation(template, exp, t);
829          {if (true) return dot;}
830     throw new Error JavaDoc("Missing return statement in function");
831   }
832
833 /**
834  * production for when the key is specified
835  * in brackets.
836  */

837   final public Expression DynamicKey(Expression exp) throws ParseException {
838    Expression arg;
839    Token t;
840     jj_consume_token(OPEN_BRACKET);
841     arg = Expression();
842     t = jj_consume_token(CLOSE_BRACKET);
843        notBooleanLiteral(exp, "list or hash");
844        notNumberLiteral(exp, "list or hash");
845        DynamicKeyName dkn = new DynamicKeyName(exp, arg);
846        dkn.setLocation(template, exp, t);
847        {if (true) return dkn;}
848     throw new Error JavaDoc("Missing return statement in function");
849   }
850
851 /**
852  * production for an arglist part of a method invocation.
853  */

854   final public MethodCall MethodArgs(Expression exp) throws ParseException {
855      ArrayList args = new ArrayList();
856      Token end;
857     jj_consume_token(OPEN_PAREN);
858     args = PositionalArgs();
859     end = jj_consume_token(CLOSE_PAREN);
860         args.trimToSize();
861         MethodCall result = new MethodCall(exp, args);
862         result.setLocation(template, exp, end);
863         {if (true) return result;}
864     throw new Error JavaDoc("Missing return statement in function");
865   }
866
867   final public StringLiteral StringLiteral(boolean interpolate) throws ParseException {
868   Token t;
869   boolean raw = false;
870     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
871     case STRING_LITERAL:
872       t = jj_consume_token(STRING_LITERAL);
873       break;
874     case RAW_STRING:
875       t = jj_consume_token(RAW_STRING);
876                      raw = true;
877       break;
878     default:
879       jj_la1[16] = jj_gen;
880       jj_consume_token(-1);
881       throw new ParseException();
882     }
883        String JavaDoc s = t.image;
884        // Get rid of the quotes.
885
s = s.substring(1, s.length() -1);
886        if (raw) {
887            s=s.substring(1);
888        }
889        else try {
890           s = StringUtil.FTLStringLiteralDec(s);
891        } catch (ParseException pe) {
892           pe.lineNumber = t.beginLine;
893           pe.columnNumber = t.beginColumn;
894           {if (true) throw pe;}
895        }
896        StringLiteral result = new StringLiteral(s);
897        result.setLocation(template, t, t);
898        if (interpolate && !raw) {
899            result.checkInterpolation();
900        }
901        {if (true) return result;}
902     throw new Error JavaDoc("Missing return statement in function");
903   }
904
905   final public Expression BooleanLiteral() throws ParseException {
906    Token t;
907    Expression result;
908     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
909     case FALSE:
910       t = jj_consume_token(FALSE);
911                   result = new BooleanLiteral(false);
912       break;
913     case TRUE:
914       t = jj_consume_token(TRUE);
915                  result = new BooleanLiteral(true);
916       break;
917     default:
918       jj_la1[17] = jj_gen;
919       jj_consume_token(-1);
920       throw new ParseException();
921     }
922        result.setLocation(template, t, t);
923        {if (true) return result;}
924     throw new Error JavaDoc("Missing return statement in function");
925   }
926
927   final public HashLiteral HashLiteral() throws ParseException {
928    Token begin, end;
929    Expression key, value;
930    ArrayList keys = new ArrayList();
931    ArrayList values = new ArrayList();
932     begin = jj_consume_token(OPEN_BRACE);
933     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
934     case STRING_LITERAL:
935     case RAW_STRING:
936     case FALSE:
937     case TRUE:
938     case INTEGER:
939     case DECIMAL:
940     case DOT:
941     case PLUS:
942     case MINUS:
943     case NOT:
944     case OPEN_BRACKET:
945     case OPEN_PAREN:
946     case OPEN_BRACE:
947     case ID:
948       key = Expression();
949       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
950       case COMMA:
951         jj_consume_token(COMMA);
952         break;
953       case COLON:
954         jj_consume_token(COLON);
955         break;
956       default:
957         jj_la1[18] = jj_gen;
958         jj_consume_token(-1);
959         throw new ParseException();
960       }
961       value = Expression();
962           stringLiteralOnly(key);
963           keys.add(key);
964           values.add(value);
965       label_7:
966       while (true) {
967         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
968         case COMMA:
969           ;
970           break;
971         default:
972           jj_la1[19] = jj_gen;
973           break label_7;
974         }
975         jj_consume_token(COMMA);
976         key = Expression();
977         switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
978         case COMMA:
979           jj_consume_token(COMMA);
980           break;
981         case COLON:
982           jj_consume_token(COLON);
983           break;
984         default:
985           jj_la1[20] = jj_gen;
986           jj_consume_token(-1);
987           throw new ParseException();
988         }
989         value = Expression();
990                stringLiteralOnly(key);
991                keys.add(key);
992                values.add(value);
993       }
994       break;
995     default:
996       jj_la1[21] = jj_gen;
997       ;
998     }
999     end = jj_consume_token(CLOSE_BRACE);
1000      HashLiteral result = new HashLiteral(keys, values);
1001      result.setLocation(template, begin, end);
1002      {if (true) return result;}
1003    throw new Error JavaDoc("Missing return statement in function");
1004  }
1005
1006/**
1007 * A production representing the ${...}
1008 * that outputs a variable.
1009 */

1010  final public DollarVariable StringOutput() throws ParseException {
1011   Expression exp;
1012   Token begin, end;
1013    begin = jj_consume_token(OUTPUT_ESCAPE);
1014    exp = Expression();
1015      notHashLiteral(exp, "scalar");
1016      notListLiteral(exp, "scalar");
1017      notBooleanLiteral(exp, "scalar");
1018    end = jj_consume_token(CLOSE_BRACE);
1019      DollarVariable result = new DollarVariable(exp, escapedExpression(exp));
1020      result.setLocation(template, begin, end);
1021      {if (true) return result;}
1022    throw new Error JavaDoc("Missing return statement in function");
1023  }
1024
1025  final public NumericalOutput NumericalOutput() throws ParseException {
1026   Expression exp;
1027   Token fmt = null, begin, end;
1028    begin = jj_consume_token(NUMERICAL_ESCAPE);
1029    exp = Expression();
1030                     numberLiteralOnly(exp);
1031    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1032    case SEMICOLON:
1033      jj_consume_token(SEMICOLON);
1034      fmt = jj_consume_token(ID);
1035      break;
1036    default:
1037      jj_la1[22] = jj_gen;
1038      ;
1039    }
1040    end = jj_consume_token(CLOSE_BRACE);
1041      NumericalOutput result;
1042      if (fmt != null) {
1043         int minFrac = -1; // -1 indicates that the value has not been set
1044
int maxFrac = -1;
1045
1046         StringTokenizer st = new StringTokenizer(fmt.image, "mM", true);
1047         char type = '-';
1048         while (st.hasMoreTokens()) {
1049             String JavaDoc token = st.nextToken();
1050             try {
1051                if (type != '-') {
1052                    switch (type) {
1053                    case 'm':
1054                       if (minFrac != -1) {if (true) throw new ParseException("invalid formatting string", fmt.beginLine, fmt.beginColumn);}
1055                       minFrac = Integer.parseInt(token);
1056                       break;
1057                    case 'M':
1058                       if (maxFrac != -1) {if (true) throw new ParseException("invalid formatting string", fmt.beginLine, fmt.beginColumn);}
1059                       maxFrac = Integer.parseInt(token);
1060                       break;
1061                    default:
1062                       {if (true) throw new ParseException();}
1063                    }
1064                    type = '-';
1065                } else if (token.equals("m")) {
1066                   type = 'm';
1067                } else if (token.equals("M")) {
1068                   type = 'M';
1069                } else {
1070                   {if (true) throw new ParseException();}
1071                }
1072             }
1073             catch (ParseException e) {
1074                String JavaDoc msg = getErrorStart(fmt)
1075                      + "\nInvalid format specifier "
1076                      + fmt.image;
1077                {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1078             }
1079             catch (NumberFormatException JavaDoc e) {
1080                String JavaDoc msg = getErrorStart(fmt)
1081                      + "\nInvalid number in the format specifier "
1082                      + fmt.image;
1083                {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1084             }
1085         }
1086
1087         if (maxFrac == -1) {
1088            if (minFrac == -1) {
1089               String JavaDoc msg = getErrorStart(fmt)
1090                     + "\nInvalid format specification, at least one of m and M must be specified!";
1091               {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1092            }
1093            maxFrac = minFrac;
1094         } else if (minFrac == -1) {
1095            minFrac = 0;
1096         }
1097         if (minFrac > maxFrac) {
1098            String JavaDoc msg = getErrorStart(fmt)
1099                  + "\nInvalid format specification, min cannot be greater than max!";
1100            {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1101         }
1102         if (minFrac > 50 || maxFrac > 50) {// sanity check
1103
String JavaDoc msg = getErrorStart(fmt)
1104               + "\nCannot specify more than 50 fraction digits";
1105             {if (true) throw new ParseException(msg, fmt.beginLine, fmt.beginColumn);}
1106         }
1107         result = new NumericalOutput(exp, minFrac, maxFrac);
1108      } else { // if format != null
1109
result = new NumericalOutput(exp);
1110      }
1111      result.setLocation(template, begin, end);
1112      {if (true) return result;}
1113    throw new Error JavaDoc("Missing return statement in function");
1114  }
1115
1116  final public TemplateElement If() throws ParseException {
1117    Token start, end, t;
1118    Expression condition;
1119    TemplateElement block;
1120    IfBlock ifBlock;
1121    ConditionalBlock cblock;
1122    start = jj_consume_token(IF);
1123    condition = Expression();
1124    jj_consume_token(DIRECTIVE_END);
1125    block = OptionalBlock();
1126      cblock = new ConditionalBlock(condition, block, true);
1127      cblock.setLocation(template, start, block);
1128      ifBlock = new IfBlock(cblock);
1129    label_8:
1130    while (true) {
1131      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1132      case ELSE_IF:
1133        ;
1134        break;
1135      default:
1136        jj_la1[23] = jj_gen;
1137        break label_8;
1138      }
1139      t = jj_consume_token(ELSE_IF);
1140      condition = Expression();
1141      LooseDirectiveEnd();
1142      block = OptionalBlock();
1143          cblock = new ConditionalBlock(condition, block, false);
1144          cblock.setLocation(template, t, block);
1145          ifBlock.addBlock(cblock);
1146    }
1147    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1148    case ELSE:
1149      t = jj_consume_token(ELSE);
1150      block = OptionalBlock();
1151            cblock = new ConditionalBlock(null, block, false);
1152            cblock.setLocation(template, t, block);
1153            ifBlock.addBlock(cblock);
1154      break;
1155    default:
1156      jj_la1[24] = jj_gen;
1157      ;
1158    }
1159    end = jj_consume_token(END_IF);
1160       ifBlock.setLocation(template, start, end);
1161       {if (true) return ifBlock;}
1162    throw new Error JavaDoc("Missing return statement in function");
1163  }
1164
1165  final public AttemptBlock Attempt() throws ParseException {
1166   Token start, end;
1167   TemplateElement block, recoveryBlock;
1168    start = jj_consume_token(ATTEMPT);
1169    block = OptionalBlock();
1170    recoveryBlock = Recover();
1171    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1172    case END_RECOVER:
1173      end = jj_consume_token(END_RECOVER);
1174      break;
1175    case END_ATTEMPT:
1176      end = jj_consume_token(END_ATTEMPT);
1177      break;
1178    default:
1179      jj_la1[25] = jj_gen;
1180      jj_consume_token(-1);
1181      throw new ParseException();
1182    }
1183      AttemptBlock result = new AttemptBlock(block, recoveryBlock);
1184      result.setLocation(template, start, end);
1185      {if (true) return result;}
1186    throw new Error JavaDoc("Missing return statement in function");
1187  }
1188
1189  final public RecoveryBlock Recover() throws ParseException {
1190   Token start;
1191   TemplateElement block;
1192    start = jj_consume_token(RECOVER);
1193    block = OptionalBlock();
1194      RecoveryBlock result = new RecoveryBlock(block);
1195      result.setLocation(template, start, block);
1196      {if (true) return result;}
1197    throw new Error JavaDoc("Missing return statement in function");
1198  }
1199
1200  final public IteratorBlock List() throws ParseException {
1201    Expression exp;
1202    Token index, start, end;
1203    TemplateElement block;
1204    start = jj_consume_token(LIST);
1205                 ++loopNesting;
1206    exp = Expression();
1207    jj_consume_token(AS);
1208    index = jj_consume_token(ID);
1209    jj_consume_token(DIRECTIVE_END);
1210    block = OptionalBlock();
1211    end = jj_consume_token(END_LIST);
1212     --loopNesting;
1213     IteratorBlock result = new IteratorBlock(exp,
1214                                              index.image,
1215                                              block,
1216                                              false);
1217     result.setLocation(template, start, end);
1218     {if (true) return result;}
1219    throw new Error JavaDoc("Missing return statement in function");
1220  }
1221
1222  final public IteratorBlock ForEach() throws ParseException {
1223     Expression exp;
1224     Token index, start, end;
1225     TemplateElement block;
1226    start = jj_consume_token(FOREACH);
1227                    ++loopNesting;
1228    index = jj_consume_token(ID);
1229    jj_consume_token(IN);
1230    exp = Expression();
1231    jj_consume_token(DIRECTIVE_END);
1232    block = OptionalBlock();
1233    end = jj_consume_token(END_FOREACH);
1234     --loopNesting;
1235     IteratorBlock result = new IteratorBlock(exp,
1236                                              index.image,
1237                                              block,
1238                                              true);
1239     result.setLocation(template, start, end);
1240     {if (true) return result;}
1241    throw new Error JavaDoc("Missing return statement in function");
1242  }
1243
1244  final public VisitNode Visit() throws ParseException {
1245   Token start, end;
1246   Expression targetNode, namespaces=null;
1247    start = jj_consume_token(VISIT);
1248    targetNode = Expression();
1249    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1250    case USING:
1251      jj_consume_token(USING);
1252      namespaces = Expression();
1253      break;
1254    default:
1255      jj_la1[26] = jj_gen;
1256      ;
1257    }
1258    end = LooseDirectiveEnd();
1259       VisitNode result = new VisitNode(targetNode, namespaces);
1260       result.setLocation(template, start, end);
1261       {if (true) return result;}
1262    throw new Error JavaDoc("Missing return statement in function");
1263  }
1264
1265  final public RecurseNode Recurse() throws ParseException {
1266   Token start, end = null;
1267   Expression node=null, namespaces=null;
1268    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1269    case SIMPLE_RECURSE:
1270      start = jj_consume_token(SIMPLE_RECURSE);
1271      break;
1272    case RECURSE:
1273      start = jj_consume_token(RECURSE);
1274      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1275      case STRING_LITERAL:
1276      case RAW_STRING:
1277      case FALSE:
1278      case TRUE:
1279      case INTEGER:
1280      case DECIMAL:
1281      case DOT:
1282      case PLUS:
1283      case MINUS:
1284      case NOT:
1285      case OPEN_BRACKET:
1286      case OPEN_PAREN:
1287      case OPEN_BRACE:
1288      case ID:
1289        node = Expression();
1290        break;
1291      default:
1292        jj_la1[27] = jj_gen;
1293        ;
1294      }
1295      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1296      case USING:
1297        jj_consume_token(USING);
1298        namespaces = Expression();
1299        break;
1300      default:
1301        jj_la1[28] = jj_gen;
1302        ;
1303      }
1304      end = LooseDirectiveEnd();
1305      break;
1306    default:
1307      jj_la1[29] = jj_gen;
1308      jj_consume_token(-1);
1309      throw new ParseException();
1310    }
1311       if (end == null) end = start;
1312       RecurseNode result = new RecurseNode(node, namespaces);
1313       result.setLocation(template, start, end);
1314       {if (true) return result;}
1315    throw new Error JavaDoc("Missing return statement in function");
1316  }
1317
1318  final public FallbackInstruction FallBack() throws ParseException {
1319   Token tok;
1320    tok = jj_consume_token(FALLBACK);
1321      if (!inMacro) {
1322          {if (true) throw new ParseException(getErrorStart(tok)
1323                                   + "\nCannot fall back "
1324                                   + " outside a macro.",
1325                                   tok.beginLine, tok.beginColumn);}
1326
1327      }
1328      FallbackInstruction result = new FallbackInstruction();
1329      result.setLocation(template, tok, tok);
1330      {if (true) return result;}
1331    throw new Error JavaDoc("Missing return statement in function");
1332  }
1333
1334/**
1335 * Production used to break out of a loop or a switch block.
1336 */

1337  final public BreakInstruction Break() throws ParseException {
1338   Token start;
1339    start = jj_consume_token(BREAK);
1340       if (loopNesting < 1 && switchNesting <1)
1341       {
1342          String JavaDoc msg = getErrorStart(start) + "\n"
1343                       + start.image
1344                       + " occurred outside a loop or a switch block.";
1345          {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1346       }
1347       BreakInstruction result = new BreakInstruction();
1348       result.setLocation(template, start, start);
1349       {if (true) return result;}
1350    throw new Error JavaDoc("Missing return statement in function");
1351  }
1352
1353/**
1354 * Production used to jump out of a macro.
1355 * The stop instruction terminates the rendering of the template.
1356 */

1357  final public ReturnInstruction Return() throws ParseException {
1358   Token start, end=null;
1359   Expression exp = null;
1360    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1361    case SIMPLE_RETURN:
1362      start = jj_consume_token(SIMPLE_RETURN);
1363                            end = start;
1364      break;
1365    case RETURN:
1366      start = jj_consume_token(RETURN);
1367      exp = Expression();
1368      end = LooseDirectiveEnd();
1369      break;
1370    default:
1371      jj_la1[30] = jj_gen;
1372      jj_consume_token(-1);
1373      throw new ParseException();
1374    }
1375      if (inMacro) {
1376         if (exp != null) {
1377            String JavaDoc msg = getErrorStart(start)
1378                         + "\nA macro cannot return a value";
1379            {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1380         }
1381      }
1382      else if (inFunction) {
1383         if (exp == null) {
1384            String JavaDoc msg = getErrorStart(start)
1385                         + "\nA function must return a value";
1386            {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1387         }
1388      }
1389      else {
1390         if (exp == null) {
1391            String JavaDoc msg = getErrorStart(start)
1392                         + "\nA return instruction can only occur inside a macro of function";
1393            {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1394         }
1395      }
1396      ReturnInstruction result = new ReturnInstruction(exp);
1397      result.setLocation(template, start, end);
1398      {if (true) return result;}
1399    throw new Error JavaDoc("Missing return statement in function");
1400  }
1401
1402  final public StopInstruction Stop() throws ParseException {
1403   Token start = null;
1404   Expression exp = null;
1405    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1406    case HALT:
1407      start = jj_consume_token(HALT);
1408      break;
1409    case STOP:
1410      start = jj_consume_token(STOP);
1411      exp = Expression();
1412      LooseDirectiveEnd();
1413      break;
1414    default:
1415      jj_la1[31] = jj_gen;
1416      jj_consume_token(-1);
1417      throw new ParseException();
1418    }
1419       StopInstruction result = new StopInstruction(exp);
1420       result.setLocation(template, start, start);
1421       {if (true) return result;}
1422    throw new Error JavaDoc("Missing return statement in function");
1423  }
1424
1425  final public TemplateElement Nested() throws ParseException {
1426  Token t, end;
1427  ArrayList bodyParameters;
1428  BodyInstruction result = null;
1429    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1430    case SIMPLE_NESTED:
1431      t = jj_consume_token(SIMPLE_NESTED);
1432            result = new BodyInstruction(null);
1433            result.setLocation(template, t, t);
1434      break;
1435    case NESTED:
1436      t = jj_consume_token(NESTED);
1437      bodyParameters = PositionalArgs();
1438      end = LooseDirectiveEnd();
1439             result = new BodyInstruction(bodyParameters);
1440             result.setLocation(template, t, end);
1441      break;
1442    default:
1443      jj_la1[32] = jj_gen;
1444      jj_consume_token(-1);
1445      throw new ParseException();
1446    }
1447       if (!inMacro) {
1448          {if (true) throw new ParseException(getErrorStart(t)
1449                                   + "\nCannot use a "
1450                                   + t.image
1451                                   + " instruction outside a macro.",
1452                                   t.beginLine, t.beginColumn);}
1453       }
1454       {if (true) return result;}
1455    throw new Error JavaDoc("Missing return statement in function");
1456  }
1457
1458  final public TemplateElement Flush() throws ParseException {
1459  Token t;
1460    t = jj_consume_token(FLUSH);
1461       FlushInstruction result = new FlushInstruction();
1462       result.setLocation(template, t, t);
1463       {if (true) return result;}
1464    throw new Error JavaDoc("Missing return statement in function");
1465  }
1466
1467  final public TemplateElement Trim() throws ParseException {
1468  Token t;
1469  TrimInstruction result=null;
1470    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1471    case TRIM:
1472      t = jj_consume_token(TRIM);
1473               result = new TrimInstruction(true, true);
1474      break;
1475    case LTRIM:
1476      t = jj_consume_token(LTRIM);
1477                result = new TrimInstruction(true, false);
1478      break;
1479    case RTRIM:
1480      t = jj_consume_token(RTRIM);
1481                result = new TrimInstruction(false, true);
1482      break;
1483    case NOTRIM:
1484      t = jj_consume_token(NOTRIM);
1485                 result = new TrimInstruction(false, false);
1486      break;
1487    default:
1488      jj_la1[33] = jj_gen;
1489      jj_consume_token(-1);
1490      throw new ParseException();
1491    }
1492       result.setLocation(template, t, t);
1493       {if (true) return result;}
1494    throw new Error JavaDoc("Missing return statement in function");
1495  }
1496
1497  final public TemplateElement Assign() throws ParseException {
1498   Token start, end;
1499   int scope;
1500   Token id=null;
1501   Expression nameExp, exp, nsExp=null;
1502   String JavaDoc varName;
1503   ArrayList assignments = new ArrayList();
1504   Assignment ass;
1505   TemplateElement block;
1506    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1507    case ASSIGN:
1508      start = jj_consume_token(ASSIGN);
1509                      scope = Assignment.NAMESPACE;
1510      break;
1511    case GLOBALASSIGN:
1512      start = jj_consume_token(GLOBALASSIGN);
1513                           scope = Assignment.GLOBAL;
1514      break;
1515    case LOCALASSIGN:
1516      start = jj_consume_token(LOCALASSIGN);
1517                           scope = Assignment.LOCAL;
1518          scope = Assignment.LOCAL;
1519          if (!inMacro && !inFunction) {
1520             String JavaDoc msg = getErrorStart(start)
1521                          + "\nLocal variable assigned outside a macro.";
1522             {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
1523          }
1524      break;
1525    default:
1526      jj_la1[34] = jj_gen;
1527      jj_consume_token(-1);
1528      throw new ParseException();
1529    }
1530    nameExp = IdentifierOrStringLiteral();
1531       varName = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1532    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1533    case EQUALS:
1534      jj_consume_token(EQUALS);
1535      exp = Expression();
1536          ass = new Assignment(varName, exp, scope);
1537          ass.setLocation(template, nameExp, exp);
1538          assignments.add(ass);
1539      label_9:
1540      while (true) {
1541        if (jj_2_7(2147483647)) {
1542          ;
1543        } else {
1544          break label_9;
1545        }
1546        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1547        case COMMA:
1548          jj_consume_token(COMMA);
1549          break;
1550        default:
1551          jj_la1[35] = jj_gen;
1552          ;
1553        }
1554        nameExp = IdentifierOrStringLiteral();
1555               varName = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1556        jj_consume_token(EQUALS);
1557        exp = Expression();
1558               ass = new Assignment(varName, exp, scope);
1559               ass.setLocation(template, nameExp, exp);
1560               assignments.add(ass);
1561      }
1562      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1563      case IN:
1564        id = jj_consume_token(IN);
1565        nsExp = Expression();
1566                              if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(id) + "\nCannot assign to namespace here.", id.beginLine, id.beginColumn);}
1567        break;
1568      default:
1569        jj_la1[36] = jj_gen;
1570        ;
1571      }
1572      end = LooseDirectiveEnd();
1573           AssignmentInstruction ai = new AssignmentInstruction(scope);
1574           for (int i = 0; i< assignments.size(); i++) {
1575                ai.addAssignment((Assignment) assignments.get(i));
1576           }
1577           ai.setNamespaceExp(nsExp);
1578           ai.setLocation(template, start, end);
1579           {if (true) return ai;}
1580      break;
1581    case IN:
1582    case DIRECTIVE_END:
1583      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1584      case IN:
1585        id = jj_consume_token(IN);
1586        nsExp = Expression();
1587                              if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(id) + "\nCannot assign to namespace here.", id.beginLine, id.beginColumn);}
1588        break;
1589      default:
1590        jj_la1[37] = jj_gen;
1591        ;
1592      }
1593      jj_consume_token(DIRECTIVE_END);
1594      block = OptionalBlock();
1595      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1596      case END_LOCAL:
1597        end = jj_consume_token(END_LOCAL);
1598                           if (scope != Assignment.LOCAL) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags.", end.beginLine, end.beginColumn);}
1599        break;
1600      case END_ASSIGN:
1601        end = jj_consume_token(END_ASSIGN);
1602                            if (scope != Assignment.NAMESPACE) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags.", end.beginLine, end.beginColumn);}
1603        break;
1604      case END_GLOBAL:
1605        end = jj_consume_token(END_GLOBAL);
1606                            if (scope != Assignment.GLOBAL) {if (true) throw new ParseException(getErrorStart(end) + "\nMismatched assignment tags", end.beginLine, end.beginColumn);}
1607        break;
1608      default:
1609        jj_la1[38] = jj_gen;
1610        jj_consume_token(-1);
1611        throw new ParseException();
1612      }
1613          BlockAssignment ba = new BlockAssignment(block, varName, scope, nsExp);
1614          ba.setLocation(template, start, end);
1615          {if (true) return ba;}
1616      break;
1617    default:
1618      jj_la1[39] = jj_gen;
1619      jj_consume_token(-1);
1620      throw new ParseException();
1621    }
1622    throw new Error JavaDoc("Missing return statement in function");
1623  }
1624
1625  final public Include Include() throws ParseException {
1626   Expression nameExp;
1627   Token att, start, end;
1628   Expression exp, parseExp = null, encodingExp = null;
1629    start = jj_consume_token(INCLUDE);
1630    nameExp = Expression();
1631    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1632    case SEMICOLON:
1633      jj_consume_token(SEMICOLON);
1634      break;
1635    default:
1636      jj_la1[40] = jj_gen;
1637      ;
1638    }
1639    label_10:
1640    while (true) {
1641      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1642      case ID:
1643        ;
1644        break;
1645      default:
1646        jj_la1[41] = jj_gen;
1647        break label_10;
1648      }
1649      att = jj_consume_token(ID);
1650      jj_consume_token(EQUALS);
1651      exp = Expression();
1652             String JavaDoc attString = att.image;
1653             if (attString.equalsIgnoreCase("parse")) {
1654                parseExp = exp;
1655             }
1656             else if (attString.equalsIgnoreCase("encoding")) {
1657                encodingExp = exp;
1658             }
1659             else {
1660                 String JavaDoc msg = getErrorStart(att)
1661                       + "\nexpecting parse= or encoding= to be specified.";
1662                 {if (true) throw new ParseException(msg, att.beginLine, att.beginColumn);}
1663             }
1664    }
1665    end = LooseDirectiveEnd();
1666       Include result = new Include(template, nameExp, encodingExp, parseExp);
1667       result.setLocation(template, start, end);
1668       {if (true) return result;}
1669    throw new Error JavaDoc("Missing return statement in function");
1670  }
1671
1672  final public LibraryLoad Import() throws ParseException {
1673   Token start, end, ns;
1674   Expression nameExp;
1675    start = jj_consume_token(IMPORT);
1676    nameExp = Expression();
1677    jj_consume_token(AS);
1678    ns = jj_consume_token(ID);
1679    end = LooseDirectiveEnd();
1680       LibraryLoad result = new LibraryLoad(template, nameExp, ns.image);
1681       result.setLocation(template, start, end);
1682       template.addImport(result);
1683       {if (true) return result;}
1684    throw new Error JavaDoc("Missing return statement in function");
1685  }
1686
1687  final public Macro Macro() throws ParseException {
1688   Token arg, start, end;
1689   Expression nameExp;
1690   String JavaDoc name;
1691   ArrayList argNames = new ArrayList();
1692   HashMap args = new HashMap();
1693   ArrayList defNames = new ArrayList();
1694   Expression defValue=null;
1695   TemplateElement block;
1696   boolean isFunction = false, hasDefaults=false;
1697   boolean isCatchAll = false;
1698   String JavaDoc catchAll = null;
1699    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1700    case MACRO:
1701      start = jj_consume_token(MACRO);
1702      break;
1703    case FUNCTION:
1704      start = jj_consume_token(FUNCTION);
1705                          isFunction = true;
1706      break;
1707    default:
1708      jj_la1[42] = jj_gen;
1709      jj_consume_token(-1);
1710      throw new ParseException();
1711    }
1712       if (inMacro || inFunction) {
1713         {if (true) throw new ParseException(getErrorStart(start)
1714                     + "\nMacros cannot be nested.", start.beginLine, start.endLine);}
1715       }
1716       if (isFunction) inFunction = true; else inMacro = true;
1717    nameExp = IdentifierOrStringLiteral();
1718       name = (nameExp instanceof StringLiteral) ? ((StringLiteral) nameExp).getAsString() : nameExp.toString();
1719    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1720    case OPEN_PAREN:
1721      jj_consume_token(OPEN_PAREN);
1722      break;
1723    default:
1724      jj_la1[43] = jj_gen;
1725      ;
1726    }
1727    label_11:
1728    while (true) {
1729      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1730      case ID:
1731        ;
1732        break;
1733      default:
1734        jj_la1[44] = jj_gen;
1735        break label_11;
1736      }
1737      arg = jj_consume_token(ID);
1738                    defValue = null;
1739      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1740      case ELLIPSIS:
1741        jj_consume_token(ELLIPSIS);
1742                        isCatchAll = true;
1743        break;
1744      default:
1745        jj_la1[45] = jj_gen;
1746        ;
1747      }
1748      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1749      case EQUALS:
1750        jj_consume_token(EQUALS);
1751        defValue = Expression();
1752              defNames.add(arg.image);
1753              hasDefaults = true;
1754        break;
1755      default:
1756        jj_la1[46] = jj_gen;
1757        ;
1758      }
1759      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1760      case COMMA:
1761        jj_consume_token(COMMA);
1762        break;
1763      default:
1764        jj_la1[47] = jj_gen;
1765        ;
1766      }
1767          if (catchAll != null) {
1768              {if (true) throw new ParseException(getErrorStart(arg)
1769                + "\nThere may only be one \"catch-all\" parameter in a macro declaration, "
1770                + "and it must be the last parameter.", arg.beginLine, arg.endLine);}
1771          }
1772          if (isCatchAll) {
1773              if (defValue != null) {
1774                  {if (true) throw new ParseException(getErrorStart(arg)
1775                    + "\n\"Catch-all\" macro parameter may not have a default value.",
1776                    arg.beginLine, arg.endLine);}
1777              }
1778              catchAll = arg.image;
1779          } else {
1780              argNames.add(arg.image);
1781              if (hasDefaults && defValue == null) {
1782                  {if (true) throw new ParseException(getErrorStart(arg)
1783                    + "\nIn a macro declaration, parameters without a default value "
1784                    + "must all occur before the parameters with default values.",
1785                    arg.beginLine, arg.endLine);}
1786              }
1787              args.put(arg.image, defValue);
1788          }
1789    }
1790    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1791    case CLOSE_PAREN:
1792      jj_consume_token(CLOSE_PAREN);
1793      break;
1794    default:
1795      jj_la1[48] = jj_gen;
1796      ;
1797    }
1798    jj_consume_token(DIRECTIVE_END);
1799    block = OptionalBlock();
1800    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1801    case END_MACRO:
1802      end = jj_consume_token(END_MACRO);
1803                          if(isFunction) {if (true) throw new ParseException(getErrorStart(start) + "\nExpected function end tag here.", start.beginLine, start.endLine);}
1804      break;
1805    case END_FUNCTION:
1806      end = jj_consume_token(END_FUNCTION);
1807                             if(!isFunction) {if (true) throw new ParseException(getErrorStart(start) + "\nExpected macro end tag here.", start.beginLine, start.endLine);}
1808      break;
1809    default:
1810      jj_la1[49] = jj_gen;
1811      jj_consume_token(-1);
1812      throw new ParseException();
1813    }
1814       inMacro = inFunction = false;
1815       Macro result = new Macro(name, argNames, args, block);
1816       result.setCatchAll(catchAll);
1817       result.isFunction = isFunction;
1818       result.setLocation(template, start, end);
1819       template.addMacro(result);
1820       {if (true) return result;}
1821    throw new Error JavaDoc("Missing return statement in function");
1822  }
1823
1824  final public CompressedBlock Compress() throws ParseException {
1825   TemplateElement block;
1826   Token start, end;
1827    start = jj_consume_token(COMPRESS);
1828    block = OptionalBlock();
1829    end = jj_consume_token(END_COMPRESS);
1830       CompressedBlock cb = new CompressedBlock(block);
1831       cb.setLocation(template, start, end);
1832       {if (true) return cb;}
1833    throw new Error JavaDoc("Missing return statement in function");
1834  }
1835
1836  final public TemplateElement UnifiedMacroTransform() throws ParseException {
1837   Token start=null, end, t;
1838   HashMap namedArgs = null;
1839   ArrayList positionalArgs = null, bodyParameters = null;
1840   String JavaDoc directiveName = null;
1841   TemplateElement nestedBlock = null;
1842   Expression exp;
1843    start = jj_consume_token(UNIFIED_CALL);
1844    exp = Expression();
1845        if (exp instanceof Identifier || (exp instanceof Dot && ((Dot) exp).onlyHasIdentifiers())) {
1846           directiveName = exp.getCanonicalForm();
1847        }
1848    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1849    case TERMINATING_WHITESPACE:
1850      jj_consume_token(TERMINATING_WHITESPACE);
1851      break;
1852    default:
1853      jj_la1[50] = jj_gen;
1854      ;
1855    }
1856    if (jj_2_8(2147483647)) {
1857      namedArgs = NamedArgs();
1858    } else {
1859      positionalArgs = PositionalArgs();
1860    }
1861    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1862    case SEMICOLON:
1863      jj_consume_token(SEMICOLON);
1864                   bodyParameters = new ArrayList();
1865      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1866      case ID:
1867        t = jj_consume_token(ID);
1868                   bodyParameters.add(t.image);
1869        label_12:
1870        while (true) {
1871          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1872          case COMMA:
1873            ;
1874            break;
1875          default:
1876            jj_la1[51] = jj_gen;
1877            break label_12;
1878          }
1879          jj_consume_token(COMMA);
1880          t = jj_consume_token(ID);
1881                        bodyParameters.add(t.image);
1882        }
1883        break;
1884      default:
1885        jj_la1[52] = jj_gen;
1886        ;
1887      }
1888      break;
1889    default:
1890      jj_la1[53] = jj_gen;
1891      ;
1892    }
1893    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1894    case EMPTY_DIRECTIVE_END:
1895      end = jj_consume_token(EMPTY_DIRECTIVE_END);
1896      break;
1897    case DIRECTIVE_END:
1898      jj_consume_token(DIRECTIVE_END);
1899      nestedBlock = OptionalBlock();
1900      end = jj_consume_token(UNIFIED_CALL_END);
1901           String JavaDoc s = end.image.substring(3);
1902           s = s.substring(0, s.length() -1).trim();
1903           if (s.length() >0 && !s.equals(directiveName)) {
1904              String JavaDoc msg = getErrorStart(end);
1905              if (directiveName == null) {
1906                    {if (true) throw new ParseException(msg + "\nExpecting </@>", end.beginLine, end.beginColumn);}
1907              }
1908              else {
1909                  {if (true) throw new ParseException(msg + "\nExpecting </@> or </@" + directiveName + ">", end.beginLine, end.beginColumn);}
1910              }
1911           }
1912      break;
1913    default:
1914      jj_la1[54] = jj_gen;
1915      jj_consume_token(-1);
1916      throw new ParseException();
1917    }
1918       TemplateElement result = (positionalArgs != null) ? new UnifiedCall(exp, positionalArgs, nestedBlock, bodyParameters)
1919                                         : new UnifiedCall(exp, namedArgs, nestedBlock, bodyParameters);
1920       result.setLocation(template, start, end);
1921       {if (true) return result;}
1922    throw new Error JavaDoc("Missing return statement in function");
1923  }
1924
1925  final public TemplateElement Call() throws ParseException {
1926   Token start, end, id;
1927   HashMap namedArgs = null;
1928   ArrayList positionalArgs = null;
1929   String JavaDoc macroName= null;
1930    start = jj_consume_token(CALL);
1931    id = jj_consume_token(ID);
1932             macroName = id.image;
1933    if (jj_2_10(2147483647)) {
1934      namedArgs = NamedArgs();
1935    } else {
1936      if (jj_2_9(2147483647)) {
1937        jj_consume_token(OPEN_PAREN);
1938      } else {
1939        ;
1940      }
1941      positionalArgs = PositionalArgs();
1942      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1943      case CLOSE_PAREN:
1944        jj_consume_token(CLOSE_PAREN);
1945        break;
1946      default:
1947        jj_la1[55] = jj_gen;
1948        ;
1949      }
1950    }
1951    end = LooseDirectiveEnd();
1952       UnifiedCall result = null;
1953       if (positionalArgs != null) {
1954          result = new UnifiedCall(new Identifier(macroName), positionalArgs, null, null);
1955       }
1956       else {
1957          result = new UnifiedCall(new Identifier(macroName), namedArgs, null, null);
1958       }
1959       result.legacySyntax = true;
1960       result.setLocation(template, start, end);
1961       {if (true) return result;}
1962    throw new Error JavaDoc("Missing return statement in function");
1963  }
1964
1965  final public HashMap NamedArgs() throws ParseException {
1966    HashMap result = new HashMap();
1967    Token t;
1968    Expression exp;
1969    label_13:
1970    while (true) {
1971      t = jj_consume_token(ID);
1972      jj_consume_token(EQUALS);
1973      exp = Expression();
1974        result.put(t.image, exp);
1975      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1976      case ID:
1977        ;
1978        break;
1979      default:
1980        jj_la1[56] = jj_gen;
1981        break label_13;
1982      }
1983    }
1984     {if (true) return result;}
1985    throw new Error JavaDoc("Missing return statement in function");
1986  }
1987
1988  final public ArrayList PositionalArgs() throws ParseException {
1989  ArrayList result = new ArrayList();
1990  Expression arg;
1991    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
1992    case STRING_LITERAL:
1993    case RAW_STRING:
1994    case FALSE:
1995    case TRUE:
1996    case INTEGER:
1997    case DECIMAL:
1998    case DOT:
1999    case PLUS:
2000    case MINUS:
2001    case NOT:
2002    case OPEN_BRACKET:
2003    case OPEN_PAREN:
2004    case OPEN_BRACE:
2005    case ID:
2006      arg = Expression();
2007                        result.add(arg);
2008      label_14:
2009      while (true) {
2010        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2011        case COMMA:
2012          ;
2013          break;
2014        default:
2015          jj_la1[57] = jj_gen;
2016          break label_14;
2017        }
2018        jj_consume_token(COMMA);
2019        arg = Expression();
2020                           result.add(arg);
2021      }
2022      break;
2023    default:
2024      jj_la1[58] = jj_gen;
2025      ;
2026    }
2027     {if (true) return result;}
2028    throw new Error JavaDoc("Missing return statement in function");
2029  }
2030
2031  final public Comment Comment() throws ParseException {
2032   Token start, end;
2033   StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
2034    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2035    case COMMENT:
2036      start = jj_consume_token(COMMENT);
2037      break;
2038    case TERSE_COMMENT:
2039      start = jj_consume_token(TERSE_COMMENT);
2040      break;
2041    default:
2042      jj_la1[59] = jj_gen;
2043      jj_consume_token(-1);
2044      throw new ParseException();
2045    }
2046    end = UnparsedContent(buf);
2047       Comment result = new Comment(buf.toString());
2048       result.setLocation(template, start, end);
2049       {if (true) return result;}
2050    throw new Error JavaDoc("Missing return statement in function");
2051  }
2052
2053  final public TextBlock NoParse() throws ParseException {
2054   Token start, end;
2055   StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
2056    start = jj_consume_token(NOPARSE);
2057    end = UnparsedContent(buf);
2058        TextBlock result = new TextBlock(buf.toString(), true);
2059        result.setLocation(template, start, end);
2060        {if (true) return result;}
2061    throw new Error JavaDoc("Missing return statement in function");
2062  }
2063
2064  final public TransformBlock Transform() throws ParseException {
2065   Token start, end, argName;
2066   Expression exp, argExp;
2067   TemplateElement content = null;
2068   HashMap args = null;
2069    start = jj_consume_token(TRANSFORM);
2070    exp = Expression();
2071    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2072    case SEMICOLON:
2073      jj_consume_token(SEMICOLON);
2074      break;
2075    default:
2076      jj_la1[60] = jj_gen;
2077      ;
2078    }
2079    label_15:
2080    while (true) {
2081      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2082      case ID:
2083        ;
2084        break;
2085      default:
2086        jj_la1[61] = jj_gen;
2087        break label_15;
2088      }
2089      argName = jj_consume_token(ID);
2090      jj_consume_token(EQUALS);
2091      argExp = Expression();
2092           if (args == null) args = new HashMap();
2093           args.put(argName.image, argExp);
2094    }
2095    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2096    case EMPTY_DIRECTIVE_END:
2097      end = jj_consume_token(EMPTY_DIRECTIVE_END);
2098      break;
2099    case DIRECTIVE_END:
2100      jj_consume_token(DIRECTIVE_END);
2101      content = OptionalBlock();
2102      end = jj_consume_token(END_TRANSFORM);
2103      break;
2104    default:
2105      jj_la1[62] = jj_gen;
2106      jj_consume_token(-1);
2107      throw new ParseException();
2108    }
2109       TransformBlock result = new TransformBlock(exp, args, content);
2110       result.setLocation(template, start, end);
2111       {if (true) return result;}
2112    throw new Error JavaDoc("Missing return statement in function");
2113  }
2114
2115  final public SwitchBlock Switch() throws ParseException {
2116    SwitchBlock switchBlock;
2117    Case caseIns;
2118    Expression switchExp;
2119    Token start, end;
2120    boolean defaultFound = false;
2121    start = jj_consume_token(SWITCH);
2122    switchExp = Expression();
2123    jj_consume_token(DIRECTIVE_END);
2124      ++switchNesting;
2125      switchBlock = new SwitchBlock(switchExp);
2126    label_16:
2127    while (true) {
2128      if (jj_2_11(2)) {
2129        ;
2130      } else {
2131        break label_16;
2132      }
2133      caseIns = Case();
2134        if (caseIns.isDefault) {
2135           if (defaultFound) {
2136                String JavaDoc msg = getErrorStart(start)
2137                            + "\nYou can only have one default case in a switch statement";
2138                {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
2139           }
2140           defaultFound = true;
2141        }
2142        switchBlock.addCase(caseIns);
2143    }
2144    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2145    case WHITESPACE:
2146      jj_consume_token(WHITESPACE);
2147      break;
2148    default:
2149      jj_la1[63] = jj_gen;
2150      ;
2151    }
2152    end = jj_consume_token(END_SWITCH);
2153      --switchNesting;
2154      switchBlock.setLocation(template, start, end);
2155      {if (true) return switchBlock;}
2156    throw new Error JavaDoc("Missing return statement in function");
2157  }
2158
2159  final public Case Case() throws ParseException {
2160    Expression exp = null;
2161    TemplateElement block;
2162    boolean isDefault = false;
2163    Token start;
2164    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2165    case WHITESPACE:
2166      jj_consume_token(WHITESPACE);
2167      break;
2168    default:
2169      jj_la1[64] = jj_gen;
2170      ;
2171    }
2172    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2173    case CASE:
2174      start = jj_consume_token(CASE);
2175      exp = Expression();
2176      jj_consume_token(DIRECTIVE_END);
2177      break;
2178    case DEFAUL:
2179      start = jj_consume_token(DEFAUL);
2180                     isDefault = true;
2181      break;
2182    default:
2183      jj_la1[65] = jj_gen;
2184      jj_consume_token(-1);
2185      throw new ParseException();
2186    }
2187    block = OptionalBlock();
2188       Case result = new Case(exp, block, isDefault);
2189       result.setLocation(template, start, block);
2190       {if (true) return result;}
2191    throw new Error JavaDoc("Missing return statement in function");
2192  }
2193
2194  final public EscapeBlock Escape() throws ParseException {
2195    Token variable, start, end;
2196    Expression escapeExpr;
2197    TemplateElement content;
2198    start = jj_consume_token(ESCAPE);
2199    variable = jj_consume_token(ID);
2200    jj_consume_token(AS);
2201    escapeExpr = Expression();
2202    jj_consume_token(DIRECTIVE_END);
2203        EscapeBlock result = new EscapeBlock(variable.image, escapeExpr, escapedExpression(escapeExpr));
2204        escapes.addFirst(result);
2205    content = OptionalBlock();
2206        result.setContent(content);
2207        escapes.removeFirst();
2208    end = jj_consume_token(END_ESCAPE);
2209       result.setLocation(template, start, end);
2210       {if (true) return result;}
2211    throw new Error JavaDoc("Missing return statement in function");
2212  }
2213
2214  final public NoEscapeBlock NoEscape() throws ParseException {
2215    Token start, end;
2216    TemplateElement content;
2217    start = jj_consume_token(NOESCAPE);
2218        if(escapes.isEmpty()) {
2219                String JavaDoc msg = getErrorStart(start)
2220                                  + "\nnoescape with no matching escape encountered.";
2221            {if (true) throw new ParseException(msg, start.beginLine, start.beginColumn);}
2222        }
2223        Object JavaDoc escape = escapes.removeFirst();
2224    content = OptionalBlock();
2225    end = jj_consume_token(END_NOESCAPE);
2226       escapes.addFirst(escape);
2227       NoEscapeBlock result = new NoEscapeBlock(content);
2228       result.setLocation(template, start, end);
2229       {if (true) return result;}
2230    throw new Error JavaDoc("Missing return statement in function");
2231  }
2232
2233/**
2234 * Production to terminate potentially empty elements. Either a ">" or "/>"
2235 */

2236  final public Token LooseDirectiveEnd() throws ParseException {
2237    Token t;
2238    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2239    case DIRECTIVE_END:
2240      t = jj_consume_token(DIRECTIVE_END);
2241      break;
2242    case EMPTY_DIRECTIVE_END:
2243      t = jj_consume_token(EMPTY_DIRECTIVE_END);
2244      break;
2245    default:
2246      jj_la1[66] = jj_gen;
2247      jj_consume_token(-1);
2248      throw new ParseException();
2249    }
2250      {if (true) return t;}
2251    throw new Error JavaDoc("Missing return statement in function");
2252  }
2253
2254  final public PropertySetting Setting() throws ParseException {
2255   Token start, end, key;
2256   Expression value;
2257    start = jj_consume_token(SETTING);
2258    key = jj_consume_token(ID);
2259    jj_consume_token(EQUALS);
2260    value = Expression();
2261    end = LooseDirectiveEnd();
2262      PropertySetting result = new PropertySetting(key.image, value);
2263      result.setLocation(template, start, end);
2264      {if (true) return result;}
2265    throw new Error JavaDoc("Missing return statement in function");
2266  }
2267
2268/**
2269 * A production for FreeMarker directives.
2270 */

2271  final public TemplateElement FreemarkerDirective() throws ParseException {
2272   TemplateElement tp;
2273    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2274    case IF:
2275      tp = If();
2276      break;
2277    case LIST:
2278      tp = List();
2279      break;
2280    case FOREACH:
2281      tp = ForEach();
2282      break;
2283    case ASSIGN:
2284    case GLOBALASSIGN:
2285    case LOCALASSIGN:
2286      tp = Assign();
2287      break;
2288    case INCLUDE:
2289      tp = Include();
2290      break;
2291    case IMPORT:
2292      tp = Import();
2293      break;
2294    case FUNCTION:
2295    case MACRO:
2296      tp = Macro();
2297      break;
2298    case COMPRESS:
2299      tp = Compress();
2300      break;
2301    case UNIFIED_CALL:
2302      tp = UnifiedMacroTransform();
2303      break;
2304    case CALL:
2305      tp = Call();
2306      break;
2307    case COMMENT:
2308    case TERSE_COMMENT:
2309      tp = Comment();
2310      break;
2311    case NOPARSE:
2312      tp = NoParse();
2313      break;
2314    case TRANSFORM:
2315      tp = Transform();
2316      break;
2317    case SWITCH:
2318      tp = Switch();
2319      break;
2320    case SETTING:
2321      tp = Setting();
2322      break;
2323    case BREAK:
2324      tp = Break();
2325      break;
2326    case RETURN:
2327    case SIMPLE_RETURN:
2328      tp = Return();
2329      break;
2330    case STOP:
2331    case HALT:
2332      tp = Stop();
2333      break;
2334    case FLUSH:
2335      tp = Flush();
2336      break;
2337    case TRIM:
2338    case LTRIM:
2339    case RTRIM:
2340    case NOTRIM:
2341      tp = Trim();
2342      break;
2343    case SIMPLE_NESTED:
2344    case NESTED:
2345      tp = Nested();
2346      break;
2347    case ESCAPE:
2348      tp = Escape();
2349      break;
2350    case NOESCAPE:
2351      tp = NoEscape();
2352      break;
2353    case VISIT:
2354      tp = Visit();
2355      break;
2356    case SIMPLE_RECURSE:
2357    case RECURSE:
2358      tp = Recurse();
2359      break;
2360    case FALLBACK:
2361      tp = FallBack();
2362      break;
2363    case ATTEMPT:
2364      tp = Attempt();
2365      break;
2366    default:
2367      jj_la1[67] = jj_gen;
2368      jj_consume_token(-1);
2369      throw new ParseException();
2370    }
2371      {if (true) return tp;}
2372    throw new Error JavaDoc("Missing return statement in function");
2373  }
2374
2375/**
2376 * Production for a block of raw text
2377 * i.e. text that contains no
2378 * FreeMarker directives.
2379 */

2380  final public TextBlock PCData() throws ParseException {
2381    StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
2382    Token t, start=null;
2383    label_17:
2384    while (true) {
2385      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2386      case WHITESPACE:
2387        t = jj_consume_token(WHITESPACE);
2388        break;
2389      case PRINTABLE_CHARS:
2390        t = jj_consume_token(PRINTABLE_CHARS);
2391        break;
2392      case FALSE_ALERT:
2393        t = jj_consume_token(FALSE_ALERT);
2394        break;
2395      default:
2396        jj_la1[68] = jj_gen;
2397        jj_consume_token(-1);
2398        throw new ParseException();
2399      }
2400         buf.append(t.image);
2401         if (start == null) start = t;
2402      if (jj_2_12(2147483647)) {
2403        ;
2404      } else {
2405        break label_17;
2406      }
2407    }
2408         if (stripText && contentNesting == 1)
2409             {if (true) return TextBlock.EMPTY_BLOCK;}
2410
2411         TextBlock result = new TextBlock(buf.toString(), false);
2412         result.setLocation(template, start, t);
2413         {if (true) return result;}
2414    throw new Error JavaDoc("Missing return statement in function");
2415  }
2416
2417/**
2418 * Production for dealing with unparsed content,
2419 * i.e. what is inside a comment or noparse tag.
2420 * It returns the ending token. The content
2421 * of the tag is put in buf.
2422 */

2423  final public Token UnparsedContent(StringBuffer JavaDoc buf) throws ParseException {
2424   Token t;
2425    label_18:
2426    while (true) {
2427      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2428      case KEEP_GOING:
2429        t = jj_consume_token(KEEP_GOING);
2430        break;
2431      case MAYBE_END:
2432        t = jj_consume_token(MAYBE_END);
2433        break;
2434      case TERSE_COMMENT_END:
2435        t = jj_consume_token(TERSE_COMMENT_END);
2436        break;
2437      case LONE_LESS_THAN_OR_DASH:
2438        t = jj_consume_token(LONE_LESS_THAN_OR_DASH);
2439        break;
2440      default:
2441        jj_la1[69] = jj_gen;
2442        jj_consume_token(-1);
2443        throw new ParseException();
2444      }
2445       buf.append(t.image);
2446      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2447      case TERSE_COMMENT_END:
2448      case MAYBE_END:
2449      case KEEP_GOING:
2450      case LONE_LESS_THAN_OR_DASH:
2451        ;
2452        break;
2453      default:
2454        jj_la1[70] = jj_gen;
2455        break label_18;
2456      }
2457    }
2458      buf.setLength(buf.length() - t.image.length());
2459      {if (true) return t;}
2460    throw new Error JavaDoc("Missing return statement in function");
2461  }
2462
2463  final public TemplateElement Content() throws ParseException {
2464    MixedContent nodes = new MixedContent();
2465    TemplateElement elem, begin=null;
2466    contentNesting++;
2467    label_19:
2468    while (true) {
2469      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2470      case WHITESPACE:
2471      case PRINTABLE_CHARS:
2472      case FALSE_ALERT:
2473        elem = PCData();
2474        break;
2475      case OUTPUT_ESCAPE:
2476        elem = StringOutput();
2477        break;
2478      case NUMERICAL_ESCAPE:
2479        elem = NumericalOutput();
2480        break;
2481      case ATTEMPT:
2482      case IF:
2483      case LIST:
2484      case FOREACH:
2485      case SWITCH:
2486      case ASSIGN:
2487      case GLOBALASSIGN:
2488      case LOCALASSIGN:
2489      case INCLUDE:
2490      case IMPORT:
2491      case FUNCTION:
2492      case MACRO:
2493      case TRANSFORM:
2494      case VISIT:
2495      case STOP:
2496      case RETURN:
2497      case CALL:
2498      case SETTING:
2499      case COMPRESS:
2500      case COMMENT:
2501      case TERSE_COMMENT:
2502      case NOPARSE:
2503      case BREAK:
2504      case SIMPLE_RETURN:
2505      case HALT:
2506      case FLUSH:
2507      case TRIM:
2508      case LTRIM:
2509      case RTRIM:
2510      case NOTRIM:
2511      case SIMPLE_NESTED:
2512      case NESTED:
2513      case SIMPLE_RECURSE:
2514      case RECURSE:
2515      case FALLBACK:
2516      case ESCAPE:
2517      case NOESCAPE:
2518      case UNIFIED_CALL:
2519        elem = FreemarkerDirective();
2520        break;
2521      default:
2522        jj_la1[71] = jj_gen;
2523        jj_consume_token(-1);
2524        throw new ParseException();
2525      }
2526            if (begin == null) {
2527               begin = elem;
2528            }
2529            nodes.addElement(elem);
2530      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2531      case ATTEMPT:
2532      case IF:
2533      case LIST:
2534      case FOREACH:
2535      case SWITCH:
2536      case ASSIGN:
2537      case GLOBALASSIGN:
2538      case LOCALASSIGN:
2539      case INCLUDE:
2540      case IMPORT:
2541      case FUNCTION:
2542      case MACRO:
2543      case TRANSFORM:
2544      case VISIT:
2545      case STOP:
2546      case RETURN:
2547      case CALL:
2548      case SETTING:
2549      case COMPRESS:
2550      case COMMENT:
2551      case TERSE_COMMENT:
2552      case NOPARSE:
2553      case BREAK:
2554      case SIMPLE_RETURN:
2555      case HALT:
2556      case FLUSH:
2557      case TRIM:
2558      case LTRIM:
2559      case RTRIM:
2560      case NOTRIM:
2561      case SIMPLE_NESTED:
2562      case NESTED:
2563      case SIMPLE_RECURSE:
2564      case RECURSE:
2565      case FALLBACK:
2566      case ESCAPE:
2567      case NOESCAPE:
2568      case UNIFIED_CALL:
2569      case WHITESPACE:
2570      case PRINTABLE_CHARS:
2571      case FALSE_ALERT:
2572      case OUTPUT_ESCAPE:
2573      case NUMERICAL_ESCAPE:
2574        ;
2575        break;
2576      default:
2577        jj_la1[72] = jj_gen;
2578        break label_19;
2579      }
2580    }
2581        contentNesting--;
2582        nodes.setLocation(template, begin, elem);
2583        {if (true) return nodes;}
2584    throw new Error JavaDoc("Missing return statement in function");
2585  }
2586
2587/**
2588 * A production freemarker text that may contain
2589 * ${...} and #{...} but no directives.
2590 */

2591  final public TemplateElement FreeMarkerText() throws ParseException {
2592     MixedContent nodes = new MixedContent();
2593     TemplateElement elem, begin = null;
2594    label_20:
2595    while (true) {
2596      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2597      case WHITESPACE:
2598      case PRINTABLE_CHARS:
2599      case FALSE_ALERT:
2600        elem = PCData();
2601        break;
2602      case OUTPUT_ESCAPE:
2603        elem = StringOutput();
2604        break;
2605      case NUMERICAL_ESCAPE:
2606        elem = NumericalOutput();
2607        break;
2608      default:
2609        jj_la1[73] = jj_gen;
2610        jj_consume_token(-1);
2611        throw new ParseException();
2612      }
2613         if (begin == null) {
2614            begin = elem;
2615         }
2616         nodes.addElement(elem);
2617      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2618      case WHITESPACE:
2619      case PRINTABLE_CHARS:
2620      case FALSE_ALERT:
2621      case OUTPUT_ESCAPE:
2622      case NUMERICAL_ESCAPE:
2623        ;
2624        break;
2625      default:
2626        jj_la1[74] = jj_gen;
2627        break label_20;
2628      }
2629    }
2630       nodes.setLocation(template, begin, elem);
2631       {if (true) return nodes;}
2632    throw new Error JavaDoc("Missing return statement in function");
2633  }
2634
2635/**
2636 * A production for a block of optional content.
2637 * Returns an empty Text block if there is no
2638 * content.
2639 */

2640  final public TemplateElement OptionalBlock() throws ParseException {
2641   TemplateElement tp = TextBlock.EMPTY_BLOCK;
2642    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2643    case ATTEMPT:
2644    case IF:
2645    case LIST:
2646    case FOREACH:
2647    case SWITCH:
2648    case ASSIGN:
2649    case GLOBALASSIGN:
2650    case LOCALASSIGN:
2651    case INCLUDE:
2652    case IMPORT:
2653    case FUNCTION:
2654    case MACRO:
2655    case TRANSFORM:
2656    case VISIT:
2657    case STOP:
2658    case RETURN:
2659    case CALL:
2660    case SETTING:
2661    case COMPRESS:
2662    case COMMENT:
2663    case TERSE_COMMENT:
2664    case NOPARSE:
2665    case BREAK:
2666    case SIMPLE_RETURN:
2667    case HALT:
2668    case FLUSH:
2669    case TRIM:
2670    case LTRIM:
2671    case RTRIM:
2672    case NOTRIM:
2673    case SIMPLE_NESTED:
2674    case NESTED:
2675    case SIMPLE_RECURSE:
2676    case RECURSE:
2677    case FALLBACK:
2678    case ESCAPE:
2679    case NOESCAPE:
2680    case UNIFIED_CALL:
2681    case WHITESPACE:
2682    case PRINTABLE_CHARS:
2683    case FALSE_ALERT:
2684    case OUTPUT_ESCAPE:
2685    case NUMERICAL_ESCAPE:
2686      // has no effect but to get rid of a spurious warning.
2687
tp = Content();
2688      break;
2689    default:
2690      jj_la1[75] = jj_gen;
2691      ;
2692    }
2693      {if (true) return tp;}
2694    throw new Error JavaDoc("Missing return statement in function");
2695  }
2696
2697  final public void HeaderElement() throws ParseException {
2698   Token key;
2699   Expression exp = null;
2700    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2701    case WHITESPACE:
2702      jj_consume_token(WHITESPACE);
2703      break;
2704    default:
2705      jj_la1[76] = jj_gen;
2706      ;
2707    }
2708    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2709    case TRIVIAL_FTL_HEADER:
2710      jj_consume_token(TRIVIAL_FTL_HEADER);
2711      break;
2712    case FTL_HEADER:
2713      jj_consume_token(FTL_HEADER);
2714      label_21:
2715      while (true) {
2716        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2717        case ID:
2718          ;
2719          break;
2720        default:
2721          jj_la1[77] = jj_gen;
2722          break label_21;
2723        }
2724        key = jj_consume_token(ID);
2725        jj_consume_token(EQUALS);
2726        exp = Expression();
2727             String JavaDoc ks = key.image;
2728             TemplateModel value = null;
2729             try {
2730                value = exp.getAsTemplateModel(null);
2731             } catch (Exception JavaDoc e) {
2732                {if (true) throw new ParseException("Could not evaluate expression: "
2733                                         + exp.getCanonicalForm() + " "
2734                                         + exp.getStartLocation()
2735                                         + "\nUnderlying cause: " +
2736                                         e.getMessage(), exp);}
2737             }
2738             String JavaDoc vs = null;
2739             if (value instanceof TemplateScalarModel) {
2740                try {
2741                   vs = ((TemplateScalarModel) exp).getAsString();
2742                } catch (TemplateModelException tme) {}
2743             }
2744             if (template != null) {
2745                 if (ks.equalsIgnoreCase("encoding")) {
2746                     if (vs == null) {
2747                        {if (true) throw new ParseException("expecting encoding string here: "
2748                                                 + exp.getStartLocation(), exp);}
2749                     }
2750                     String JavaDoc encoding = template.getEncoding();
2751                     if (encoding != null && !encoding.equals(vs)) {
2752                         {if (true) throw new Template.WrongEncodingException(vs);}
2753                     }
2754                 }
2755                 else if (ks.equalsIgnoreCase("STRIP_WHITESPACE")) {
2756                     this.stripWhitespace = getBoolean(exp);
2757                 }
2758                 else if (ks.equalsIgnoreCase("STRIP_TEXT")) {
2759                     this.stripText = getBoolean(exp);
2760                 }
2761                 else if (ks.equalsIgnoreCase("STRICT_SYNTAX")) {
2762                     this.token_source.strictEscapeSyntax = getBoolean(exp);
2763                 }
2764                 else if (ks.equalsIgnoreCase("ns_prefixes")) {
2765                     if (!(value instanceof TemplateHashModelEx)) {
2766                         {if (true) throw new ParseException("Expecting a hash of prefixes to namespace URI's here. " + exp.getStartLocation(), exp);}
2767                     }
2768                     TemplateHashModelEx prefixMap = (TemplateHashModelEx) value;
2769                     try {
2770                         TemplateCollectionModel keys = prefixMap.keys();
2771                         for (TemplateModelIterator it = keys.iterator(); it.hasNext();) {
2772                             String JavaDoc prefix = ((TemplateScalarModel) it.next()).getAsString();
2773                             TemplateModel valueModel = prefixMap.get(prefix);
2774                             if (!(valueModel instanceof TemplateScalarModel)) {
2775                                 {if (true) throw new ParseException("Non-string value in prefix to namespace hash. " + exp.getStartLocation(), exp);}
2776                             }
2777                             String JavaDoc nsURI = ((TemplateScalarModel) valueModel).getAsString();
2778                             try {
2779                                 template.addPrefixNSMapping(prefix, nsURI);
2780                             } catch (IllegalArgumentException JavaDoc iae) {
2781                                 {if (true) throw new ParseException(iae.getMessage() + " " + exp.getStartLocation(), exp);}
2782                             }
2783                         }
2784                     } catch (TemplateModelException tme) {
2785                     }
2786                 }
2787                 else if (ks.equalsIgnoreCase("attributes")) {
2788                     if (!(value instanceof TemplateHashModelEx)) {
2789                         {if (true) throw new ParseException("Expecting a hash of attribute names to values here. " + exp.getStartLocation(), exp);}
2790                     }
2791                     TemplateHashModelEx attributeMap = (TemplateHashModelEx) value;
2792                     try {
2793                         TemplateCollectionModel keys = attributeMap.keys();
2794                         for (TemplateModelIterator it = keys.iterator(); it.hasNext();) {
2795                             String JavaDoc attName = ((TemplateScalarModel) it.next()).getAsString();
2796                             Object JavaDoc attValue = DeepUnwrap.unwrap(attributeMap.get(attName));
2797                             template.setCustomAttribute(attName, attValue);
2798                         }
2799                     } catch (TemplateModelException tme) {
2800                     }
2801                 }
2802                 else {
2803                     {if (true) throw new ParseException("Unknown FTL header parameter: " + key.image,
2804                                               key.beginLine, key.beginColumn);}
2805                 }
2806             }
2807      }
2808      LooseDirectiveEnd();
2809      break;
2810    default:
2811      jj_la1[78] = jj_gen;
2812      jj_consume_token(-1);
2813      throw new ParseException();
2814    }
2815  }
2816
2817  final public Map ParamList() throws ParseException {
2818   Identifier id;
2819   Expression exp;
2820   Map result = new HashMap();
2821    label_22:
2822    while (true) {
2823      id = Identifier();
2824      jj_consume_token(EQUALS);
2825      exp = Expression();
2826                        result.put(id.toString(), exp);
2827      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2828      case COMMA:
2829        jj_consume_token(COMMA);
2830        break;
2831      default:
2832        jj_la1[79] = jj_gen;
2833        ;
2834      }
2835      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
2836      case ID:
2837        ;
2838        break;
2839      default:
2840        jj_la1[80] = jj_gen;
2841        break label_22;
2842      }
2843    }
2844       {if (true) return result;}
2845    throw new Error JavaDoc("Missing return statement in function");
2846  }
2847
2848/**
2849 * Root production to be used when parsing
2850 * an entire file.
2851 */

2852  final public TemplateElement Root() throws ParseException {
2853   TemplateElement doc;
2854    if (jj_2_13(2147483647)) {
2855      HeaderElement();
2856    } else {
2857      ;
2858    }
2859    doc = OptionalBlock();
2860    jj_consume_token(0);
2861       doc.setParentRecursively(null);
2862       {if (true) return doc.postParseCleanup(stripWhitespace);}
2863    throw new Error JavaDoc("Missing return statement in function");
2864  }
2865
2866  final private boolean jj_2_1(int xla) {
2867    jj_la = xla; jj_lastpos = jj_scanpos = token;
2868    try { return !jj_3_1(); }
2869    catch(LookaheadSuccess ls) { return true; }
2870    finally { jj_save(0, xla); }
2871  }
2872
2873  final private boolean jj_2_2(int xla) {
2874    jj_la = xla; jj_lastpos = jj_scanpos = token;
2875    try { return !jj_3_2(); }
2876    catch(LookaheadSuccess ls) { return true; }
2877    finally { jj_save(1, xla); }
2878  }
2879
2880  final private boolean jj_2_3(int xla) {
2881    jj_la = xla; jj_lastpos = jj_scanpos = token;
2882    try { return !jj_3_3(); }
2883    catch(LookaheadSuccess ls) { return true; }
2884    finally { jj_save(2, xla); }
2885  }
2886
2887  final private boolean jj_2_4(int xla) {
2888    jj_la = xla; jj_lastpos = jj_scanpos = token;
2889    try { return !jj_3_4(); }
2890    catch(LookaheadSuccess ls) { return true; }
2891    finally { jj_save(3, xla); }
2892  }
2893
2894  final private boolean jj_2_5(int xla) {
2895    jj_la = xla; jj_lastpos = jj_scanpos = token;
2896    try { return !jj_3_5(); }
2897    catch(LookaheadSuccess ls) { return true; }
2898    finally { jj_save(4, xla); }
2899  }
2900
2901  final private boolean jj_2_6(int xla) {
2902    jj_la = xla; jj_lastpos = jj_scanpos = token;
2903    try { return !jj_3_6(); }
2904    catch(LookaheadSuccess ls) { return true; }
2905    finally { jj_save(5, xla); }
2906  }
2907
2908  final private boolean jj_2_7(int xla) {
2909    jj_la = xla; jj_lastpos = jj_scanpos = token;
2910    try { return !jj_3_7(); }
2911    catch(LookaheadSuccess ls) { return true; }
2912    finally { jj_save(6, xla); }
2913  }
2914
2915  final private boolean jj_2_8(int xla) {
2916    jj_la = xla; jj_lastpos = jj_scanpos = token;
2917    try { return !jj_3_8(); }
2918    catch(LookaheadSuccess ls) { return true; }
2919    finally { jj_save(7, xla); }
2920  }
2921
2922  final private boolean jj_2_9(int xla) {
2923    jj_la = xla; jj_lastpos = jj_scanpos = token;
2924    try { return !jj_3_9(); }
2925    catch(LookaheadSuccess ls) { return true; }
2926    finally { jj_save(8, xla); }
2927  }
2928
2929  final private boolean jj_2_10(int xla) {
2930    jj_la = xla; jj_lastpos = jj_scanpos = token;
2931    try { return !jj_3_10(); }
2932    catch(LookaheadSuccess ls) { return true; }
2933    finally { jj_save(9, xla); }
2934  }
2935
2936  final private boolean jj_2_11(int xla) {
2937    jj_la = xla; jj_lastpos = jj_scanpos = token;
2938    try { return !jj_3_11(); }
2939    catch(LookaheadSuccess ls) { return true; }
2940    finally { jj_save(10, xla); }
2941  }
2942
2943  final private boolean jj_2_12(int xla) {
2944    jj_la = xla; jj_lastpos = jj_scanpos = token;
2945    try { return !jj_3_12(); }
2946    catch(LookaheadSuccess ls) { return true; }
2947    finally { jj_save(11, xla); }
2948  }
2949
2950  final private boolean jj_2_13(int xla) {
2951    jj_la = xla; jj_lastpos = jj_scanpos = token;
2952    try { return !jj_3_13(); }
2953    catch(LookaheadSuccess ls) { return true; }
2954    finally { jj_save(12, xla); }
2955  }
2956
2957  final private boolean jj_3R_170() {
2958    if (jj_scan_token(COMMA)) return true;
2959    if (jj_3R_23()) return true;
2960    return false;
2961  }
2962
2963  final private boolean jj_3R_23() {
2964    if (jj_3R_25()) return true;
2965    return false;
2966  }
2967
2968  final private boolean jj_3R_165() {
2969    if (jj_3R_23()) return true;
2970    Token xsp;
2971    while (true) {
2972      xsp = jj_scanpos;
2973      if (jj_3R_170()) { jj_scanpos = xsp; break; }
2974    }
2975    return false;
2976  }
2977
2978  final private boolean jj_3R_150() {
2979    if (jj_scan_token(OPEN_BRACKET)) return true;
2980    if (jj_3R_159()) return true;
2981    if (jj_scan_token(CLOSE_BRACKET)) return true;
2982    return false;
2983  }
2984
2985  final private boolean jj_3R_159() {
2986    Token xsp;
2987    xsp = jj_scanpos;
2988    if (jj_3R_165()) jj_scanpos = xsp;
2989    return false;
2990  }
2991
2992  final private boolean jj_3R_43() {
2993    if (jj_3R_49()) return true;
2994    return false;
2995  }
2996
2997  final private boolean jj_3R_128() {
2998    if (jj_scan_token(NOTRIM)) return true;
2999    return false;
3000  }
3001
3002  final private boolean jj_3R_42() {
3003    if (jj_3R_48()) return true;
3004    return false;
3005  }
3006
3007  final private boolean jj_3R_127() {
3008    if (jj_scan_token(RTRIM)) return true;
3009    return false;
3010  }
3011
3012  final private boolean jj_3R_41() {
3013    if (jj_3R_47()) return true;
3014    return false;
3015  }
3016
3017  final private boolean jj_3R_126() {
3018    if (jj_scan_token(LTRIM)) return true;
3019    return false;
3020  }
3021
3022  final private boolean jj_3R_40() {
3023    if (jj_3R_46()) return true;
3024    return false;
3025  }
3026
3027  final private boolean jj_3_6() {
3028    if (jj_scan_token(OR)) return true;
3029    return false;
3030  }
3031
3032  final private boolean jj_3R_125() {
3033    if (jj_scan_token(TRIM)) return true;
3034    return false;
3035  }
3036
3037  final private boolean jj_3R_104() {
3038    Token xsp;
3039    xsp = jj_scanpos;
3040    if (jj_3R_125()) {
3041    jj_scanpos = xsp;
3042    if (jj_3R_126()) {
3043    jj_scanpos = xsp;
3044    if (jj_3R_127()) {
3045    jj_scanpos = xsp;
3046    if (jj_3R_128()) return true;
3047    }
3048    }
3049    }
3050    return false;
3051  }
3052
3053  final private boolean jj_3R_37() {
3054    Token xsp;
3055    xsp = jj_scanpos;
3056    if (jj_3R_40()) {
3057    jj_scanpos = xsp;
3058    if (jj_3R_41()) {
3059    jj_scanpos = xsp;
3060    if (jj_3R_42()) {
3061    jj_scanpos = xsp;
3062    if (jj_3R_43()) return true;
3063    }
3064    }
3065    }
3066    return false;
3067  }
3068
3069  final private boolean jj_3R_34() {
3070    Token xsp;
3071    if (jj_3R_37()) return true;
3072    while (true) {
3073      xsp = jj_scanpos;
3074      if (jj_3R_37()) { jj_scanpos = xsp; break; }
3075    }
3076    return false;
3077  }
3078
3079  final private boolean jj_3R_30() {
3080    if (jj_scan_token(OR)) return true;
3081    if (jj_3R_29()) return true;
3082    return false;
3083  }
3084
3085  final private boolean jj_3R_25() {
3086    if (jj_3R_29()) return true;
3087    Token xsp;
3088    while (true) {
3089      xsp = jj_scanpos;
3090      if (jj_3R_30()) { jj_scanpos = xsp; break; }
3091    }
3092    return false;
3093  }
3094
3095  final private boolean jj_3R_103() {
3096    if (jj_scan_token(FLUSH)) return true;
3097    return false;
3098  }
3099
3100  final private boolean jj_3_9() {
3101    if (jj_scan_token(OPEN_PAREN)) return true;
3102    return false;
3103  }
3104
3105  final private boolean jj_3_5() {
3106    if (jj_scan_token(AND)) return true;
3107    return false;
3108  }
3109
3110  final private boolean jj_3_10() {
3111    if (jj_scan_token(ID)) return true;
3112    if (jj_scan_token(EQUALS)) return true;
3113    return false;
3114  }
3115
3116  final private boolean jj_3R_33() {
3117    if (jj_scan_token(AND)) return true;
3118    if (jj_3R_32()) return true;
3119    return false;
3120  }
3121
3122  final private boolean jj_3R_29() {
3123    if (jj_3R_32()) return true;
3124    Token xsp;
3125    while (true) {
3126      xsp = jj_scanpos;
3127      if (jj_3R_33()) { jj_scanpos = xsp; break; }
3128    }
3129    return false;
3130  }
3131
3132  final private boolean jj_3R_130() {
3133    if (jj_scan_token(NESTED)) return true;
3134    return false;
3135  }
3136
3137  final private boolean jj_3R_48() {
3138    if (jj_scan_token(NUMERICAL_ESCAPE)) return true;
3139    return false;
3140  }
3141
3142  final private boolean jj_3R_94() {
3143    if (jj_scan_token(CALL)) return true;
3144    return false;
3145  }
3146
3147  final private boolean jj_3_12() {
3148    Token xsp;
3149    xsp = jj_scanpos;
3150    if (jj_scan_token(68)) {
3151    jj_scanpos = xsp;
3152    if (jj_scan_token(69)) {
3153    jj_scanpos = xsp;
3154    if (jj_scan_token(70)) return true;
3155    }
3156    }
3157    return false;
3158  }
3159
3160  final private boolean jj_3R_129() {
3161    if (jj_scan_token(SIMPLE_NESTED)) return true;
3162    return false;
3163  }
3164
3165  final private boolean jj_3_4() {
3166    if (jj_3R_23()) return true;
3167    return false;
3168  }
3169
3170  final private boolean jj_3R_105() {
3171    Token xsp;
3172    xsp = jj_scanpos;
3173    if (jj_3R_129()) {
3174    jj_scanpos = xsp;
3175    if (jj_3R_130()) return true;
3176    }
3177    return false;
3178  }
3179
3180  final private boolean jj_3R_53() {
3181    Token xsp;
3182    xsp = jj_scanpos;
3183    if (jj_scan_token(68)) {
3184    jj_scanpos = xsp;
3185    if (jj_scan_token(69)) {
3186    jj_scanpos = xsp;
3187    if (jj_scan_token(70)) return true;
3188    }
3189    }
3190    return false;
3191  }
3192
3193  final private boolean jj_3R_46() {
3194    Token xsp;
3195    if (jj_3R_53()) return true;
3196    while (true) {
3197      xsp = jj_scanpos;
3198      if (jj_3R_53()) { jj_scanpos = xsp; break; }
3199    }
3200    return false;
3201  }
3202
3203  final private boolean jj_3R_52() {
3204    if (jj_3R_44()) return true;
3205    return false;
3206  }
3207
3208  final private boolean jj_3R_47() {
3209    if (jj_scan_token(OUTPUT_ESCAPE)) return true;
3210    return false;
3211  }
3212
3213  final private boolean jj_3R_45() {
3214    if (jj_scan_token(DOT_DOT)) return true;
3215    Token xsp;
3216    xsp = jj_scanpos;
3217    if (jj_3R_52()) jj_scanpos = xsp;
3218    return false;
3219  }
3220
3221  final private boolean jj_3R_124() {
3222    if (jj_scan_token(STOP)) return true;
3223    return false;
3224  }
3225
3226  final private boolean jj_3R_38() {
3227    if (jj_3R_44()) return true;
3228    Token xsp;
3229    xsp = jj_scanpos;
3230    if (jj_3R_45()) jj_scanpos = xsp;
3231    return false;
3232  }
3233
3234  final private boolean jj_3R_102() {
3235    Token xsp;
3236    xsp = jj_scanpos;
3237    if (jj_scan_token(47)) {
3238    jj_scanpos = xsp;
3239    if (jj_3R_124()) return true;
3240    }
3241    return false;
3242  }
3243
3244  final private boolean jj_3R_80() {
3245    if (jj_3R_111()) return true;
3246    return false;
3247  }
3248
3249  final private boolean jj_3R_79() {
3250    if (jj_3R_110()) return true;
3251    return false;
3252  }
3253
3254  final private boolean jj_3R_78() {
3255    if (jj_3R_109()) return true;
3256    return false;
3257  }
3258
3259  final private boolean jj_3R_77() {
3260    if (jj_3R_108()) return true;
3261    return false;
3262  }
3263
3264  final private boolean jj_3_8() {
3265    if (jj_scan_token(ID)) return true;
3266    if (jj_scan_token(EQUALS)) return true;
3267    return false;
3268  }
3269
3270  final private boolean jj_3R_76() {
3271    if (jj_3R_107()) return true;
3272    return false;
3273  }
3274
3275  final private boolean jj_3R_164() {
3276    if (jj_scan_token(COMMA)) return true;
3277    if (jj_3R_23()) return true;
3278    Token xsp;
3279    xsp = jj_scanpos;
3280    if (jj_scan_token(106)) {
3281    jj_scanpos = xsp;
3282    if (jj_scan_token(108)) return true;
3283    }
3284    if (jj_3R_23()) return true;
3285    return false;
3286  }
3287
3288  final private boolean jj_3R_75() {
3289    if (jj_3R_106()) return true;
3290    return false;
3291  }
3292
3293  final private boolean jj_3R_74() {
3294    if (jj_3R_105()) return true;
3295    return false;
3296  }
3297
3298  final private boolean jj_3R_73() {
3299    if (jj_3R_104()) return true;
3300    return false;
3301  }
3302
3303  final private boolean jj_3R_72() {
3304    if (jj_3R_103()) return true;
3305    return false;
3306  }
3307
3308  final private boolean jj_3R_71() {
3309    if (jj_3R_102()) return true;
3310    return false;
3311  }
3312
3313  final private boolean jj_3R_70() {
3314    if (jj_3R_101()) return true;
3315    return false;
3316  }
3317
3318  final private boolean jj_3R_155() {
3319    if (jj_3R_23()) return true;
3320    Token xsp;
3321    xsp = jj_scanpos;
3322    if (jj_scan_token(106)) {
3323    jj_scanpos = xsp;
3324    if (jj_scan_token(108)) return true;
3325    }
3326    if (jj_3R_23()) return true;
3327    while (true) {
3328      xsp = jj_scanpos;
3329      if (jj_3R_164()) { jj_scanpos = xsp; break; }
3330    }
3331    return false;
3332  }
3333
3334  final private boolean jj_3R_69() {
3335    if (jj_3R_100()) return true;
3336    return false;
3337  }
3338
3339  final private boolean jj_3R_68() {
3340    if (jj_3R_99()) return true;
3341    return false;
3342  }
3343
3344  final private boolean jj_3R_67() {
3345    if (jj_3R_98()) return true;
3346    return false;
3347  }
3348
3349  final private boolean jj_3R_39() {
3350    Token xsp;
3351    xsp = jj_scanpos;
3352    if (jj_scan_token(124)) {
3353    jj_scanpos = xsp;
3354    if (jj_scan_token(95)) {
3355    jj_scanpos = xsp;
3356    if (jj_scan_token(123)) {
3357    jj_scanpos = xsp;
3358    if (jj_scan_token(94)) {
3359    jj_scanpos = xsp;
3360    if (jj_scan_token(93)) {
3361    jj_scanpos = xsp;
3362    if (jj_scan_token(92)) return true;
3363    }
3364    }
3365    }
3366    }
3367    }
3368    if (jj_3R_38()) return true;
3369    return false;
3370  }
3371
3372  final private boolean jj_3R_147() {
3373    if (jj_scan_token(OPEN_BRACE)) return true;
3374    Token xsp;
3375    xsp = jj_scanpos;
3376    if (jj_3R_155()) jj_scanpos = xsp;
3377    if (jj_scan_token(CLOSE_BRACE)) return true;
3378    return false;
3379  }
3380
3381  final private boolean jj_3R_123() {
3382    if (jj_scan_token(RETURN)) return true;
3383    return false;
3384  }
3385
3386  final private boolean jj_3R_66() {
3387    if (jj_3R_97()) return true;
3388    return false;
3389  }
3390
3391  final private boolean jj_3R_93() {
3392    if (jj_scan_token(UNIFIED_CALL)) return true;
3393    return false;
3394  }
3395
3396  final private boolean jj_3R_122() {
3397    if (jj_scan_token(SIMPLE_RETURN)) return true;
3398    return false;
3399  }
3400
3401  final private boolean jj_3R_65() {
3402    if (jj_3R_96()) return true;
3403    return false;
3404  }
3405
3406  final private boolean jj_3R_35() {
3407    if (jj_3R_38()) return true;
3408    Token xsp;
3409    xsp = jj_scanpos;
3410    if (jj_3R_39()) jj_scanpos = xsp;
3411    return false;
3412  }
3413
3414  final private boolean jj_3R_64() {
3415    if (jj_3R_95()) return true;
3416    return false;
3417  }
3418
3419  final private boolean jj_3R_101() {
3420    Token xsp;
3421    xsp = jj_scanpos;
3422    if (jj_3R_122()) {
3423    jj_scanpos = xsp;
3424    if (jj_3R_123()) return true;
3425    }
3426    return false;
3427  }
3428
3429  final private boolean jj_3R_63() {
3430    if (jj_3R_94()) return true;
3431    return false;
3432  }
3433
3434  final private boolean jj_3R_62() {
3435    if (jj_3R_93()) return true;
3436    return false;
3437  }
3438
3439  final private boolean jj_3R_61() {
3440    if (jj_3R_92()) return true;
3441    return false;
3442  }
3443
3444  final private boolean jj_3R_60() {
3445    if (jj_3R_91()) return true;
3446    return false;
3447  }
3448
3449  final private boolean jj_3R_158() {
3450    if (jj_scan_token(TRUE)) return true;
3451    return false;
3452  }
3453
3454  final private boolean jj_3R_59() {
3455    if (jj_3R_90()) return true;
3456    return false;
3457  }
3458
3459  final private boolean jj_3R_157() {
3460    if (jj_scan_token(FALSE)) return true;
3461    return false;
3462  }
3463
3464  final private boolean jj_3R_58() {
3465    if (jj_3R_89()) return true;
3466    return false;
3467  }
3468
3469  final private boolean jj_3R_57() {
3470    if (jj_3R_88()) return true;
3471    return false;
3472  }
3473
3474  final private boolean jj_3R_149() {
3475    Token xsp;
3476    xsp = jj_scanpos;
3477    if (jj_3R_157()) {
3478    jj_scanpos = xsp;
3479    if (jj_3R_158()) return true;
3480    }
3481    return false;
3482  }
3483
3484  final private boolean jj_3R_56() {
3485    if (jj_3R_87()) return true;
3486    return false;
3487  }
3488
3489  final private boolean jj_3R_92() {
3490    if (jj_scan_token(COMPRESS)) return true;
3491    return false;
3492  }
3493
3494  final private boolean jj_3R_55() {
3495    if (jj_3R_86()) return true;
3496    return false;
3497  }
3498
3499  final private boolean jj_3R_54() {
3500    if (jj_3R_85()) return true;
3501    return false;
3502  }
3503
3504  final private boolean jj_3R_49() {
3505    Token xsp;
3506    xsp = jj_scanpos;
3507    if (jj_3R_54()) {
3508    jj_scanpos = xsp;
3509    if (jj_3R_55()) {
3510    jj_scanpos = xsp;
3511    if (jj_3R_56()) {
3512    jj_scanpos = xsp;
3513    if (jj_3R_57()) {
3514    jj_scanpos = xsp;
3515    if (jj_3R_58()) {
3516    jj_scanpos = xsp;
3517    if (jj_3R_59()) {
3518    jj_scanpos = xsp;
3519    if (jj_3R_60()) {
3520    jj_scanpos = xsp;
3521    if (jj_3R_61()) {
3522    jj_scanpos = xsp;
3523    if (jj_3R_62()) {
3524    jj_scanpos = xsp;
3525    if (jj_3R_63()) {
3526    jj_scanpos = xsp;
3527    if (jj_3R_64()) {
3528    jj_scanpos = xsp;
3529    if (jj_3R_65()) {
3530    jj_scanpos = xsp;
3531    if (jj_3R_66()) {
3532    jj_scanpos = xsp;
3533    if (jj_3R_67()) {
3534    jj_scanpos = xsp;
3535    if (jj_3R_68()) {
3536    jj_scanpos = xsp;
3537    if (jj_3R_69()) {
3538    jj_scanpos = xsp;
3539    if (jj_3R_70()) {
3540    jj_scanpos = xsp;
3541    if (jj_3R_71()) {
3542    jj_scanpos = xsp;
3543    if (jj_3R_72()) {
3544    jj_scanpos = xsp;
3545    if (jj_3R_73()) {
3546    jj_scanpos = xsp;
3547    if (jj_3R_74()) {
3548    jj_scanpos = xsp;
3549    if (jj_3R_75()) {
3550    jj_scanpos = xsp;
3551    if (jj_3R_76()) {
3552    jj_scanpos = xsp;
3553    if (jj_3R_77()) {
3554    jj_scanpos = xsp;
3555    if (jj_3R_78()) {
3556    jj_scanpos = xsp;
3557    if (jj_3R_79()) {
3558    jj_scanpos = xsp;
3559    if (jj_3R_80()) return true;
3560    }
3561    }
3562    }
3563    }
3564    }
3565    }
3566    }
3567    }
3568    }
3569    }
3570    }
3571    }
3572    }
3573    }
3574    }
3575    }
3576    }
3577    }
3578    }
3579    }
3580    }
3581    }
3582    }
3583    }
3584    }
3585    }
3586    return false;
3587  }
3588
3589  final private boolean jj_3R_36() {
3590    Token xsp;
3591    xsp = jj_scanpos;
3592    if (jj_scan_token(91)) {
3593    jj_scanpos = xsp;
3594    if (jj_scan_token(89)) {
3595    jj_scanpos = xsp;
3596    if (jj_scan_token(90)) return true;
3597    }
3598    }
3599    if (jj_3R_35()) return true;
3600    return false;
3601  }
3602
3603  final private boolean jj_3R_100() {
3604    if (jj_scan_token(BREAK)) return true;
3605    return false;
3606  }
3607
3608  final private boolean jj_3R_32() {
3609    if (jj_3R_35()) return true;
3610    Token xsp;
3611    xsp = jj_scanpos;
3612    if (jj_3R_36()) jj_scanpos = xsp;
3613    return false;
3614  }
3615
3616  final private boolean jj_3R_99() {
3617    if (jj_scan_token(SETTING)) return true;
3618    return false;
3619  }
3620
3621  final private boolean jj_3R_156() {
3622    if (jj_scan_token(RAW_STRING)) return true;
3623    return false;
3624  }
3625
3626  final private boolean jj_3_3() {
3627    Token xsp;
3628    xsp = jj_scanpos;
3629    if (jj_scan_token(98)) {
3630    jj_scanpos = xsp;
3631    if (jj_scan_token(101)) {
3632    jj_scanpos = xsp;
3633    if (jj_scan_token(102)) return true;
3634    }
3635    }
3636    return false;
3637  }
3638
3639  final private boolean jj_3R_117() {
3640    if (jj_scan_token(PERCENT)) return true;
3641    return false;
3642  }
3643
3644  final private boolean jj_3R_116() {
3645    if (jj_scan_token(DIVIDE)) return true;
3646    return false;
3647  }
3648
3649  final private boolean jj_3R_148() {
3650    Token xsp;
3651    xsp = jj_scanpos;
3652    if (jj_scan_token(80)) {
3653    jj_scanpos = xsp;
3654    if (jj_3R_156()) return true;
3655    }
3656    return false;
3657  }
3658
3659  final private boolean jj_3R_110() {
3660    if (jj_scan_token(FALLBACK)) return true;
3661    return false;
3662  }
3663
3664  final private boolean jj_3R_115() {
3665    if (jj_scan_token(TIMES)) return true;
3666    return false;
3667  }
3668
3669  final private boolean jj_3R_82() {
3670    Token xsp;
3671    xsp = jj_scanpos;
3672    if (jj_3R_115()) {
3673    jj_scanpos = xsp;
3674    if (jj_3R_116()) {
3675    jj_scanpos = xsp;
3676    if (jj_3R_117()) return true;
3677    }
3678    }
3679    if (jj_3R_81()) return true;
3680    return false;
3681  }
3682
3683  final private boolean jj_3_13() {
3684    Token xsp;
3685    xsp = jj_scanpos;
3686    if (jj_scan_token(68)) jj_scanpos = xsp;
3687    xsp = jj_scanpos;
3688    if (jj_scan_token(66)) {
3689    jj_scanpos = xsp;
3690    if (jj_scan_token(65)) return true;
3691    }
3692    return false;
3693  }
3694
3695  final private boolean jj_3R_50() {
3696    if (jj_3R_81()) return true;
3697    Token xsp;
3698    while (true) {
3699      xsp = jj_scanpos;
3700      if (jj_3R_82()) { jj_scanpos = xsp; break; }
3701    }
3702    return false;
3703  }
3704
3705  final private boolean jj_3R_168() {
3706    if (jj_scan_token(OPEN_PAREN)) return true;
3707    if (jj_3R_159()) return true;
3708    if (jj_scan_token(CLOSE_PAREN)) return true;
3709    return false;
3710  }
3711
3712  final private boolean jj_3R_131() {
3713    if (jj_scan_token(RECURSE)) return true;
3714    return false;
3715  }
3716
3717  final private boolean jj_3R_109() {
3718    Token xsp;
3719    xsp = jj_scanpos;
3720    if (jj_scan_token(56)) {
3721    jj_scanpos = xsp;
3722    if (jj_3R_131()) return true;
3723    }
3724    return false;
3725  }
3726
3727  final private boolean jj_3R_107() {
3728    if (jj_scan_token(NOESCAPE)) return true;
3729    return false;
3730  }
3731
3732  final private boolean jj_3R_167() {
3733    if (jj_scan_token(OPEN_BRACKET)) return true;
3734    if (jj_3R_23()) return true;
3735    if (jj_scan_token(CLOSE_BRACKET)) return true;
3736    return false;
3737  }
3738
3739  final private boolean jj_3_2() {
3740    Token xsp;
3741    xsp = jj_scanpos;
3742    if (jj_scan_token(96)) {
3743    jj_scanpos = xsp;
3744    if (jj_scan_token(97)) return true;
3745    }
3746    return false;
3747  }
3748
3749  final private boolean jj_3R_121() {
3750    if (jj_scan_token(FUNCTION)) return true;
3751    return false;
3752  }
3753
3754  final private boolean jj_3R_84() {
3755    if (jj_scan_token(MINUS)) return true;
3756    return false;
3757  }
3758
3759  final private boolean jj_3R_83() {
3760    if (jj_scan_token(PLUS)) return true;
3761    return false;
3762  }
3763
3764  final private boolean jj_3R_91() {
3765    Token xsp;
3766    xsp = jj_scanpos;
3767    if (jj_scan_token(20)) {
3768    jj_scanpos = xsp;
3769    if (jj_3R_121()) return true;
3770    }
3771    return false;
3772  }
3773
3774  final private boolean jj_3R_108() {
3775    if (jj_scan_token(VISIT)) return true;
3776    return false;
3777  }
3778
3779  final private boolean jj_3R_51() {
3780    Token xsp;
3781    xsp = jj_scanpos;
3782    if (jj_3R_83()) {
3783    jj_scanpos = xsp;
3784    if (jj_3R_84()) return true;
3785    }
3786    if (jj_3R_50()) return true;
3787    return false;
3788  }
3789
3790  final private boolean jj_3R_44() {
3791    if (jj_3R_50()) return true;
3792    Token xsp;
3793    while (true) {
3794      xsp = jj_scanpos;
3795      if (jj_3R_51()) { jj_scanpos = xsp; break; }
3796    }
3797    return false;
3798  }
3799
3800  final private boolean jj_3R_106() {
3801    if (jj_scan_token(ESCAPE)) return true;
3802    return false;
3803  }
3804
3805  final private boolean jj_3R_135() {
3806    if (jj_scan_token(MINUS)) return true;
3807    return false;
3808  }
3809
3810  final private boolean jj_3R_171() {
3811    Token xsp;
3812    xsp = jj_scanpos;
3813    if (jj_scan_token(92)) {
3814    jj_scanpos = xsp;
3815    if (jj_scan_token(93)) {
3816    jj_scanpos = xsp;
3817    if (jj_scan_token(94)) {
3818    jj_scanpos = xsp;
3819    if (jj_scan_token(95)) {
3820    jj_scanpos = xsp;
3821    if (jj_scan_token(82)) {
3822    jj_scanpos = xsp;
3823    if (jj_scan_token(83)) {
3824    jj_scanpos = xsp;
3825    if (jj_scan_token(115)) {
3826    jj_scanpos = xsp;
3827    if (jj_scan_token(116)) {
3828    jj_scanpos = xsp;
3829    if (jj_scan_token(117)) return true;
3830    }
3831    }
3832    }
3833    }
3834    }
3835    }
3836    }
3837    }
3838    return false;
3839  }
3840
3841  final private boolean jj_3R_87() {
3842    if (jj_scan_token(FOREACH)) return true;
3843    return false;
3844  }
3845
3846  final private boolean jj_3R_132() {
3847    Token xsp;
3848    xsp = jj_scanpos;
3849    if (jj_scan_token(96)) {
3850    jj_scanpos = xsp;
3851    if (jj_3R_135()) return true;
3852    }
3853    if (jj_3R_134()) return true;
3854    return false;
3855  }
3856
3857  final private boolean jj_3R_90() {
3858    if (jj_scan_token(IMPORT)) return true;
3859    return false;
3860  }
3861
3862  final private boolean jj_3R_27() {
3863    if (jj_scan_token(DEFAUL)) return true;
3864    return false;
3865  }
3866
3867  final private boolean jj_3R_166() {
3868    if (jj_scan_token(DOT)) return true;
3869    Token xsp;
3870    xsp = jj_scanpos;
3871    if (jj_scan_token(118)) {
3872    jj_scanpos = xsp;
3873    if (jj_scan_token(98)) {
3874    jj_scanpos = xsp;
3875    if (jj_scan_token(99)) {
3876    jj_scanpos = xsp;
3877    if (jj_3R_171()) return true;
3878    }
3879    }
3880    }
3881    return false;
3882  }
3883
3884  final private boolean jj_3R_26() {
3885    if (jj_scan_token(CASE)) return true;
3886    if (jj_3R_23()) return true;
3887    return false;
3888  }
3889
3890  final private boolean jj_3R_24() {
3891    Token xsp;
3892    xsp = jj_scanpos;
3893    if (jj_scan_token(68)) jj_scanpos = xsp;
3894    xsp = jj_scanpos;
3895    if (jj_3R_26()) {
3896    jj_scanpos = xsp;
3897    if (jj_3R_27()) return true;
3898    }
3899    if (jj_3R_28()) return true;
3900    return false;
3901  }
3902
3903  final private boolean jj_3R_136() {
3904    if (jj_scan_token(NOT)) return true;
3905    return false;
3906  }
3907
3908  final private boolean jj_3R_133() {
3909    Token xsp;
3910    if (jj_3R_136()) return true;
3911    while (true) {
3912      xsp = jj_scanpos;
3913      if (jj_3R_136()) { jj_scanpos = xsp; break; }
3914    }
3915    if (jj_3R_134()) return true;
3916    return false;
3917  }
3918
3919  final private boolean jj_3R_86() {
3920    if (jj_scan_token(LIST)) return true;
3921    return false;
3922  }
3923
3924  final private boolean jj_3R_169() {
3925    if (jj_scan_token(BUILT_IN)) return true;
3926    if (jj_scan_token(ID)) return true;
3927    return false;
3928  }
3929
3930  final private boolean jj_3R_89() {
3931    if (jj_scan_token(INCLUDE)) return true;
3932    return false;
3933  }
3934
3935  final private boolean jj_3_11() {
3936    if (jj_3R_24()) return true;
3937    return false;
3938  }
3939
3940  final private boolean jj_3R_163() {
3941    if (jj_3R_169()) return true;
3942    return false;
3943  }
3944
3945  final private boolean jj_3R_162() {
3946    if (jj_3R_168()) return true;
3947    return false;
3948  }
3949
3950  final private boolean jj_3R_161() {
3951    if (jj_3R_167()) return true;
3952    return false;
3953  }
3954
3955  final private boolean jj_3R_160() {
3956    if (jj_3R_166()) return true;
3957    return false;
3958  }
3959
3960  final private boolean jj_3R_154() {
3961    Token xsp;
3962    xsp = jj_scanpos;
3963    if (jj_3R_160()) {
3964    jj_scanpos = xsp;
3965    if (jj_3R_161()) {
3966    jj_scanpos = xsp;
3967    if (jj_3R_162()) {
3968    jj_scanpos = xsp;
3969    if (jj_3R_163()) return true;
3970    }
3971    }
3972    }
3973    return false;
3974  }
3975
3976  final private boolean jj_3R_98() {
3977    if (jj_scan_token(SWITCH)) return true;
3978    return false;
3979  }
3980
3981  final private boolean jj_3R_114() {
3982    if (jj_3R_134()) return true;
3983    return false;
3984  }
3985
3986  final private boolean jj_3R_113() {
3987    if (jj_3R_133()) return true;
3988    return false;
3989  }
3990
3991  final private boolean jj_3R_112() {
3992    if (jj_3R_132()) return true;
3993    return false;
3994  }
3995
3996  final private boolean jj_3R_111() {
3997    if (jj_scan_token(ATTEMPT)) return true;
3998    return false;
3999  }
4000
4001  final private boolean jj_3R_81() {
4002    Token xsp;
4003    xsp = jj_scanpos;
4004    if (jj_3R_112()) {
4005    jj_scanpos = xsp;
4006    if (jj_3R_113()) {
4007    jj_scanpos = xsp;
4008    if (jj_3R_114()) return true;
4009    }
4010    }
4011    return false;
4012  }
4013
4014  final private boolean jj_3R_153() {
4015    if (jj_scan_token(DOT)) return true;
4016    if (jj_scan_token(ID)) return true;
4017    return false;
4018  }
4019
4020  final private boolean jj_3_7() {
4021    Token xsp;
4022    xsp = jj_scanpos;
4023    if (jj_scan_token(106)) jj_scanpos = xsp;
4024    xsp = jj_scanpos;
4025    if (jj_scan_token(118)) {
4026    jj_scanpos = xsp;
4027    if (jj_scan_token(80)) return true;
4028    }
4029    if (jj_scan_token(EQUALS)) return true;
4030    return false;
4031  }
4032
4033  final private boolean jj_3R_152() {
4034    if (jj_scan_token(OPEN_PAREN)) return true;
4035    if (jj_3R_23()) return true;
4036    if (jj_scan_token(CLOSE_PAREN)) return true;
4037    return false;
4038  }
4039
4040  final private boolean jj_3R_97() {
4041    if (jj_scan_token(TRANSFORM)) return true;
4042    return false;
4043  }
4044
4045  final private boolean jj_3R_31() {
4046    if (jj_3R_34()) return true;
4047    return false;
4048  }
4049
4050  final private boolean jj_3_1() {
4051    Token xsp;
4052    xsp = jj_scanpos;
4053    if (jj_scan_token(86)) {
4054    jj_scanpos = xsp;
4055    if (jj_scan_token(109)) {
4056    jj_scanpos = xsp;
4057    if (jj_scan_token(111)) {
4058    jj_scanpos = xsp;
4059    if (jj_scan_token(88)) return true;
4060    }
4061    }
4062    }
4063    return false;
4064  }
4065
4066  final private boolean jj_3R_28() {
4067    Token xsp;
4068    xsp = jj_scanpos;
4069    if (jj_3R_31()) jj_scanpos = xsp;
4070    return false;
4071  }
4072
4073  final private boolean jj_3R_145() {
4074    if (jj_3R_154()) return true;
4075    return false;
4076  }
4077
4078  final private boolean jj_3R_144() {
4079    if (jj_3R_153()) return true;
4080    return false;
4081  }
4082
4083  final private boolean jj_3R_96() {
4084    if (jj_scan_token(NOPARSE)) return true;
4085    return false;
4086  }
4087
4088  final private boolean jj_3R_143() {
4089    if (jj_3R_152()) return true;
4090    return false;
4091  }
4092
4093  final private boolean jj_3R_85() {
4094    if (jj_scan_token(IF)) return true;
4095    return false;
4096  }
4097
4098  final private boolean jj_3R_142() {
4099    if (jj_3R_151()) return true;
4100    return false;
4101  }
4102
4103  final private boolean jj_3R_151() {
4104    if (jj_scan_token(ID)) return true;
4105    return false;
4106  }
4107
4108  final private boolean jj_3R_141() {
4109    if (jj_3R_150()) return true;
4110    return false;
4111  }
4112
4113  final private boolean jj_3R_140() {
4114    if (jj_3R_149()) return true;
4115    return false;
4116  }
4117
4118  final private boolean jj_3R_139() {
4119    if (jj_3R_148()) return true;
4120    return false;
4121  }
4122
4123  final private boolean jj_3R_138() {
4124    if (jj_3R_147()) return true;
4125    return false;
4126  }
4127
4128  final private boolean jj_3R_137() {
4129    if (jj_3R_146()) return true;
4130    return false;
4131  }
4132
4133  final private boolean jj_3R_120() {
4134    if (jj_scan_token(LOCALASSIGN)) return true;
4135    return false;
4136  }
4137
4138  final private boolean jj_3R_134() {
4139    Token xsp;
4140    xsp = jj_scanpos;
4141    if (jj_3R_137()) {
4142    jj_scanpos = xsp;
4143    if (jj_3R_138()) {
4144    jj_scanpos = xsp;
4145    if (jj_3R_139()) {
4146    jj_scanpos = xsp;
4147    if (jj_3R_140()) {
4148    jj_scanpos = xsp;
4149    if (jj_3R_141()) {
4150    jj_scanpos = xsp;
4151    if (jj_3R_142()) {
4152    jj_scanpos = xsp;
4153    if (jj_3R_143()) {
4154    jj_scanpos = xsp;
4155    if (jj_3R_144()) return true;
4156    }
4157    }
4158    }
4159    }
4160    }
4161    }
4162    }
4163    while (true) {
4164      xsp = jj_scanpos;
4165      if (jj_3R_145()) { jj_scanpos = xsp; break; }
4166    }
4167    return false;
4168  }
4169
4170  final private boolean jj_3R_119() {
4171    if (jj_scan_token(GLOBALASSIGN)) return true;
4172    return false;
4173  }
4174
4175  final private boolean jj_3R_95() {
4176    Token xsp;
4177    xsp = jj_scanpos;
4178    if (jj_scan_token(28)) {
4179    jj_scanpos = xsp;
4180    if (jj_scan_token(29)) return true;
4181    }
4182    return false;
4183  }
4184
4185  final private boolean jj_3R_118() {
4186    if (jj_scan_token(ASSIGN)) return true;
4187    return false;
4188  }
4189
4190  final private boolean jj_3R_88() {
4191    Token xsp;
4192    xsp = jj_scanpos;
4193    if (jj_3R_118()) {
4194    jj_scanpos = xsp;
4195    if (jj_3R_119()) {
4196    jj_scanpos = xsp;
4197    if (jj_3R_120()) return true;
4198    }
4199    }
4200    return false;
4201  }
4202
4203  final private boolean jj_3R_146() {
4204    Token xsp;
4205    xsp = jj_scanpos;
4206    if (jj_scan_token(84)) {
4207    jj_scanpos = xsp;
4208    if (jj_scan_token(85)) return true;
4209    }
4210    return false;
4211  }
4212
4213  public FMParserTokenManager token_source;
4214  SimpleCharStream jj_input_stream;
4215  public Token token, jj_nt;
4216  private int jj_ntk;
4217  private Token jj_scanpos, jj_lastpos;
4218  private int jj_la;
4219  public boolean lookingAhead = false;
4220  private boolean jj_semLA;
4221  private int jj_gen;
4222  final private int[] jj_la1 = new int[81];
4223  static private int[] jj_la1_0;
4224  static private int[] jj_la1_1;
4225  static private int[] jj_la1_2;
4226  static private int[] jj_la1_3;
4227  static private int[] jj_la1_4;
4228  static {
4229      jj_la1_0();
4230      jj_la1_1();
4231      jj_la1_2();
4232      jj_la1_3();
4233      jj_la1_4();
4234   }
4235   private static void jj_la1_0() {
4236      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,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,0x30000000,0x0,0x0,0x0,0x0,0x0,0x2000,0x0,0x7fffdd40,0x0,0x0,0x0,0x7fffdd40,0x7fffdd40,0x0,0x0,0x7fffdd40,0x0,0x0,0x0,0x0,0x0,};
4237   }
4238   private static void jj_la1_1() {
4239      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,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,0x200000,0x0,0xafdfe000,0x0,0x0,0x0,0xafdfe000,0xafdfe000,0x0,0x0,0xafdfe000,0x0,0x0,0x0,0x0,0x0,};
4240   }
4241   private static void jj_la1_2() {
4242      jj_la1_2 = new int[] {0x7f0000,0x7f0000,0x0,0x0,0x0,0x0,0xe000000,0xe000000,0xf0000000,0xf0000000,0x800000,0x300000,0x30000,0x1400000,0xf00c0000,0xf00c0000,0x30000,0xc0000,0x0,0x0,0x0,0x7f0000,0x0,0x0,0x0,0x0,0x0,0x7f0000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x2000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7f0000,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x0,0x70,0x0,0x0,0x1f0,0x1f0,0x1f0,0x1f0,0x1f0,0x10,0x0,0x6,0x0,0x0,};
4243   }
4244   private static void jj_la1_3() {
4245      jj_la1_3 = new int[] {0x42a000,0x42a203,0x200,0x3,0x3,0x64,0x0,0x0,0x18000000,0x18000000,0x0,0x0,0x400000,0xa000,0x380000,0x78000c,0x0,0x0,0x1400,0x400,0x1400,0x42a203,0x800,0x0,0x0,0x0,0x200000,0x42a203,0x200000,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x80000,0x80000,0x0,0x2080000,0x800,0x400000,0x0,0x8000,0x400000,0x10,0x0,0x400,0x10000,0x0,0x20000000,0x400,0x400000,0x800,0x6000000,0x10000,0x400000,0x400,0x42a203,0x0,0x800,0x400000,0x6000000,0x0,0x0,0x0,0x6000000,0x0,0x0,0xc0000000,0xc0000000,0x0,0x0,0x0,0x0,0x0,0x0,0x400000,0x0,0x400,0x400000,};
4246   }
4247   private static void jj_la1_4() {
4248      jj_la1_4 = new int[] {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,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
4249   }
4250  final private JJCalls[] jj_2_rtns = new JJCalls[13];
4251  private boolean jj_rescan = false;
4252  private int jj_gc = 0;
4253
4254  public FMParser(java.io.InputStream JavaDoc stream) {
4255    jj_input_stream = new SimpleCharStream(stream, 1, 1);
4256    token_source = new FMParserTokenManager(jj_input_stream);
4257    token = new Token();
4258    jj_ntk = -1;
4259    jj_gen = 0;
4260    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4261    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4262  }
4263
4264  public void ReInit(java.io.InputStream JavaDoc stream) {
4265    jj_input_stream.ReInit(stream, 1, 1);
4266    token_source.ReInit(jj_input_stream);
4267    token = new Token();
4268    jj_ntk = -1;
4269    jj_gen = 0;
4270    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4271    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4272  }
4273
4274  public FMParser(java.io.Reader JavaDoc stream) {
4275    jj_input_stream = new SimpleCharStream(stream, 1, 1);
4276    token_source = new FMParserTokenManager(jj_input_stream);
4277    token = new Token();
4278    jj_ntk = -1;
4279    jj_gen = 0;
4280    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4281    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4282  }
4283
4284  public void ReInit(java.io.Reader JavaDoc stream) {
4285    jj_input_stream.ReInit(stream, 1, 1);
4286    token_source.ReInit(jj_input_stream);
4287    token = new Token();
4288    jj_ntk = -1;
4289    jj_gen = 0;
4290    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4291    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4292  }
4293
4294  public FMParser(FMParserTokenManager tm) {
4295    token_source = tm;
4296    token = new Token();
4297    jj_ntk = -1;
4298    jj_gen = 0;
4299    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4300    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4301  }
4302
4303  public void ReInit(FMParserTokenManager tm) {
4304    token_source = tm;
4305    token = new Token();
4306    jj_ntk = -1;
4307    jj_gen = 0;
4308    for (int i = 0; i < 81; i++) jj_la1[i] = -1;
4309    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
4310  }
4311
4312  final private Token jj_consume_token(int kind) throws ParseException {
4313    Token oldToken;
4314    if ((oldToken = token).next != null) token = token.next;
4315    else token = token.next = token_source.getNextToken();
4316    jj_ntk = -1;
4317    if (token.kind == kind) {
4318      jj_gen++;
4319      if (++jj_gc > 100) {
4320        jj_gc = 0;
4321        for (int i = 0; i < jj_2_rtns.length; i++) {
4322          JJCalls c = jj_2_rtns[i];
4323          while (c != null) {
4324            if (c.gen < jj_gen) c.first = null;
4325            c = c.next;
4326          }
4327        }
4328      }
4329      return token;
4330    }
4331    token = oldToken;
4332    jj_kind = kind;
4333    throw generateParseException();
4334  }
4335
4336  static private final class LookaheadSuccess extends java.lang.Error JavaDoc { }
4337  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
4338  final private boolean jj_scan_token(int kind) {
4339    if (jj_scanpos == jj_lastpos) {
4340      jj_la--;
4341      if (jj_scanpos.next == null) {
4342        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
4343      } else {
4344        jj_lastpos = jj_scanpos = jj_scanpos.next;
4345      }
4346    } else {
4347      jj_scanpos = jj_scanpos.next;
4348    }
4349    if (jj_rescan) {
4350      int i = 0; Token tok = token;
4351      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
4352      if (tok != null) jj_add_error_token(kind, i);
4353    }
4354    if (jj_scanpos.kind != kind) return true;
4355    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
4356    return false;
4357  }
4358
4359  final public Token getNextToken() {
4360    if (token.next != null) token = token.next;
4361    else token = token.next = token_source.getNextToken();
4362    jj_ntk = -1;
4363    jj_gen++;
4364    return token;
4365  }
4366
4367  final public Token getToken(int index) {
4368    Token t = lookingAhead ? jj_scanpos : token;
4369    for (int i = 0; i < index; i++) {
4370      if (t.next != null) t = t.next;
4371      else t = t.next = token_source.getNextToken();
4372    }
4373    return t;
4374  }
4375
4376  final private int jj_ntk() {
4377    if ((jj_nt=token.next) == null)
4378      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
4379    else
4380      return (jj_ntk = jj_nt.kind);
4381  }
4382
4383  private java.util.Vector JavaDoc jj_expentries = new java.util.Vector JavaDoc();
4384  private int[] jj_expentry;
4385  private int jj_kind = -1;
4386  private int[] jj_lasttokens = new int[100];
4387  private int jj_endpos;
4388
4389  private void jj_add_error_token(int kind, int pos) {
4390    if (pos >= 100) return;
4391    if (pos == jj_endpos + 1) {
4392      jj_lasttokens[jj_endpos++] = kind;
4393    } else if (jj_endpos != 0) {
4394      jj_expentry = new int[jj_endpos];
4395      for (int i = 0; i < jj_endpos; i++) {
4396        jj_expentry[i] = jj_lasttokens[i];
4397      }
4398      boolean exists = false;
4399      for (java.util.Enumeration JavaDoc e = jj_expentries.elements(); e.hasMoreElements();) {
4400        int[] oldentry = (int[])(e.nextElement());
4401        if (oldentry.length == jj_expentry.length) {
4402          exists = true;
4403          for (int i = 0; i < jj_expentry.length; i++) {
4404            if (oldentry[i] != jj_expentry[i]) {
4405              exists = false;
4406              break;
4407            }
4408          }
4409          if (exists) break;
4410        }
4411      }
4412      if (!exists) jj_expentries.addElement(jj_expentry);
4413      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
4414    }
4415  }
4416
4417  public ParseException generateParseException() {
4418    jj_expentries.removeAllElements();
4419    boolean[] la1tokens = new boolean[130];
4420    for (int i = 0; i < 130; i++) {
4421      la1tokens[i] = false;
4422    }
4423    if (jj_kind >= 0) {
4424      la1tokens[jj_kind] = true;
4425      jj_kind = -1;
4426    }
4427    for (int i = 0; i < 81; i++) {
4428      if (jj_la1[i] == jj_gen) {
4429        for (int j = 0; j < 32; j++) {
4430          if ((jj_la1_0[i] & (1<<j)) != 0) {
4431            la1tokens[j] = true;
4432          }
4433          if ((jj_la1_1[i] & (1<<j)) != 0) {
4434            la1tokens[32+j] = true;
4435          }
4436          if ((jj_la1_2[i] & (1<<j)) != 0) {
4437            la1tokens[64+j] = true;
4438          }
4439          if ((jj_la1_3[i] & (1<<j)) != 0) {
4440            la1tokens[96+j] = true;
4441          }
4442          if ((jj_la1_4[i] & (1<<j)) != 0) {
4443            la1tokens[128+j] = true;
4444          }
4445        }
4446      }
4447    }
4448    for (int i = 0; i < 130; i++) {
4449      if (la1tokens[i]) {
4450        jj_expentry = new int[1];
4451        jj_expentry[0] = i;
4452        jj_expentries.addElement(jj_expentry);
4453      }
4454    }
4455    jj_endpos = 0;
4456    jj_rescan_token();
4457    jj_add_error_token(0, 0);
4458    int[][] exptokseq = new int[jj_expentries.size()][];
4459    for (int i = 0; i < jj_expentries.size(); i++) {
4460      exptokseq[i] = (int[])jj_expentries.elementAt(i);
4461    }
4462    return new ParseException(token, exptokseq, tokenImage);
4463  }
4464
4465  final public void enable_tracing() {
4466  }
4467
4468  final public void disable_tracing() {
4469  }
4470
4471  final private void jj_rescan_token() {
4472    jj_rescan = true;
4473    for (int i = 0; i < 13; i++) {
4474      JJCalls p = jj_2_rtns[i];
4475      do {
4476        if (p.gen > jj_gen) {
4477          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
4478          switch (i) {
4479            case 0: jj_3_1(); break;
4480            case 1: jj_3_2(); break;
4481            case 2: jj_3_3(); break;
4482            case 3: jj_3_4(); break;
4483            case 4: jj_3_5(); break;
4484            case 5: jj_3_6(); break;
4485            case 6: jj_3_7(); break;
4486            case 7: jj_3_8(); break;
4487            case 8: jj_3_9(); break;
4488            case 9: jj_3_10(); break;
4489            case 10: jj_3_11(); break;
4490            case 11: jj_3_12(); break;
4491            case 12: jj_3_13(); break;
4492          }
4493        }
4494        p = p.next;
4495      } while (p != null);
4496    }
4497    jj_rescan = false;
4498  }
4499
4500  final private void jj_save(int index, int xla) {
4501    JJCalls p = jj_2_rtns[index];
4502    while (p.gen > jj_gen) {
4503      if (p.next == null) { p = p.next = new JJCalls(); break; }
4504      p = p.next;
4505    }
4506    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
4507  }
4508
4509  static final class JJCalls {
4510    int gen;
4511    Token first;
4512    int arg;
4513    JJCalls next;
4514  }
4515
4516}
4517
Popular Tags