Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: Source/devtools/front_end/SourceTokenizer.js

Issue 22638008: DevTools: Use CodeMirror modes instead of highlight tokenizers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address comments Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Generated by re2c 0.13.5 on Tue Jan 26 01:16:33 2010 */
2 /*
3 * Copyright (C) 2009 Google Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /**
33 * @constructor
34 */
35 WebInspector.SourceTokenizer = function()
36 {
37 /** @type {?string} */
38 this.tokenType = null;
39 }
40
41 WebInspector.SourceTokenizer.prototype = {
42 set line(line) {
43 this._line = line;
44 },
45
46 set condition(condition)
47 {
48 this._condition = condition;
49 },
50
51 get condition()
52 {
53 return this._condition;
54 },
55
56 getLexCondition: function()
57 {
58 return this.condition.lexCondition;
59 },
60
61 setLexCondition: function(lexCondition)
62 {
63 this.condition.lexCondition = lexCondition;
64 },
65
66 /**
67 * @param {number} cursor
68 * @return {string}
69 */
70 _charAt: function(cursor)
71 {
72 return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
73 },
74
75 createInitialCondition: function()
76 {
77 },
78
79 /**
80 * @param {number} cursor
81 * @return {number}
82 */
83 nextToken: function(cursor)
84 {
85 }
86 }
87
88 /**
89 * @constructor
90 */
91 WebInspector.SourceTokenizer.Registry = function() {
92 this._tokenizers = {};
93 this._tokenizerConstructors = {
94 "text/css": "SourceCSSTokenizer",
95 "text/html": "SourceHTMLTokenizer",
96 "text/javascript": "SourceJavaScriptTokenizer",
97 "text/x-scss": "SourceCSSTokenizer"
98 };
99 }
100
101 /**
102 * @return {WebInspector.SourceTokenizer.Registry}
103 */
104 WebInspector.SourceTokenizer.Registry.getInstance = function()
105 {
106 if (!WebInspector.SourceTokenizer.Registry._instance)
107 WebInspector.SourceTokenizer.Registry._instance = new WebInspector.Sourc eTokenizer.Registry();
108 return WebInspector.SourceTokenizer.Registry._instance;
109 }
110
111 WebInspector.SourceTokenizer.Registry.prototype = {
112 /**
113 * @param {string} mimeType
114 * @return {WebInspector.SourceTokenizer}
115 */
116 getTokenizer: function(mimeType)
117 {
118 if (!this._tokenizerConstructors[mimeType])
119 return null;
120 var tokenizerClass = this._tokenizerConstructors[mimeType];
121 var tokenizer = this._tokenizers[tokenizerClass];
122 if (!tokenizer) {
123 tokenizer = new WebInspector[tokenizerClass]();
124 this._tokenizers[tokenizerClass] = tokenizer;
125 }
126 return tokenizer;
127 }
128 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/SourceJavaScriptTokenizer.re2js ('k') | Source/devtools/front_end/TextEditorHighlighter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698