cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation JXPathTemplate.java
Date Tue, 15 Apr 2003 21:12:44 GMT
coliver     2003/04/15 14:12:44

  Modified:    src/scratchpad/src/org/apache/cocoon/generation
                        JXPathTemplate.java
  Log:
  fixed expression parsing
  
  Revision  Changes    Path
  1.9       +30 -25    cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXPathTemplate.java
  
  Index: JXPathTemplate.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXPathTemplate.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JXPathTemplate.java	15 Apr 2003 20:27:53 -0000	1.8
  +++ JXPathTemplate.java	15 Apr 2003 21:12:44 -0000	1.9
  @@ -288,7 +288,7 @@
               int ch;
               boolean inExpr = false;
               try {
  -                while ((ch = in.read()) != -1) {
  +                top: while ((ch = in.read()) != -1) {
                       char c = (char)ch;
                       if (inExpr) {
                           if (c == '}') {
  @@ -325,24 +325,26 @@
                               }
                           } else {
                               if (c == '#') {
  -                                ch = in.read();
  -                                if (ch == '{') {
  -                                    if (buf.length() > 0) {
  -                                        char[] charArray = 
  -                                            new char[buf.length()];
  -                                        
  -                                        buf.getChars(0, buf.length(),
  -                                                     charArray, 0);
  +                                while (c == '#') {
  +                                    ch = in.read();
  +                                    if (ch == '{') {
  +                                        if (buf.length() > 0) {
  +                                            char[] charArray = 
  +                                                new char[buf.length()];
  +                                            
  +                                            buf.getChars(0, buf.length(),
  +                                                         charArray, 0);
                                           substitutions.add(charArray);
                                           buf.setLength(0);
  +                                        }
  +                                        inExpr = true;
  +                                        continue top;
                                       }
  -                                    inExpr = true;
  -                                    continue;
  +                                    buf.append(c);
  +                                    c = (char)ch;
                                   }
  -                                buf.append('#');
  -                            }
  -                            if (ch != -1) {
  -                                buf.append((char)ch);
  +                            } else {
  +                                buf.append(c);
                               }
                           }
                       }
  @@ -507,7 +509,7 @@
                   boolean inExpr = false;
                   List substEvents = new LinkedList();
                   try {
  -                    while ((ch = in.read()) != -1) {
  +                    top: while ((ch = in.read()) != -1) {
                           char c = (char)ch;
                           if (inExpr) {
                               if (c == '}') {
  @@ -545,16 +547,19 @@
                                   }
                               } else {
                                   if (c == '#') {
  -                                    ch = in.read();
  -                                    if (ch == '{') {
  -                                        if (buf.length() > 0) {
  -                                            substEvents.add(new Literal(buf.toString()));
  -                                            buf.setLength(0);
  -                                        }
  -                                        inExpr = true;
  -                                        continue;
  +                                    while (c == '#') {
  +                                        ch = in.read();
  +                                        if (ch == '{') {
  +                                            if (buf.length() > 0) {
  +                                                substEvents.add(new Literal(buf.toString()));
  +                                                buf.setLength(0);
  +                                            }
  +                                            inExpr = true;
  +                                            continue top;
  +                                        } 
  +                                        buf.append(c);
  +                                        c = (char)ch;
                                       }
  -                                    buf.append('#');
                                   }
                                   if (ch != -1) {
                                       buf.append((char)ch);
  
  
  

Mime
View raw message