OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 WebInspector.SASSSupport = {} | 5 WebInspector.SASSSupport = {} |
6 | 6 |
7 /** | 7 /** |
8 * @param {!WebInspector.CSSParserService} cssParserService | 8 * @param {!WebInspector.CSSParserService} cssParserService |
9 * @param {string} url | 9 * @param {string} url |
10 * @param {string} text | 10 * @param {string} text |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 /** @enum {string} */ | 64 /** @enum {string} */ |
65 WebInspector.SASSSupport.SCSSParserStates = { | 65 WebInspector.SASSSupport.SCSSParserStates = { |
66 Initial: "Initial", | 66 Initial: "Initial", |
67 PropertyName: "PropertyName", | 67 PropertyName: "PropertyName", |
68 PropertyValue: "PropertyValue", | 68 PropertyValue: "PropertyValue", |
69 VariableName: "VariableName", | 69 VariableName: "VariableName", |
70 VariableValue: "VariableValue", | 70 VariableValue: "VariableValue", |
71 MixinName: "MixinName", | 71 MixinName: "MixinName", |
72 MixinValue: "MixinValue", | 72 MixinValue: "MixinValue", |
73 Media: "Media" | 73 Media: "Media", |
74 } | 74 } |
75 | 75 |
76 /** | 76 /** |
77 * @param {!WebInspector.SASSSupport.ASTDocument} document | 77 * @param {!WebInspector.SASSSupport.ASTDocument} document |
78 * @param {!WebInspector.TokenizerFactory} tokenizerFactory | 78 * @param {!WebInspector.TokenizerFactory} tokenizerFactory |
79 * @return {!{variables: !Array<!WebInspector.SASSSupport.Property>, properties:
!Array<!WebInspector.SASSSupport.Property>, mixins: !Array<!WebInspector.SASSSu
pport.Property>}} | 79 * @return {!{variables: !Array<!WebInspector.SASSSupport.Property>, properties:
!Array<!WebInspector.SASSSupport.Property>, mixins: !Array<!WebInspector.SASSSu
pport.Property>}} |
80 */ | 80 */ |
81 WebInspector.SASSSupport._innerParseSCSS = function(document, tokenizerFactory) | 81 WebInspector.SASSSupport._innerParseSCSS = function(document, tokenizerFactory) |
82 { | 82 { |
83 var lines = document.text.split("\n"); | 83 var lines = document.text.split("\n"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 var value = new WebInspector.SASSSupport.TextNode(document,
disabledProperty.value.text, valueRange); | 132 var value = new WebInspector.SASSSupport.TextNode(document,
disabledProperty.value.text, valueRange); |
133 var range = new WebInspector.TextRange(lineNumber, column, l
ineNumber, newColumn); | 133 var range = new WebInspector.TextRange(lineNumber, column, l
ineNumber, newColumn); |
134 var property = new WebInspector.SASSSupport.Property(documen
t, name, value, range, true); | 134 var property = new WebInspector.SASSSupport.Property(documen
t, name, value, range, true); |
135 properties.push(property); | 135 properties.push(property); |
136 } | 136 } |
137 } else if (tokenType["css-def"] && tokenValue === "@media") { | 137 } else if (tokenType["css-def"] && tokenValue === "@media") { |
138 state = States.Media; | 138 state = States.Media; |
139 } | 139 } |
140 break; | 140 break; |
141 case States.VariableName: | 141 case States.VariableName: |
142 if (tokenValue === "}" && tokenType === UndefTokenType) { | 142 if (tokenValue === ")" && tokenType === UndefTokenType) { |
143 state = States.Initial; | |
144 } else if (tokenValue === ")" && tokenType === UndefTokenType) { | |
145 state = States.Initial; | 143 state = States.Initial; |
146 } else if (tokenValue === ":" && tokenType === UndefTokenType) { | 144 } else if (tokenValue === ":" && tokenType === UndefTokenType) { |
147 state = States.VariableValue; | 145 state = States.VariableValue; |
148 variableValue = new WebInspector.SASSSupport.TextNode(document,
"", WebInspector.TextRange.createFromLocation(lineNumber, newColumn)); | 146 variableValue = new WebInspector.SASSSupport.TextNode(document,
"", WebInspector.TextRange.createFromLocation(lineNumber, newColumn)); |
149 } else if (tokenType !== UndefTokenType) { | 147 } else if (tokenType !== UndefTokenType) { |
150 state = States.Initial; | 148 state = States.Initial; |
151 } | 149 } |
152 break; | 150 break; |
153 case States.VariableValue: | 151 case States.VariableValue: |
154 if (tokenValue === ";" && tokenType === UndefTokenType) { | 152 if (tokenValue === ";" && tokenType === UndefTokenType) { |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 mapping.set(oldProperty.name, newProperty.name); | 686 mapping.set(oldProperty.name, newProperty.name); |
689 mapping.set(oldProperty.value, newProperty.value); | 687 mapping.set(oldProperty.value, newProperty.value); |
690 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) | 688 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) |
691 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp
ertyIndex); | 689 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp
ertyIndex); |
692 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) | 690 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) |
693 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro
pertyIndex); | 691 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro
pertyIndex); |
694 if (oldProperty.disabled !== newProperty.disabled) | 692 if (oldProperty.disabled !== newProperty.disabled) |
695 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new
PropertyIndex); | 693 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new
PropertyIndex); |
696 } | 694 } |
697 } | 695 } |
OLD | NEW |