Projekt

Obecné

Profil

Stáhnout (4.48 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/haskell_cabal_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
"use strict";
3

    
4
var oop = require("../lib/oop");
5
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6

    
7
var CabalHighlightRules = function() {
8
    this.$rules = {
9
        "start" : [
10
            {
11
                token : "comment",
12
                regex : "^\\s*--.*$"
13
            }, {
14
                token: ["keyword"],
15
                regex: /^(\s*\w.*?)(:(?:\s+|$))/
16
            }, {
17
                token : "constant.numeric", // float
18
                regex : /[\d_]+(?:(?:[\.\d_]*)?)/
19
            }, {
20
                token : "constant.language.boolean",
21
                regex : "(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"
22
            }, {
23
                token : "markup.heading",
24
                regex : /^(\w.*)$/
25
            }
26
        ]};
27

    
28
};
29

    
30
oop.inherits(CabalHighlightRules, TextHighlightRules);
31

    
32
exports.CabalHighlightRules = CabalHighlightRules;
33
});
34

    
35
ace.define("ace/mode/folding/haskell_cabal",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
36
"use strict";
37

    
38
var oop = require("../../lib/oop");
39
var BaseFoldMode = require("./fold_mode").FoldMode;
40
var Range = require("../../range").Range;
41

    
42
var FoldMode = exports.FoldMode = function() {};
43
oop.inherits(FoldMode, BaseFoldMode);
44

    
45
(function() {
46
  this.isHeading = function (session,row) {
47
      var heading = "markup.heading";
48
      var token = session.getTokens(row)[0];
49
      return row==0 || (token && token.type.lastIndexOf(heading, 0) === 0);
50
  };
51

    
52
  this.getFoldWidget = function(session, foldStyle, row) {
53
      if (this.isHeading(session,row)){
54
        return "start";
55
      } else if (foldStyle === "markbeginend" && !(/^\s*$/.test(session.getLine(row)))){
56
        var maxRow = session.getLength();
57
        while (++row < maxRow) {
58
          if (!(/^\s*$/.test(session.getLine(row)))){
59
              break;
60
          }
61
        }
62
        if (row==maxRow || this.isHeading(session,row)){
63
          return "end";
64
        }
65
      }
66
      return "";
67
  };
68

    
69

    
70
  this.getFoldWidgetRange = function(session, foldStyle, row) {
71
      var line = session.getLine(row);
72
      var startColumn = line.length;
73
      var maxRow = session.getLength();
74
      var startRow = row;
75
      var endRow = row;
76
      if (this.isHeading(session,row)) {
77
          while (++row < maxRow) {
78
              if (this.isHeading(session,row)){
79
                row--;
80
                break;
81
              }
82
          }
83

    
84
          endRow = row;
85
          if (endRow > startRow) {
86
              while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
87
                  endRow--;
88
          }
89

    
90
          if (endRow > startRow) {
91
              var endColumn = session.getLine(endRow).length;
92
              return new Range(startRow, startColumn, endRow, endColumn);
93
          }
94
      } else if (this.getFoldWidget(session, foldStyle, row)==="end"){
95
        var endRow = row;
96
        var endColumn = session.getLine(endRow).length;
97
        while (--row>=0){
98
          if (this.isHeading(session,row)){
99
            break;
100
          }
101
        }
102
        var line = session.getLine(row);
103
        var startColumn = line.length;
104
        return new Range(row, startColumn, endRow, endColumn);
105
      }
106
    };
107

    
108
}).call(FoldMode.prototype);
109

    
110
});
111

    
112
ace.define("ace/mode/haskell_cabal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/haskell_cabal_highlight_rules","ace/mode/folding/haskell_cabal"], function(require, exports, module) {
113
"use strict";
114

    
115
var oop = require("../lib/oop");
116
var TextMode = require("./text").Mode;
117
var CabalHighlightRules = require("./haskell_cabal_highlight_rules").CabalHighlightRules;
118
var FoldMode = require("./folding/haskell_cabal").FoldMode;
119

    
120
var Mode = function() {
121
    this.HighlightRules = CabalHighlightRules;
122
    this.foldingRules = new FoldMode();
123
    this.$behaviour = this.$defaultBehaviour;
124
};
125
oop.inherits(Mode, TextMode);
126

    
127
(function() {
128
    this.lineCommentStart = "--";
129
    this.blockComment = null;
130
    this.$id = "ace/mode/haskell_cabal";
131
}).call(Mode.prototype);
132

    
133
exports.Mode = Mode;
134
});                (function() {
135
                    ace.require(["ace/mode/haskell_cabal"], function(m) {
136
                        if (typeof module == "object" && typeof exports == "object" && module) {
137
                            module.exports = m;
138
                        }
139
                    });
140
                })();
141
            
(85-85/244)