tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajbor...@apache.org
Subject svn commit: r509228 - in /incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common: InputCppSourceCode.java Utils.java
Date Mon, 19 Feb 2007 15:48:48 GMT
Author: ajborley
Date: Mon Feb 19 07:48:47 2007
New Revision: 509228

URL: http://svn.apache.org/viewvc?view=rev&rev=509228
Log:
Fix for TUSCANY-1092. Added support for non-alphanumerics in the right place to make the parsing
work.

Modified:
    incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java
    incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java

Modified: incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java?view=diff&rev=509228&r1=509227&r2=509228
==============================================================================
--- incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java
(original)
+++ incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/InputCppSourceCode.java
Mon Feb 19 07:48:47 2007
@@ -146,7 +146,7 @@
                     // TODO: cope with comments here
                     // TODO: split out classes into a ClassPart
                     StringTokenizer st = new StringTokenizer(text,
-                            Utils.whitespace + ":");
+                            Utils.whitespace + ":{");
                     st.nextToken(); // step over "class"
                     while (st.hasMoreTokens()) {
                         String word = st.nextToken();
@@ -422,4 +422,4 @@
         return text.toString();
     }
 
-}
\ No newline at end of file
+}

Modified: incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java?view=diff&rev=509228&r1=509227&r2=509228
==============================================================================
--- incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java
(original)
+++ incubator/tuscany/cpp/sca/tools/scagen/src/org/apache/tuscany/sca/cpp/tools/common/Utils.java
Mon Feb 19 07:48:47 2007
@@ -116,11 +116,19 @@
        char t0 = t.charAt(0);
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == t0
-                   && s.substring(i).startsWith(t)
-                   && (0 == i || !Character.isLetterOrDigit(s.charAt(i - 1)))
+                   && s.substring(i).startsWith(t)) {
+               
+
+               // When finding a single non-alphanumeric character
+               if(t.length() == 1 && !Character.isLetterOrDigit(t0))
+                   return i;
+               
+               // When finding an alphanumeric string
+               if((0 == i || !Character.isLetterOrDigit(s.charAt(i - 1))) // Check we're
matching at the start of a word
                    && (s.length() == (i + t.length()) || !Character
-                           .isLetterOrDigit(s.charAt(i + t.length()))))
-               return i;
+                           .isLetterOrDigit(s.charAt(i + t.length()))))   // Check we're
still matching by the end of the word
+                   return i;
+           }
 
            i = skip(s.substring(i), i);
            if (-1 == i)
@@ -545,4 +553,4 @@
 
    }
 
-}
\ No newline at end of file
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message