diff options
author | John Mayhew | 2012-05-07 16:30:19 -0700 |
---|---|---|
committer | John Mayhew | 2012-05-07 16:30:19 -0700 |
commit | db4ba95f50148198759dde503ec1c778184d9dbe (patch) | |
tree | 8b79ad58108af2f17d15abc8cdc33d35229ab20d /imports/codemirror/mode/properties/properties.js | |
parent | 843d8ea8ee58a54bcb71d7b28dbf78fae153b491 (diff) | |
parent | 526e423e4a2734c2b139af23911e912452a4443f (diff) | |
download | ninja-db4ba95f50148198759dde503ec1c778184d9dbe.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts:
js/components/layout/tools-list.reel/tools-list.html
js/components/layout/tools-properties.reel/tools-properties.html
js/components/tools-properties/brush-properties.reel/brush-properties.html
js/components/tools-properties/fill-properties.reel/fill-properties.html
js/components/tools-properties/pen-properties.reel/pen-properties.html
js/components/tools-properties/pencil-properties.reel/pencil-properties.html
js/components/tools-properties/selection-properties.reel/selection-properties.html
js/components/tools-properties/shape-properties.reel/shape-properties.html
js/components/tools-properties/tag-properties.reel/tag-properties.html
js/components/tools-properties/text-properties.reel/text-properties.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"); | ||