diff options
author | Armen Kesablyan | 2012-05-08 16:43:43 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-08 16:43:43 -0700 |
commit | dc075ffcc6dd03c090d90fad999eee9b924d56ee (patch) | |
tree | 867f8bdd588c8f9076979233ca46a688ff70523e /imports/codemirror/mode/properties/properties.js | |
parent | 5d7e470351fd150d5e70a97332fa2f2553797499 (diff) | |
parent | 4d949f141247215b5f2a6ec0cfc7d2d31cf2bb1f (diff) | |
download | ninja-dc075ffcc6dd03c090d90fad999eee9b924d56ee.tar.gz |
Merge branch 'refs/heads/dom-architecture' into binding
Conflicts:
js/components/layout/tools-properties.reel/tools-properties.html
Signed-off-by: Armen Kesablyan <armen@motorola.com>
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"); | ||