You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/02/15 18:42:37 UTC
[27/51] [partial] Apache-ization, port to node.js
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
new file mode 100644
index 0000000..ae71efe
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Generate js file as follows:
+//
+// re2c -isc WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \
+// | sed 's|^yy\([^:]*\)*\:|case \1:|' \
+// | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
+// | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
+// | sed 's|[*]cursor|this._charAt(cursor)|' \
+// | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
+// | sed 's|goto case \([^;]*\)|{ gotoCase = \1; continue; }|' \
+// | sed 's|unsigned\ int|var|' \
+// | sed 's|var\ yych|case 1: var yych|'
+
+WebInspector.SourceJavaScriptTokenizer = function()
+{
+ WebInspector.SourceTokenizer.call(this);
+
+ this._keywords = [
+ "null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for",
+ "instanceof", "new", "var", "continue", "function", "return", "void", "delete", "if",
+ "this", "do", "while", "else", "in", "switch", "throw", "try", "typeof", "debugger",
+ "class", "enum", "export", "extends", "import", "super", "get", "set", "with"
+ ].keySet();
+
+ this._lexConditions = {
+ DIV: 0,
+ NODIV: 1,
+ COMMENT: 2,
+ DSTRING: 3,
+ SSTRING: 4,
+ REGEX: 5
+ };
+
+ this.case_DIV = 1000;
+ this.case_NODIV = 1001;
+ this.case_COMMENT = 1002;
+ this.case_DSTRING = 1003;
+ this.case_SSTRING = 1004;
+ this.case_REGEX = 1005;
+
+ this.initialCondition = { lexCondition: this._lexConditions.NODIV }
+ this.condition = this.initialCondition;
+}
+
+WebInspector.SourceJavaScriptTokenizer.prototype = {
+ nextToken: function(cursor)
+ {
+ var cursorOnEnter = cursor;
+ var gotoCase = 1;
+ while (1) {
+ switch (gotoCase)
+ // Following comment is replaced with generated state machine.
+ /*!re2c
+ re2c:define:YYCTYPE = "var";
+ re2c:define:YYCURSOR = cursor;
+ re2c:define:YYGETCONDITION = "this.getLexCondition";
+ re2c:define:YYSETCONDITION = "this.setLexCondition";
+ re2c:condprefix = "case this.case_";
+ re2c:condenumprefix = "this._lexConditions.";
+ re2c:yyfill:enable = 0;
+ re2c:labelprefix = "case ";
+ re2c:indent:top = 2;
+ re2c:indent:string = " ";
+
+ LineComment = "//" [^\r\n]*;
+ CommentContent = ([^*\r\n] | ("*"+[^/*]))*;
+ Comment = "/*" CommentContent "*"+ "/";
+ CommentStart = "/*" CommentContent [\r\n];
+ CommentEnd = CommentContent "*"+ "/";
+
+ DecimalDigit = [0-9];
+ NonZeroDigit = [1-9];
+ OctalDigit = [0-7];
+ HexDigit = [0-9a-fA-F];
+ SignedInteger = ("+"|"-")? DecimalDigit+;
+ ExponentPart = ("e" | "E") SignedInteger;
+ DecimalIntegerLiteral = "0" | NonZeroDigit DecimalDigit*;
+ DecimalLiteral = DecimalIntegerLiteral "." DecimalDigit* ExponentPart? | "." DecimalDigit+ ExponentPart? | DecimalIntegerLiteral ExponentPart?;
+ HexIntegerLiteral = "0" ("x"|"X") HexDigit+;
+ OctalIntegerLiteral = "0" OctalDigit+;
+ NumericLiteral = DecimalLiteral | HexIntegerLiteral | OctalIntegerLiteral;
+
+ Punctuation = [\!\%\&\(\*\+\,\-\.\:\;\<\=\>\?\[\]\^\{\|\}\~] | "!=" | "!==" | "%=" | "&&" | "&=" | "*=" | "++" | "+=" | "--" | "-=" | "<<" | "<<=" | "<=" | "==" | "===" | ">=" | ">>" | ">>=" | ">>>" | ">>>=" | "^=" | "|=" | "||";
+ Division = "/" | "/=";
+ RightParen = ")";
+
+ Letter = [a-zA-Z\x80-\xFF];
+ UnicodeEscapeSequence = "\\u" HexDigit HexDigit HexDigit HexDigit;
+
+ IdentifierStart = Letter | "_" | "$" | UnicodeEscapeSequence;
+ IdentifierPart = IdentifierStart | DecimalDigit;
+ Identifier = IdentifierStart IdentifierPart *;
+
+ DoubleStringContent = ([^\r\n\"\\] | UnicodeEscapeSequence | "\\" ['"\\bfnrtv])*;
+ SingleStringContent = ([^\r\n\'\\] | UnicodeEscapeSequence | "\\" ['"\\bfnrtv])*;
+ StringLiteral = "\"" DoubleStringContent "\"" | "'" SingleStringContent "'";
+ DoubleStringStart = "\"" DoubleStringContent "\\" [\r\n];
+ DoubleStringEnd = DoubleStringContent "\"";
+ SingleStringStart = "'" SingleStringContent "\\" [\r\n];
+ SingleStringEnd = SingleStringContent "'";
+
+ BackslashSequence = "\\" [^\r\n];
+ RegexSet = "[" ([^\r\n*\\/] | BackslashSequence)* "]";
+ RegexFirstChar = [^\r\n*\\/\[\]] | BackslashSequence | RegexSet;
+ RegexChar = [^\r\n\\/\[\]] | BackslashSequence | RegexSet;
+ RegexContent = RegexChar*;
+ Regex = "/" RegexFirstChar RegexContent "/" [igm]*;
+ RegexStart = "/" RegexFirstChar RegexContent "\\";
+ RegexEnd = RegexContent "/" [igm]*;
+
+ <DIV,NODIV> LineComment { this.tokenType = "javascript-comment"; return cursor; }
+ <DIV,NODIV> Comment { this.tokenType = "javascript-comment"; return cursor; }
+ <DIV,NODIV> CommentStart => COMMENT { this.tokenType = "javascript-comment"; return cursor; }
+ <COMMENT> CommentContent => COMMENT { this.tokenType = "javascript-comment"; return cursor; }
+ <COMMENT> CommentEnd => NODIV { this.tokenType = "javascript-comment"; return cursor; }
+
+ <DIV,NODIV> StringLiteral { this.tokenType = "javascript-string"; return cursor; }
+ <DIV,NODIV> DoubleStringStart => DSTRING { this.tokenType = "javascript-string"; return cursor; }
+ <DSTRING> DoubleStringContent => DSTRING { this.tokenType = "javascript-string"; return cursor; }
+ <DSTRING> DoubleStringEnd => NODIV { this.tokenType = "javascript-string"; return cursor; }
+ <DIV,NODIV> SingleStringStart => SSTRING { this.tokenType = "javascript-string"; return cursor; }
+ <SSTRING> SingleStringContent => SSTRING { this.tokenType = "javascript-string"; return cursor; }
+ <SSTRING> SingleStringEnd => NODIV { this.tokenType = "javascript-string"; return cursor; }
+
+ <NODIV> Regex { this.tokenType = "javascript-regexp"; return cursor; }
+ <NODIV> RegexStart => REGEX { this.tokenType = "javascript-regexp"; return cursor; }
+ <REGEX> RegexContent => REGEX { this.tokenType = "javascript-regexp"; return cursor; }
+ <REGEX> RegexEnd => NODIV { this.tokenType = "javascript-regexp"; return cursor; }
+
+ <DIV,NODIV> NumericLiteral => DIV { this.tokenType = "javascript-number"; return cursor; }
+ <DIV,NODIV> Identifier => DIV
+ {
+ var token = this._line.substring(cursorOnEnter, cursor);
+ if (token in this._keywords)
+ this.tokenType = "javascript-keyword";
+ else
+ this.tokenType = "javascript-ident";
+ return cursor;
+ }
+ <DIV,NODIV> RightParen => DIV { this.tokenType = null; return cursor; }
+ <DIV,NODIV> Punctuation => NODIV { this.tokenType = null; return cursor; }
+ <DIV> Division => NODIV { this.tokenType = null; return cursor; }
+ <*> [^] { this.tokenType = null; return cursor; }
+ */
+ }
+ }
+}
+
+WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceTokenizer.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceTokenizer.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceTokenizer.js
new file mode 100644
index 0000000..d30744c
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/SourceTokenizer.js
@@ -0,0 +1,102 @@
+/* Generated by re2c 0.13.5 on Tue Jan 26 01:16:33 2010 */
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.SourceTokenizer = function()
+{
+}
+
+WebInspector.SourceTokenizer.prototype = {
+ set line(line) {
+ this._line = line;
+ },
+
+ set condition(condition)
+ {
+ this._condition = condition;
+ },
+
+ get condition()
+ {
+ return this._condition;
+ },
+
+ get subTokenizer()
+ {
+ return this._condition.subTokenizer;
+ },
+
+ getLexCondition: function()
+ {
+ return this.condition.lexCondition;
+ },
+
+ setLexCondition: function(lexCondition)
+ {
+ this.condition.lexCondition = lexCondition;
+ },
+
+ _charAt: function(cursor)
+ {
+ return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
+ }
+}
+
+
+WebInspector.SourceTokenizer.Registry = function() {
+ this._tokenizers = {};
+ this._tokenizerConstructors = {
+ "text/css": "SourceCSSTokenizer",
+ "text/html": "SourceHTMLTokenizer",
+ "text/javascript": "SourceJavaScriptTokenizer"
+ };
+}
+
+WebInspector.SourceTokenizer.Registry.getInstance = function()
+{
+ if (!WebInspector.SourceTokenizer.Registry._instance)
+ WebInspector.SourceTokenizer.Registry._instance = new WebInspector.SourceTokenizer.Registry();
+ return WebInspector.SourceTokenizer.Registry._instance;
+}
+
+WebInspector.SourceTokenizer.Registry.prototype = {
+ getTokenizer: function(mimeType)
+ {
+ if (!this._tokenizerConstructors[mimeType])
+ return null;
+ var tokenizerClass = this._tokenizerConstructors[mimeType];
+ var tokenizer = this._tokenizers[tokenizerClass];
+ if (!tokenizer) {
+ tokenizer = new WebInspector[tokenizerClass]();
+ this._tokenizers[mimeType] = tokenizer;
+ }
+ return tokenizer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/StatusBarButton.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/StatusBarButton.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/StatusBarButton.js
new file mode 100644
index 0000000..e29b487
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/StatusBarButton.js
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.StatusBarButton = function(title, className, states)
+{
+ this.element = document.createElement("button");
+ this.element.className = className + " status-bar-item";
+ this.element.addEventListener("click", this._clicked.bind(this), false);
+
+ this.glyph = document.createElement("div");
+ this.glyph.className = "glyph";
+ this.element.appendChild(this.glyph);
+
+ this.glyphShadow = document.createElement("div");
+ this.glyphShadow.className = "glyph shadow";
+ this.element.appendChild(this.glyphShadow);
+
+ this.states = states;
+ if (!states)
+ this.states = 2;
+
+ if (states == 2)
+ this._state = false;
+ else
+ this._state = 0;
+
+ this.title = title;
+ this.disabled = false;
+ this._visible = true;
+}
+
+WebInspector.StatusBarButton.prototype = {
+ _clicked: function()
+ {
+ this.dispatchEventToListeners("click");
+ },
+
+ get disabled()
+ {
+ return this._disabled;
+ },
+
+ set disabled(x)
+ {
+ if (this._disabled === x)
+ return;
+ this._disabled = x;
+ this.element.disabled = x;
+ },
+
+ get title()
+ {
+ return this._title;
+ },
+
+ set title(x)
+ {
+ if (this._title === x)
+ return;
+ this._title = x;
+ this.element.title = x;
+ },
+
+ get state()
+ {
+ return this._state;
+ },
+
+ set state(x)
+ {
+ if (this._state === x)
+ return;
+
+ if (this.states === 2) {
+ if (x)
+ this.element.addStyleClass("toggled-on");
+ else
+ this.element.removeStyleClass("toggled-on");
+ } else {
+ if (x !== 0) {
+ this.element.removeStyleClass("toggled-" + this._state);
+ this.element.addStyleClass("toggled-" + x);
+ } else
+ this.element.removeStyleClass("toggled-" + this._state);
+ }
+ this._state = x;
+ },
+
+ get toggled()
+ {
+ if (this.states !== 2)
+ throw("Only used toggled when there are 2 states, otherwise, use state");
+ return this.state;
+ },
+
+ set toggled(x)
+ {
+ if (this.states !== 2)
+ throw("Only used toggled when there are 2 states, otherwise, use state");
+ this.state = x;
+ },
+
+ get visible()
+ {
+ return this._visible;
+ },
+
+ set visible(x)
+ {
+ if (this._visible === x)
+ return;
+
+ if (x)
+ this.element.removeStyleClass("hidden");
+ else
+ this.element.addStyleClass("hidden");
+ this._visible = x;
+ }
+}
+
+WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype;