Commit 81cf3486 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

2010-02-25 Pavel Feldman <pfeldman@chromium.org>

        Reviewed by Timothy Hatcher.

        Web Inspector: evaluate-on-hover does not work on HTML files.

        https://bugs.webkit.org/show_bug.cgi?id=35378

        * inspector/front-end/SourceCSSTokenizer.re2js:
        * inspector/front-end/SourceHTMLTokenizer.js:
        (WebInspector.SourceHTMLTokenizer):
        (WebInspector.SourceHTMLTokenizer.prototype.set line):
        (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute):
        (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue):
        (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute):
        (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue):
        (WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType):
        (WebInspector.SourceHTMLTokenizer.prototype.nextToken):
        * inspector/front-end/SourceHTMLTokenizer.re2js:
        * inspector/front-end/SourceJavaScriptTokenizer.js:
        (WebInspector.SourceJavaScriptTokenizer):
        * inspector/front-end/SourceJavaScriptTokenizer.re2js:
        * inspector/front-end/SourceTokenizer.js:
        (WebInspector.SourceTokenizer.prototype.set condition):
        (WebInspector.SourceTokenizer.prototype.get condition):
        (WebInspector.SourceTokenizer.prototype.get subTokenizer):
        (WebInspector.SourceTokenizer.prototype.getLexCondition):
        (WebInspector.SourceTokenizer.prototype.setLexCondition):
        * inspector/front-end/TextEditorHighlighter.js:
        (WebInspector.TextEditorHighlighter):
        (WebInspector.TextEditorHighlighter.prototype.set mimeType):
        (WebInspector.TextEditorHighlighter.prototype.highlight):
        (WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
        (WebInspector.TextEditorHighlighter.prototype._highlightLines):
        (WebInspector.TextEditorHighlighter.prototype._highlightLine):
        * inspector/front-end/TextViewer.js:
        (WebInspector.TextViewer.prototype._paintLine):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7f493695
2010-02-25 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: evaluate-on-hover does not work on HTML files.
https://bugs.webkit.org/show_bug.cgi?id=35378
* inspector/syntax-highlight-html-expected.txt:
2010-02-25 Ben Murdoch <benm@google.com> 2010-02-25 Ben Murdoch <benm@google.com>
Reviewed by Kenneth Rohde Christiansen. Reviewed by Kenneth Rohde Christiansen.
......
...@@ -6,6 +6,6 @@ Tests that SourceHTMLTokenizer detects the tokens. ...@@ -6,6 +6,6 @@ Tests that SourceHTMLTokenizer detects the tokens.
<table cellspacing="0" cellpadding='0'>: webkit-html-tag,webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,*,webkit-html-attribute-name,*,webkit-html-attribute-value,webkit-html-tag <table cellspacing="0" cellpadding='0'>: webkit-html-tag,webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,*,webkit-html-attribute-name,*,webkit-html-attribute-value,webkit-html-tag
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">: webkit-html-doctype,webkit-html-doctype,webkit-html-doctype <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">: webkit-html-doctype,webkit-html-doctype,webkit-html-doctype
<!--div><div foobar-->: webkit-html-comment <!--div><div foobar-->: webkit-html-comment
<script></script><!--div-->: webkit-html-tag,*,webkit-html-tag,webkit-html-tag,webkit-html-comment <script></script><!--div-->: webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-tag,webkit-html-comment
<script type="text/javascript">document.write('<script type="text/javascript"></' + 'script>');</script>: webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,*,webkit-html-tag,webkit-html-tag <script type="text/javascript">document.write('<script type="text/javascript"></' + 'script>');</script>: webkit-html-tag,*,webkit-html-attribute-name,*,webkit-html-attribute-value,webkit-html-tag,webkit-javascript-ident,*,webkit-javascript-ident,*,webkit-javascript-string,*,webkit-javascript-string,*,webkit-html-tag,webkit-html-tag
2010-02-25 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Timothy Hatcher.
Web Inspector: evaluate-on-hover does not work on HTML files.
https://bugs.webkit.org/show_bug.cgi?id=35378
* inspector/front-end/SourceCSSTokenizer.re2js:
* inspector/front-end/SourceHTMLTokenizer.js:
(WebInspector.SourceHTMLTokenizer):
(WebInspector.SourceHTMLTokenizer.prototype.set line):
(WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute):
(WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue):
(WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute):
(WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue):
(WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType):
(WebInspector.SourceHTMLTokenizer.prototype.nextToken):
* inspector/front-end/SourceHTMLTokenizer.re2js:
* inspector/front-end/SourceJavaScriptTokenizer.js:
(WebInspector.SourceJavaScriptTokenizer):
* inspector/front-end/SourceJavaScriptTokenizer.re2js:
* inspector/front-end/SourceTokenizer.js:
(WebInspector.SourceTokenizer.prototype.set condition):
(WebInspector.SourceTokenizer.prototype.get condition):
(WebInspector.SourceTokenizer.prototype.get subTokenizer):
(WebInspector.SourceTokenizer.prototype.getLexCondition):
(WebInspector.SourceTokenizer.prototype.setLexCondition):
* inspector/front-end/TextEditorHighlighter.js:
(WebInspector.TextEditorHighlighter):
(WebInspector.TextEditorHighlighter.prototype.set mimeType):
(WebInspector.TextEditorHighlighter.prototype.highlight):
(WebInspector.TextEditorHighlighter.prototype._highlightInChunks):
(WebInspector.TextEditorHighlighter.prototype._highlightLines):
(WebInspector.TextEditorHighlighter.prototype._highlightLine):
* inspector/front-end/TextViewer.js:
(WebInspector.TextViewer.prototype._paintLine):
2010-02-25 Xan Lopez <xlopez@igalia.com> 2010-02-25 Xan Lopez <xlopez@igalia.com>
Reviewed by Gustavo Noronha. Reviewed by Gustavo Noronha.
......
/* Generated by re2c 0.13.5 on Thu Jan 28 20:49:22 2010 */ /* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
/* /*
* Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved.
* *
...@@ -99,35 +99,35 @@ WebInspector.SourceCSSTokenizer = function() ...@@ -99,35 +99,35 @@ WebInspector.SourceCSSTokenizer = function()
this._valueKeywords = [ this._valueKeywords = [
"above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll", "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
"alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "armenian", "auto", "avoid", "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
"background", "backwards", "baseline", "below", "bidi-override", "black", "blink", "block", "block-axis", "blue", "bold", "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
"bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button", "button-bevel", "buttonface", "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
"buttonhighlight", "buttonshadow", "buttontext", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
"center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
"col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu", "continuous", "copy", "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
"cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default", "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
"default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "disc", "discard", "document", "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
"dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
"ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
"ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
"ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et", "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
"ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded", "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
"extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
"georgian", "gray", "graytext", "green", "grey", "groove", "hand", "hangul", "hangul-consonant", "hebrew", "help", "hidden", "hide", "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
"higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore", "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
"inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "katakana", "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
"katakana-iroha", "landscape", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines", "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
"list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-latin", "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin",
"lower-norwegian", "lower-roman", "lowercase", "ltr", "maroon", "match", "media-controls-background", "media-current-time-display", "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display",
"media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button", "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button",
"media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display", "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
"media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button", "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
"menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "monospace", "move", "multiple", "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
"n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
"normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "olive", "open-quote", "optimizeLegibility", "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility",
"optimizeSpeed", "orange", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused", "optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
"plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple", "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
"push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x", "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x",
"repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
"scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
...@@ -136,15 +136,15 @@ WebInspector.SourceCSSTokenizer = function() ...@@ -136,15 +136,15 @@ WebInspector.SourceCSSTokenizer = function()
"small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over", "small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
"space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super", "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
"sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
"table-row", "table-row-group", "teal", "text", "text-bottom", "text-top", "textarea", "textfield", "thick", "thin", "threeddarkshadow", "table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
"threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tigre", "tigrinya-er", "tigrinya-er-abegede", "tigrinya-et", "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
"tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek", "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
"upper-latin", "upper-norwegian", "upper-roman", "uppercase", "url", "vertical", "vertical-text", "visible", "visibleFill", "visiblePainted", "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
"visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext", "x-large", "x-small", "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
"xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle", "-webkit-body", "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
"-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing", "-webkit-gradient", "-webkit-inline-box", "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
"-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right", "-webkit-small-control", "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right",
"-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out", "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
].keySet(); ].keySet();
this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet(); this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet();
...@@ -183,7 +183,7 @@ WebInspector.SourceCSSTokenizer.prototype = { ...@@ -183,7 +183,7 @@ WebInspector.SourceCSSTokenizer.prototype = {
_isPropertyValue: function() _isPropertyValue: function()
{ {
return this._parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE; return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
}, },
nextToken: function(cursor) nextToken: function(cursor)
...@@ -423,18 +423,18 @@ case 31: ...@@ -423,18 +423,18 @@ case 31:
case 32: case 32:
{ {
var token = this._line.substring(cursorOnEnter, cursor); var token = this._line.substring(cursorOnEnter, cursor);
if (this._parseCondition === this._parseConditions.INITIAL) { if (this._condition.parseCondition === this._parseConditions.INITIAL) {
if (token === "@import" || token === "@media") { if (token === "@import" || token === "@media") {
this.tokenType = "css-at-rule"; this.tokenType = "css-at-rule";
this._parseCondition = this._parseConditions.AT_RULE; this._condition.parseCondition = this._parseConditions.AT_RULE;
} else if (token.indexOf("@") === 0) } else if (token.indexOf("@") === 0)
this.tokenType = "css-at-rule"; this.tokenType = "css-at-rule";
else else
this.tokenType = "css-selector"; this.tokenType = "css-selector";
} }
else if (this._parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes) else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
this.tokenType = "css-keyword"; this.tokenType = "css-keyword";
else if (this._parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords) else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
this.tokenType = "css-property"; this.tokenType = "css-property";
else if (this._isPropertyValue() && token in this._valueKeywords) else if (this._isPropertyValue() && token in this._valueKeywords)
this.tokenType = "css-keyword"; this.tokenType = "css-keyword";
...@@ -647,35 +647,35 @@ case 40: ...@@ -647,35 +647,35 @@ case 40:
++cursor; ++cursor;
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.PROPERTY) if (this._condition.parseCondition === this._parseConditions.PROPERTY)
this._parseCondition = this._parseConditions.PROPERTY_VALUE; this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
return cursor; return cursor;
} }
case 42: case 42:
++cursor; ++cursor;
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.AT_RULE) if (this._condition.parseCondition === this._parseConditions.AT_RULE)
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
else else
this._parseCondition = this._parseConditions.PROPERTY; this._condition.parseCondition = this._parseConditions.PROPERTY;
return cursor; return cursor;
} }
case 44: case 44:
++cursor; ++cursor;
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.AT_RULE) if (this._condition.parseCondition === this._parseConditions.AT_RULE)
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
else else
this._parseCondition = this._parseConditions.PROPERTY; this._condition.parseCondition = this._parseConditions.PROPERTY;
return cursor; return cursor;
} }
case 46: case 46:
++cursor; ++cursor;
{ {
this.tokenType = null; this.tokenType = null;
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
return cursor; return cursor;
} }
case 48: case 48:
......
...@@ -182,7 +182,7 @@ WebInspector.SourceCSSTokenizer.prototype = { ...@@ -182,7 +182,7 @@ WebInspector.SourceCSSTokenizer.prototype = {
_isPropertyValue: function() _isPropertyValue: function()
{ {
return this._parseCondition === this._parseConditions.PROPERTY_VALUE || this._parseCondition === this._parseConditions.AT_RULE; return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
}, },
nextToken: function(cursor) nextToken: function(cursor)
...@@ -244,35 +244,35 @@ WebInspector.SourceCSSTokenizer.prototype = { ...@@ -244,35 +244,35 @@ WebInspector.SourceCSSTokenizer.prototype = {
<INITIAL> OpenCurlyBracket <INITIAL> OpenCurlyBracket
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.AT_RULE) if (this._condition.parseCondition === this._parseConditions.AT_RULE)
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
else else
this._parseCondition = this._parseConditions.PROPERTY; this._condition.parseCondition = this._parseConditions.PROPERTY;
return cursor; return cursor;
} }
<INITIAL> CloseCurlyBracket <INITIAL> CloseCurlyBracket
{ {
this.tokenType = null; this.tokenType = null;
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
return cursor; return cursor;
} }
<INITIAL> Colon <INITIAL> Colon
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.PROPERTY) if (this._condition.parseCondition === this._parseConditions.PROPERTY)
this._parseCondition = this._parseConditions.PROPERTY_VALUE; this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
return cursor; return cursor;
} }
<INITIAL> Semicolon <INITIAL> Semicolon
{ {
this.tokenType = null; this.tokenType = null;
if (this._parseCondition === this._parseConditions.AT_RULE) if (this._condition.parseCondition === this._parseConditions.AT_RULE)
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
else else
this._parseCondition = this._parseConditions.PROPERTY; this._condition.parseCondition = this._parseConditions.PROPERTY;
return cursor; return cursor;
} }
...@@ -288,18 +288,18 @@ WebInspector.SourceCSSTokenizer.prototype = { ...@@ -288,18 +288,18 @@ WebInspector.SourceCSSTokenizer.prototype = {
<INITIAL> Identifier <INITIAL> Identifier
{ {
var token = this._line.substring(cursorOnEnter, cursor); var token = this._line.substring(cursorOnEnter, cursor);
if (this._parseCondition === this._parseConditions.INITIAL) { if (this._condition.parseCondition === this._parseConditions.INITIAL) {
if (token === "@import" || token === "@media") { if (token === "@import" || token === "@media") {
this.tokenType = "css-at-rule"; this.tokenType = "css-at-rule";
this._parseCondition = this._parseConditions.AT_RULE; this._condition.parseCondition = this._parseConditions.AT_RULE;
} else if (token.indexOf("@") === 0) } else if (token.indexOf("@") === 0)
this.tokenType = "css-at-rule"; this.tokenType = "css-at-rule";
else else
this.tokenType = "css-selector"; this.tokenType = "css-selector";
} }
else if (this._parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes) else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
this.tokenType = "css-keyword"; this.tokenType = "css-keyword";
else if (this._parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords) else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
this.tokenType = "css-property"; this.tokenType = "css-property";
else if (this._isPropertyValue() && token in this._valueKeywords) else if (this._isPropertyValue() && token in this._valueKeywords)
this.tokenType = "css-keyword"; this.tokenType = "css-keyword";
......
/* Generated by re2c 0.13.5 on Mon Feb 15 19:30:21 2010 */ /* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
/* /*
* Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved.
* *
...@@ -71,31 +71,43 @@ WebInspector.SourceHTMLTokenizer = function() ...@@ -71,31 +71,43 @@ WebInspector.SourceHTMLTokenizer = function()
}; };
this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }; this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
this.condition = this.initialCondition;
} }
WebInspector.SourceHTMLTokenizer.prototype = { WebInspector.SourceHTMLTokenizer.prototype = {
set line(line) {
if (this._internalJavaScriptTokenizer) {
var match = /<\/script/i.exec(line);
if (match) {
this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
} else
this._internalJavaScriptTokenizer.line = line;
}
this._line = line;
},
_isExpectingAttribute: function() _isExpectingAttribute: function()
{ {
return this._parseCondition & this._parseConditions.ATTRIBUTE; return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
}, },
_isExpectingAttributeValue: function() _isExpectingAttributeValue: function()
{ {
return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE; return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
}, },
_setExpectingAttribute: function() _setExpectingAttribute: function()
{ {
if (this._isExpectingAttributeValue()) if (this._isExpectingAttributeValue())
this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE; this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
this._parseCondition |= this._parseConditions.ATTRIBUTE; this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
}, },
_setExpectingAttributeValue: function() _setExpectingAttributeValue: function()
{ {
if (this._isExpectingAttribute()) if (this._isExpectingAttribute())
this._parseCondition ^= this._parseConditions.ATTRIBUTE; this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE; this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
}, },
_stringToken: function(cursor, stringEnds) _stringToken: function(cursor, stringEnds)
...@@ -112,8 +124,8 @@ WebInspector.SourceHTMLTokenizer.prototype = { ...@@ -112,8 +124,8 @@ WebInspector.SourceHTMLTokenizer.prototype = {
_attrValueTokenType: function() _attrValueTokenType: function()
{ {
if (this._parseCondition & this._parseConditions.LINKIFY) { if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
if (this._parseCondition & this._parseConditions.A_NODE) if (this._condition.parseCondition & this._parseConditions.A_NODE)
return "html-external-link"; return "html-external-link";
return "html-resource-link"; return "html-resource-link";
} }
...@@ -122,6 +134,20 @@ WebInspector.SourceHTMLTokenizer.prototype = { ...@@ -122,6 +134,20 @@ WebInspector.SourceHTMLTokenizer.prototype = {
nextToken: function(cursor) nextToken: function(cursor)
{ {
if (this._internalJavaScriptTokenizer) {
// Re-set line to force </script> detection first.
this.line = this._line;
if (cursor !== this._internalJavaScriptTokenizer._line.length) {
// Tokenizer is stateless, so restore its condition before tokenizing and save it after.
this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
var result = this._internalJavaScriptTokenizer.nextToken(cursor);
this.tokenType = this._internalJavaScriptTokenizer.tokenType;
this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
return result;
} else if (cursor !== this._line.length)
delete this._internalJavaScriptTokenizer;
}
var cursorOnEnter = cursor; var cursorOnEnter = cursor;
var gotoCase = 1; var gotoCase = 1;
while (1) { while (1) {
...@@ -305,14 +331,14 @@ case 39: ...@@ -305,14 +331,14 @@ case 39:
case 40: case 40:
this.setLexCondition(this._lexConditions.TAG); this.setLexCondition(this._lexConditions.TAG);
{ {
if (this._parseCondition & this._parseConditions.SCRIPT) { if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
// Do not tokenize script tag contents, keep lexer state although processing "<". // Do not tokenize script tag contents, keep lexer state although processing "<".
this.setLexCondition(this._lexConditions.INITIAL); this.setLexCondition(this._lexConditions.INITIAL);
this.tokenType = null; this.tokenType = null;
return cursor; return cursor;
} }
this._parseCondition = this._parseConditions.INITIAL; this._condition.parseCondition = this._parseConditions.INITIAL;
this.tokenType = "html-tag"; this.tokenType = "html-tag";
return cursor; return cursor;
} }
...@@ -413,14 +439,14 @@ case 66: ...@@ -413,14 +439,14 @@ case 66:
++cursor; ++cursor;
this.setLexCondition(this._lexConditions.TAG); this.setLexCondition(this._lexConditions.TAG);
{ {
if (this._parseCondition & this._parseConditions.SCRIPT) {