diff options
author | Eric Guzman | 2012-05-10 14:51:31 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-10 14:51:31 -0700 |
commit | 39f23ad4868482f395d2e210490a2d73545a9d84 (patch) | |
tree | c702d67585f72cddf55932411e7100133bc58452 /imports/codemirror/mode/properties/properties.js | |
parent | 733e16b55a6de807cdbb60b0f2cea36fc1619fd4 (diff) | |
parent | 632a53278826a33506b302b573ee0681840f2d6c (diff) | |
download | ninja-39f23ad4868482f395d2e210490a2d73545a9d84.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
Conflicts:
js/panels/CSSPanel/ComputedStyleSubPanel.reel/ComputedStyleSubPanel.html
Diffstat (limited to 'imports/codemirror/mode/properties/properties.js')
-rwxr-xr-x | imports/codemirror/mode/properties/properties.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/imports/codemirror/mode/properties/properties.js b/imports/codemirror/mode/properties/properties.js index 2529505b..d3a13c76 100755 --- a/imports/codemirror/mode/properties/properties.js +++ b/imports/codemirror/mode/properties/properties.js | |||
@@ -1,21 +1,23 @@ | |||
1 | CodeMirror.defineMode("properties", function() { | 1 | CodeMirror.defineMode("properties", function() { |
2 | return { | 2 | return { |
3 | token: function(stream, state) { | 3 | token: function(stream, state) { |
4 | var sol = stream.sol(); | 4 | var sol = stream.sol() || state.afterSection; |
5 | var eol = stream.eol(); | 5 | var eol = stream.eol(); |
6 | 6 | ||
7 | state.afterSection = false; | ||
8 | |||
7 | if (sol) { | 9 | if (sol) { |
8 | if (state.nextMultiline) { | 10 | if (state.nextMultiline) { |
9 | state.inMultiline = true; | 11 | state.inMultiline = true; |
10 | state.nextMultiline = false; | 12 | state.nextMultiline = false; |
11 | } else { | 13 | } else { |
12 | state.position = "key"; | 14 | state.position = "def"; |
13 | } | 15 | } |
14 | } | 16 | } |
15 | 17 | ||
16 | if (eol && ! state.nextMultiline) { | 18 | if (eol && ! state.nextMultiline) { |
17 | state.inMultiline = false; | 19 | state.inMultiline = false; |
18 | state.position = "key"; | 20 | state.position = "def"; |
19 | } | 21 | } |
20 | 22 | ||
21 | if (sol) { | 23 | if (sol) { |
@@ -24,16 +26,18 @@ CodeMirror.defineMode("properties", function() { | |||
24 | 26 | ||
25 | var ch = stream.next(); | 27 | var ch = stream.next(); |
26 | 28 | ||
27 | if (sol && (ch === "#" || ch === "!")) { | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { |
28 | state.position = "comment"; | 30 | state.position = "comment"; |
29 | stream.skipToEnd(); | 31 | stream.skipToEnd(); |
30 | return "comment"; | 32 | return "comment"; |
31 | 33 | } else if (sol && ch === "[") { | |
34 | state.afterSection = true; | ||
35 | stream.skipTo("]"); stream.eat("]"); | ||
36 | return "header"; | ||
32 | } else if (ch === "=" || ch === ":") { | 37 | } else if (ch === "=" || ch === ":") { |
33 | state.position = "value"; | 38 | state.position = "quote"; |
34 | return "equals"; | 39 | return null; |
35 | 40 | } else if (ch === "\\" && state.position === "quote") { | |
36 | } else if (ch === "\\" && state.position === "value") { | ||
37 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 | 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 |
38 | // Multiline value | 42 | // Multiline value |
39 | state.nextMultiline = true; | 43 | state.nextMultiline = true; |
@@ -45,9 +49,10 @@ CodeMirror.defineMode("properties", function() { | |||
45 | 49 | ||
46 | startState: function() { | 50 | startState: function() { |
47 | return { | 51 | return { |
48 | position : "key", // Current position, "key", "value" or "comment" | 52 | position : "def", // Current position, "def", "quote" or "comment" |
49 | nextMultiline : false, // Is the next line multiline value | 53 | nextMultiline : false, // Is the next line multiline value |
50 | inMultiline : false // Is the current line a multiline value | 54 | inMultiline : false, // Is the current line a multiline value |
55 | afterSection : false // Did we just open a section | ||
51 | }; | 56 | }; |
52 | } | 57 | } |
53 | 58 | ||
@@ -55,3 +60,4 @@ CodeMirror.defineMode("properties", function() { | |||
55 | }); | 60 | }); |
56 | 61 | ||
57 | CodeMirror.defineMIME("text/x-properties", "properties"); | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); |
63 | CodeMirror.defineMIME("text/x-ini", "properties"); | ||