svn: /web/doc-editor/trunk/js/ux/codemirror/contrib/php/js/ tokenizephp.js

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Wed, 02 Dec 2009 21:38:26 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=291610

Log:
Update codemirror ux to new version

Changed paths:
    U   web/doc-editor/trunk/js/ux/codemirror/contrib/php/js/tokenizephp.js

Modified: web/doc-editor/trunk/js/ux/codemirror/contrib/php/js/tokenizephp.js
===================================================================
--- web/doc-editor/trunk/js/ux/codemirror/contrib/php/js/tokenizephp.js	2009-12-02 21:35:04 UTC (rev 291609)
+++ web/doc-editor/trunk/js/ux/codemirror/contrib/php/js/tokenizephp.js	2009-12-02 21:38:26 UTC (rev 291610)
@@ -762,11 +762,10 @@

   }();

-  // Helper regexp matchers.
-  var isOperatorChar = matcher(/[+*&%\/=<>!?.|-]/);
-  var isDigit = matcher(/[0-9]/);
-  var isHexDigit = matcher(/[0-9A-Fa-f]/);
-  var isWordChar = matcher(/[\w\$_]/);
+  // Helper regexps
+  var isOperatorChar = /[+*&%\/=<>!?.|-]/;
+  var isHexDigit = /[0-9A-Fa-f]/;
+  var isWordChar = /[\w\$_]/;

   // Wrapper around phpToken that helps maintain parser state (whether
   // we are inside of a multi-line comment)
@@ -787,28 +786,28 @@
   function phpToken(inside, source, setInside) {
     function readHexNumber(){
       source.next();  // skip the 'x'
-      source.nextWhile(isHexDigit);
+      source.nextWhileMatches(isHexDigit);
       return {type: "number", style: "php-atom"};
     }

     function readNumber() {
-      source.nextWhile(isDigit);
+      source.nextWhileMatches(/[0-9]/);
       if (source.equals(".")){
         source.next();
-        source.nextWhile(isDigit);
+        source.nextWhileMatches(/[0-9]/);
       }
       if (source.equals("e") || source.equals("E")){
         source.next();
         if (source.equals("-"))
           source.next();
-        source.nextWhile(isDigit);
+        source.nextWhileMatches(/[0-9]/);
       }
       return {type: "number", style: "php-atom"};
     }
     // Read a word and look it up in the keywords array. If found, it's a
     // keyword of that type; otherwise it's a PHP T_STRING.
     function readWord() {
-      source.nextWhile(isWordChar);
+      source.nextWhileMatches(isWordChar);
       var word = source.get();
       var known = keywords.hasOwnProperty(word) && keywords.propertyIsEnumerable(word) && keywords[word];
       // since we called get(), tokenize::take won't get() anything. Thus, we must set token.content
@@ -816,7 +815,7 @@
       {type: "t_string", style: "php-t_string", content: word};
     }
     function readVariable() {
-      source.nextWhile(isWordChar);
+      source.nextWhileMatches(isWordChar);
       var word = source.get();
       // in PHP, '$this' is a reserved word, but 'this' isn't. You can have function this() {...}
       if (word == "$this")
@@ -900,12 +899,12 @@
         // on our first invocation after reading the <<<, we must determine the closing identifier
         if (source.equals("'")) {
           // nowdoc
-          source.nextWhile(isWordChar);
+          source.nextWhileMatches(isWordChar);
           identifier = "'" + source.get() + "'";
           source.next();  // consume the closing "'"
-        } else if (source.applies(matcher(/[A-Za-z_]/))) {
+        } else if (source.matches(/[A-Za-z_]/)) {
           // heredoc
-          source.nextWhile(isWordChar);
+          source.nextWhileMatches(isWordChar);
           identifier = source.get();
         } else {
           // syntax error
@@ -927,7 +926,7 @@
           setInside(null);
         } else {
           token.type = "string_not_terminated";
-          source.nextWhile(matcher(/[^\n]/));
+          source.nextWhileMatches(/[^\n]/);
           token.content = source.get();
         }
       }
@@ -935,7 +934,7 @@
     }

     function readOperator() {
-      source.nextWhile(isOperatorChar);
+      source.nextWhileMatches(isOperatorChar);
       return {type: "operator", style: "php-operator"};
     }
     function readStringSingleQuoted() {
@@ -977,7 +976,7 @@
     }
     else if (ch == "0" && (source.equals("x") || source.equals("X")))
       return readHexNumber();
-    else if (isDigit(ch))
+    else if (/[0-9]/.test(ch))
       return readNumber();
     else if (ch == "/") {
       if (source.equals("*"))
@@ -995,7 +994,7 @@
       else
         return readOperator();
     }
-    else if (isOperatorChar(ch))
+    else if (isOperatorChar.test(ch))
       return readOperator();
     else
       return readWord();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.