Update of /cvsroot/webmacro/webmacro/src/org/webmacro/parser
In directory usw-pr-cvs1:/tmp/cvs-serv18116/src/org/webmacro/parser
Modified Files:
	CharStream.java WMParser_impl.java WMParser_impl.jj 
	WMParser_implConstants.java WMParser_implTokenManager.java 
Log Message:
- When the parser outputs warnings for $$ and $foo;, include the line.col information
- fix Directive.writeWarning so it doesn't output HTML comments to the log
Index: CharStream.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/CharStream.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CharStream.java	11 Jun 2002 17:43:22 -0000	1.3
--- CharStream.java	11 Nov 2002 04:53:11 -0000	1.4
***************
*** 1,3 ****
! /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 0.7pre6 */
  package org.webmacro.parser;
  
--- 1,3 ----
! /* Generated By:JavaCC: Do not edit this line. CharStream.java Version 2.1 */
  package org.webmacro.parser;
  
***************
*** 19,110 ****
  public interface CharStream {
  
!    /**
!     * Returns the next character from the selected input.  The method
!     * of selecting the input is the responsibility of the class
!     * implementing this interface.  Can throw any java.io.IOException.
!     */
!    abstract public char readChar() throws java.io.IOException;
  
!    /**
!     * Returns the column position of the character last read.
!     * @deprecated
!     * @see #getEndColumn
!     */
!    abstract public int getColumn();
  
!    /**
!     * Returns the line number of the character last read.
!     * @deprecated
!     * @see #getEndLine
!     */
!    abstract public int getLine();
  
!    /**
!     * Returns the column number of the last character for current token (being
!     * matched after the last call to BeginTOken).
!     */
!    abstract public int getEndColumn();
  
!    /**
!     * Returns the line number of the last character for current token (being
!     * matched after the last call to BeginTOken).
!     */
!    abstract public int getEndLine();
  
!    /**
!     * Returns the column number of the first character for current token (being
!     * matched after the last call to BeginTOken).
!     */
!    abstract public int getBeginColumn();
  
!    /**
!     * Returns the line number of the first character for current token (being
!     * matched after the last call to BeginTOken).
!     */
!    abstract public int getBeginLine();
  
!    /**
!     * Backs up the input stream by amount steps. Lexer calls this method if it
!     * had already read some characters, but could not use them to match a
!     * (longer) token. So, they will be used again as the prefix of the next
!     * token and it is the implemetation's responsibility to do this right.
!     */
!    abstract public void backup(int amount);
  
!    /**
!     * Returns the next character that marks the beginning of the next token.
!     * All characters must remain in the buffer between two successive calls
!     * to this method to implement backup correctly.
!     */
!    abstract public char BeginToken() throws java.io.IOException;
  
!    /**
!     * Returns a string made up of characters from the marked token beginning
!     * to the current buffer position. Implementations have the choice of returning
!     * anything that they want to. For example, for efficiency, one might decide
!     * to just return null, which is a valid implementation.
!     */
!    abstract public String GetImage();
  
!    /**
!     * Returns an array of characters that make up the suffix of length 'len' for
!     * the currently matched token. This is used to build up the matched string
!     * for use in actions in the case of MORE. A simple and inefficient
!     * implementation of this is as follows :
!     *
!     *   {
!     *      String t = GetImage();
!     *      return t.substring(t.length() - len, t.length()).toCharArray();
!     *   }
!     */
!    abstract public char[] GetSuffix(int len);
  
!    /**
!     * The lexer calls this function to indicate that it is done with the stream
!     * and hence implementations can free any resources held by this class.
!     * Again, the body of this function can be just empty and it will not
!     * affect the lexer's operation.
!     */
!    abstract public void Done();
  
  }
--- 19,110 ----
  public interface CharStream {
  
!   /**
!    * Returns the next character from the selected input.  The method
!    * of selecting the input is the responsibility of the class
!    * implementing this interface.  Can throw any java.io.IOException.
!    */
!   char readChar() throws java.io.IOException;
  
!   /**
!    * Returns the column position of the character last read.
!    * @deprecated 
!    * @see #getEndColumn
!    */
!   int getColumn();
  
!   /**
!    * Returns the line number of the character last read.
!    * @deprecated 
!    * @see #getEndLine
!    */
!   int getLine();
  
!   /**
!    * Returns the column number of the last character for current token (being
!    * matched after the last call to BeginTOken).
!    */
!   int getEndColumn();
  
!   /**
!    * Returns the line number of the last character for current token (being
!    * matched after the last call to BeginTOken).
!    */
!   int getEndLine();
  
!   /**
!    * Returns the column number of the first character for current token (being
!    * matched after the last call to BeginTOken).
!    */
!   int getBeginColumn();
  
!   /**
!    * Returns the line number of the first character for current token (being
!    * matched after the last call to BeginTOken).
!    */
!   int getBeginLine();
  
!   /**
!    * Backs up the input stream by amount steps. Lexer calls this method if it
!    * had already read some characters, but could not use them to match a
!    * (longer) token. So, they will be used again as the prefix of the next
!    * token and it is the implemetation's responsibility to do this right.
!    */
!   void backup(int amount);
  
!   /**
!    * Returns the next character that marks the beginning of the next token.
!    * All characters must remain in the buffer between two successive calls
!    * to this method to implement backup correctly.
!    */
!   char BeginToken() throws java.io.IOException;
  
!   /**
!    * Returns a string made up of characters from the marked token beginning 
!    * to the current buffer position. Implementations have the choice of returning
!    * anything that they want to. For example, for efficiency, one might decide
!    * to just return null, which is a valid implementation.
!    */
!   String GetImage();
  
!   /**
!    * Returns an array of characters that make up the suffix of length 'len' for
!    * the currently matched token. This is used to build up the matched string
!    * for use in actions in the case of MORE. A simple and inefficient
!    * implementation of this is as follows :
!    *
!    *   {
!    *      String t = GetImage();
!    *      return t.substring(t.length() - len, t.length()).toCharArray();
!    *   }
!    */
!   char[] GetSuffix(int len);
  
!   /**
!    * The lexer calls this function to indicate that it is done with the stream
!    * and hence implementations can free any resources held by this class.
!    * Again, the body of this function can be just empty and it will not
!    * affect the lexer's operation.
!    */
!   void Done();
  
  }
Index: WMParser_impl.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** WMParser_impl.java	15 Jun 2002 05:49:00 -0000	1.42
--- WMParser_impl.java	11 Nov 2002 04:53:11 -0000	1.43
***************
*** 24,3093 ****
  
  public class WMParser_impl implements WMParser_implConstants {
!     
!     private Broker broker;
!     private BackupCharStream stream;
!     private Stack blockStack = new Stack();
!     private String templateName;
!     
!     public WMParser_impl(Broker broker,
!     String templateName,
[...6111 lines suppressed...]
!     jj_rescan = false;
!   }
! 
!   final private void jj_save(int index, int xla) {
!     JJCalls p = jj_2_rtns[index];
!     while (p.gen > jj_gen) {
!       if (p.next == null) { p = p.next = new JJCalls(); break; }
!       p = p.next;
      }
!     p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
!   }
! 
!   static final class JJCalls {
!     int gen;
!     Token first;
!     int arg;
!     JJCalls next;
!   }
! 
  }
Index: WMParser_impl.jj
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_impl.jj,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** WMParser_impl.jj	15 Jun 2002 06:03:20 -0000	1.41
--- WMParser_impl.jj	11 Nov 2002 04:53:12 -0000	1.42
***************
*** 158,163 ****
  
    // Warning routines
!   private void warnDeprecated(String feature) {
!     broker.getLog("parser").warning("Deprecated feature: " + feature);
    }
  }
--- 158,163 ----
  
    // Warning routines
!   private void warnDeprecated(String feature, int line, int col) {
!     broker.getLog("parser").warning("Deprecated feature: " + feature + " at " + line + "." + col);
    }
  }
***************
*** 751,755 ****
    ( LOOKAHEAD(<DOT><WORD>) <DOT> t=<WORD> { element = t.image; }
      [ <LPAREN> argList=ArgList() <RPAREN>
!       { element = new PropertyMethodBuilder((String) element, argList); }
      ]
      { v.add(element); }
--- 751,755 ----
    ( LOOKAHEAD(<DOT><WORD>) <DOT> t=<WORD> { element = t.image; }
      [ <LPAREN> argList=ArgList() <RPAREN>
!        { element = new PropertyMethodBuilder((String) element, argList); }
      ]
      { v.add(element); }
***************
*** 763,770 ****
  {
    <DOLLAR>
!   [ <DOLLAR> { warnDeprecated(DDOLLAR_FEATURE); } ]
    (
      LOOKAHEAD(2)
!     t=<WORD><SEMI> { v.add(t.image); warnDeprecated(SEMI_FEATURE); }
      | VariableReferenceGuts(v)
      | <LPAREN> VariableReferenceGuts(v) <RPAREN>
--- 763,770 ----
  {
    <DOLLAR>
!   [ t=<DOLLAR> { warnDeprecated(DDOLLAR_FEATURE, t.beginLine, t.beginColumn); } ]
    (
      LOOKAHEAD(2)
!     t=<WORD><SEMI> { v.add(t.image); warnDeprecated(SEMI_FEATURE, t.beginLine, t.beginColumn); }
      | VariableReferenceGuts(v)
      | <LPAREN> VariableReferenceGuts(v) <RPAREN>
Index: WMParser_implConstants.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implConstants.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** WMParser_implConstants.java	11 Jun 2002 17:43:22 -0000	1.9
--- WMParser_implConstants.java	11 Nov 2002 04:53:12 -0000	1.10
***************
*** 4,131 ****
  public interface WMParser_implConstants {
  
!    int EOF = 0;
!    int _ALPHA_CHAR = 1;
!    int _NUM_CHAR = 2;
!    int _ALPHANUM_CHAR = 3;
!    int _IDENTIFIER_CHAR = 4;
!    int _IDENTIFIER = 5;
!    int _NEWLINE = 6;
!    int _WHITESPACE = 7;
!    int _QCHAR = 8;
!    int _RESTOFLINE = 9;
!    int _COMMENT = 10;
!    int STUFF = 11;
!    int RBRACE = 12;
!    int END = 13;
!    int BEGIN = 14;
!    int LBRACE = 15;
!    int POUNDPOUND = 17;
!    int RESTOFLINE = 18;
!    int COMMENT_ELSE = 19;
!    int DOLLAR = 20;
!    int QCHAR = 21;
!    int SLASH = 22;
!    int POUND = 23;
!    int QUOTE = 24;
!    int SQUOTE = 25;
!    int NULL = 26;
!    int TRUE = 27;
!    int FALSE = 28;
!    int UNDEFINED = 29;
!    int WS = 30;
!    int NEWLINE = 31;
!    int LPAREN = 32;
!    int RPAREN = 33;
!    int LBRACKET = 34;
!    int RBRACKET = 35;
!    int DOT = 36;
!    int OP_LT = 37;
!    int OP_LE = 38;
!    int OP_GT = 39;
!    int OP_GE = 40;
!    int OP_EQ = 41;
!    int OP_SET = 42;
!    int OP_NE = 43;
!    int OP_PLUS = 44;
!    int OP_MINUS = 45;
!    int OP_MULT = 46;
!    int OP_DIV = 47;
!    int OP_AND = 48;
!    int OP_OR = 49;
!    int OP_NOT = 50;
!    int COMMA = 51;
!    int SEMI = 52;
!    int WORD = 53;
!    int NUMBER = 54;
!    int OTHER = 55;
!    int QS_TEXT = 56;
!    int SQS_TEXT = 57;
  
!    int SQS = 0;
!    int QS = 1;
!    int COMMENT = 2;
!    int WM = 3;
!    int DEFAULT = 4;
  
!    String[] tokenImage = {
!       "<EOF>",
!       "<_ALPHA_CHAR>",
!       "<_NUM_CHAR>",
!       "<_ALPHANUM_CHAR>",
!       "<_IDENTIFIER_CHAR>",
!       "<_IDENTIFIER>",
!       "<_NEWLINE>",
!       "<_WHITESPACE>",
!       "<_QCHAR>",
!       "<_RESTOFLINE>",
!       "<_COMMENT>",
!       "<STUFF>",
!       "\"}\"",
!       "\"#end\"",
!       "\"#begin\"",
!       "\"{\"",
!       "<token of kind 16>",
!       "\"##\"",
!       "<RESTOFLINE>",
!       "<COMMENT_ELSE>",
!       "\"$\"",
!       "<QCHAR>",
!       "\"\\\\\"",
!       "\"#\"",
!       "\"\\\"\"",
!       "\"\\\'\"",
!       "\"null\"",
!       "\"true\"",
!       "\"false\"",
!       "\"undefined\"",
!       "<WS>",
!       "<NEWLINE>",
!       "\"(\"",
!       "\")\"",
!       "\"[\"",
!       "\"]\"",
!       "\".\"",
!       "\"<\"",
!       "\"<=\"",
!       "\">\"",
!       "\">=\"",
!       "\"==\"",
!       "\"=\"",
!       "<OP_NE>",
!       "\"+\"",
!       "\"-\"",
!       "\"*\"",
!       "\"/\"",
!       "<OP_AND>",
!       "<OP_OR>",
!       "<OP_NOT>",
!       "\",\"",
!       "\";\"",
!       "<WORD>",
!       "<NUMBER>",
!       "<OTHER>",
!       "<QS_TEXT>",
!       "<SQS_TEXT>",
!    };
  
  }
--- 4,131 ----
  public interface WMParser_implConstants {
  
!   int EOF = 0;
!   int _ALPHA_CHAR = 1;
!   int _NUM_CHAR = 2;
!   int _ALPHANUM_CHAR = 3;
!   int _IDENTIFIER_CHAR = 4;
!   int _IDENTIFIER = 5;
!   int _NEWLINE = 6;
!   int _WHITESPACE = 7;
!   int _QCHAR = 8;
!   int _RESTOFLINE = 9;
!   int _COMMENT = 10;
!   int STUFF = 11;
!   int RBRACE = 12;
!   int END = 13;
!   int BEGIN = 14;
!   int LBRACE = 15;
!   int POUNDPOUND = 17;
!   int RESTOFLINE = 18;
!   int COMMENT_ELSE = 19;
!   int DOLLAR = 20;
!   int QCHAR = 21;
!   int SLASH = 22;
!   int POUND = 23;
!   int QUOTE = 24;
!   int SQUOTE = 25;
!   int NULL = 26;
!   int TRUE = 27;
!   int FALSE = 28;
!   int UNDEFINED = 29;
!   int WS = 30;
!   int NEWLINE = 31;
!   int LPAREN = 32;
!   int RPAREN = 33;
!   int LBRACKET = 34;
!   int RBRACKET = 35;
!   int DOT = 36;
!   int OP_LT = 37;
!   int OP_LE = 38;
!   int OP_GT = 39;
!   int OP_GE = 40;
!   int OP_EQ = 41;
!   int OP_SET = 42;
!   int OP_NE = 43;
!   int OP_PLUS = 44;
!   int OP_MINUS = 45;
!   int OP_MULT = 46;
!   int OP_DIV = 47;
!   int OP_AND = 48;
!   int OP_OR = 49;
!   int OP_NOT = 50;
!   int COMMA = 51;
!   int SEMI = 52;
!   int WORD = 53;
!   int NUMBER = 54;
!   int OTHER = 55;
!   int QS_TEXT = 56;
!   int SQS_TEXT = 57;
  
!   int SQS = 0;
!   int QS = 1;
!   int COMMENT = 2;
!   int WM = 3;
!   int DEFAULT = 4;
  
!   String[] tokenImage = {
!     "<EOF>",
!     "<_ALPHA_CHAR>",
!     "<_NUM_CHAR>",
!     "<_ALPHANUM_CHAR>",
!     "<_IDENTIFIER_CHAR>",
!     "<_IDENTIFIER>",
!     "<_NEWLINE>",
!     "<_WHITESPACE>",
!     "<_QCHAR>",
!     "<_RESTOFLINE>",
!     "<_COMMENT>",
!     "<STUFF>",
!     "\"}\"",
!     "\"#end\"",
!     "\"#begin\"",
!     "\"{\"",
!     "<token of kind 16>",
!     "\"##\"",
!     "<RESTOFLINE>",
!     "<COMMENT_ELSE>",
!     "\"$\"",
!     "<QCHAR>",
!     "\"\\\\\"",
!     "\"#\"",
!     "\"\\\"\"",
!     "\"\\\'\"",
!     "\"null\"",
!     "\"true\"",
!     "\"false\"",
!     "\"undefined\"",
!     "<WS>",
!     "<NEWLINE>",
!     "\"(\"",
!     "\")\"",
!     "\"[\"",
!     "\"]\"",
!     "\".\"",
!     "\"<\"",
!     "\"<=\"",
!     "\">\"",
!     "\">=\"",
!     "\"==\"",
!     "\"=\"",
!     "<OP_NE>",
!     "\"+\"",
!     "\"-\"",
!     "\"*\"",
!     "\"/\"",
!     "<OP_AND>",
!     "<OP_OR>",
!     "<OP_NOT>",
!     "\",\"",
!     "\";\"",
!     "<WORD>",
!     "<NUMBER>",
!     "<OTHER>",
!     "<QS_TEXT>",
!     "<SQS_TEXT>",
!   };
  
  }
Index: WMParser_implTokenManager.java
===================================================================
RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/parser/WMParser_implTokenManager.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** WMParser_implTokenManager.java	11 Jun 2002 17:43:22 -0000	1.22
--- WMParser_implTokenManager.java	11 Nov 2002 04:53:12 -0000	1.23
***************
*** 1,1556 ****
  /* Generated By:JavaCC: Do not edit this line. WMParser_implTokenManager.java */
  package org.webmacro.parser;
  
! 
! public class WMParser_implTokenManager implements WMParser_implConstants {
! 
!    // Required by SetState
!    void backup(int n) {
!       input_stream.backup(n);
!    }
[...3108 lines suppressed...]
+         else
+            error_column++;
+      }
+      if (!EOFSeen) {
+         input_stream.backup(1);
+         error_after = curPos <= 1 ? "" : input_stream.GetImage();
+      }
+      throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+   }
+ }
  
! final void TokenLexicalActions(Token matchedToken)
! {
!    switch(jjmatchedKind)
!    {
!       default : 
!          break;
     }
+ }
  }
 |