db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/engine/sql SQLScanner.java
Date Thu, 22 May 2003 21:58:05 GMT
mpoeschl    2003/05/22 14:58:05

  Modified:    xdocs    Tag: TORQUE_3_0_BRANCH changes.xml
               src/java/org/apache/torque/engine/sql Tag: TORQUE_3_0_BRANCH
                        SQLScanner.java
  Log:
  TRQS90: SQLScanner reports wrong line numbers in Window platforms and
        behaves incorrectly when finding the minus sign
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.54.2.6  +4 -0      db-torque/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
  retrieving revision 1.54.2.5
  retrieving revision 1.54.2.6
  diff -u -r1.54.2.5 -r1.54.2.6
  --- changes.xml	22 May 2003 20:20:41 -0000	1.54.2.5
  +++ changes.xml	22 May 2003 21:58:05 -0000	1.54.2.6
  @@ -43,6 +43,10 @@
   <p>
     <ul>
       <li>
  +      TRQS90: SQLScanner reports wrong line numbers in Window platforms and
  +      behaves incorrectly when finding the minus sign
  +    </li>
  +    <li>
         TRQS122: Join methods are not generated.
       </li>
     </ul>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +50 -9     db-torque/src/java/org/apache/torque/engine/sql/Attic/SQLScanner.java
  
  Index: SQLScanner.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/engine/sql/Attic/SQLScanner.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- SQLScanner.java	7 May 2002 18:24:43 -0000	1.3
  +++ SQLScanner.java	22 May 2003 21:58:05 -0000	1.3.2.1
  @@ -92,21 +92,21 @@
        */
       public SQLScanner()
       {
  -        this (null);
  +        this(null);
       }
   
       /**
        * Creates a new scanner with an Input Reader
        */
  -    public SQLScanner (Reader input)
  +    public SQLScanner(Reader input)
       {
  -        setInput (input);
  +        setInput(input);
       }
   
       /**
        * Set the Input
        */
  -    public void setInput (Reader input)
  +    public void setInput(Reader input)
       {
           in = input;
       }
  @@ -118,12 +118,20 @@
        */
       private void readChar() throws IOException
       {
  +        boolean wasLine = (char) chr == '\r';
           chr = in.read();
           if ((char) chr == '\n' || (char) chr == '\r' || (char) chr == '\f')
           {
               col = 0;
  -            line++;
  -        } else col++;
  +            if (!wasLine || (char) chr != '\n')
  +            {
  +                line++;
  +            }
  +        }
  +        else
  +        {
  +            col++;
  +        }
       }
   
       /**
  @@ -139,7 +147,25 @@
               readChar();
               c = (char) chr;
           }
  -        tokens.add(new Token(token,line,col));
  +        int start = col - token.length();
  +        tokens.add(new Token(token, line, start));
  +    }
  +
  +    /**
  +     * Scans an identifier which had started with the negative sign.
  +     */
  +    private void scanNegativeIdentifier () throws IOException
  +    {
  +        token = "-";
  +        char c = (char) chr;
  +        while (chr != -1 && white.indexOf(c) == -1 && special.indexOf(c)
== -1)
  +        {
  +            token = token + (char) chr;
  +            readChar();
  +            c = (char) chr;
  +        }
  +        int start = col - token.length();
  +        tokens.add(new Token(token, line, start));
       }
   
       /**
  @@ -154,11 +180,14 @@
           boolean inCommentSlashStar = false;
           boolean inCommentDash = false;
   
  +        boolean inNegative;
  +
           tokens = new ArrayList();
           readChar();
           while (chr != -1)
           {
               char c = (char) chr;
  +            inNegative=false;
   
               if ((char) c == commentDash)
               {
  @@ -167,6 +196,11 @@
                   {
                       inCommentDash = true;
                   }
  +                else
  +                {
  +                    inNegative = true;
  +                    c = (char) chr;
  +                }
               }
   
               if (inCommentDash)
  @@ -208,7 +242,14 @@
               }
               else if (alfanum.indexOf(c) >= 0)
               {
  -                scanIdentifier();
  +                if (inNegative)
  +                {
  +                    scanNegativeIdentifier();
  +                }
  +                else
  +                {
  +                    scanIdentifier();
  +                }
               }
               else if (special.indexOf(c) >= 0)
               {
  
  
  

Mime
View raw message