| OLD | NEW |
| 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others | 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 // Distributed under an MIT license: http://codemirror.net/LICENSE | 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 | 3 |
| 4 (function(mod) { | 4 (function(mod) { |
| 5 if (typeof exports == "object" && typeof module == "object") // CommonJS | 5 if (typeof exports == "object" && typeof module == "object") // CommonJS |
| 6 mod(require("../../lib/codemirror")); | 6 mod(require("../../lib/codemirror")); |
| 7 else if (typeof define == "function" && define.amd) // AMD | 7 else if (typeof define == "function" && define.amd) // AMD |
| 8 define(["../../lib/codemirror"], mod); | 8 define(["../../lib/codemirror"], mod); |
| 9 else // Plain browser env | 9 else // Plain browser env |
| 10 mod(CodeMirror); | 10 mod(CodeMirror); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 innerMode: function(state) { return state.local && {mode: state.local.mode
, state: state.localState}; }, | 53 innerMode: function(state) { return state.local && {mode: state.local.mode
, state: state.localState}; }, |
| 54 indent: indentFunction(states_, meta) | 54 indent: indentFunction(states_, meta) |
| 55 }; | 55 }; |
| 56 if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop)) | 56 if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop)) |
| 57 mode[prop] = meta[prop]; | 57 mode[prop] = meta[prop]; |
| 58 return mode; | 58 return mode; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 function ensureState(states, name) { | 61 function ensureState(states, name) { |
| 62 if (!states.hasOwnProperty(name)) | 62 if (!states.hasOwnProperty(name)) |
| 63 throw new Error("Undefined state " + name + "in simple mode"); | 63 throw new Error("Undefined state " + name + " in simple mode"); |
| 64 } | 64 } |
| 65 | 65 |
| 66 function toRegex(val, caret) { | 66 function toRegex(val, caret) { |
| 67 if (!val) return /(?:)/; | 67 if (!val) return /(?:)/; |
| 68 var flags = ""; | 68 var flags = ""; |
| 69 if (val instanceof RegExp) { | 69 if (val instanceof RegExp) { |
| 70 if (val.ignoreCase) flags = "i"; | 70 if (val.ignoreCase) flags = "i"; |
| 71 val = val.source; | 71 val = val.source; |
| 72 } else { | 72 } else { |
| 73 val = String(val); | 73 val = String(val); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 continue scan; | 204 continue scan; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 break; | 208 break; |
| 209 } | 209 } |
| 210 return pos < 0 ? 0 : state.indent[pos]; | 210 return pos < 0 ? 0 : state.indent[pos]; |
| 211 }; | 211 }; |
| 212 } | 212 } |
| 213 }); | 213 }); |
| OLD | NEW |