corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 define("ace/mode/gherkin_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2  
3 var oop = require("../lib/oop");
4 var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5 var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
6  
7 var GherkinHighlightRules = function() {
8 var languages = [{
9 name: "en",
10 labels: "Feature|Background|Scenario(?: Outline)?|Examples",
11 keywords: "Given|When|Then|And|But"
12 }];
13  
14 var labels = languages.map(function(l) {
15 return l.labels;
16 }).join("|");
17 var keywords = languages.map(function(l) {
18 return l.keywords;
19 }).join("|");
20 this.$rules = {
21 start : [{
22 token: "constant.numeric",
23 regex: "(?:(?:[1-9]\\d*)|(?:0))"
24 }, {
25 token : "comment",
26 regex : "#.*$"
27 }, {
28 token : "keyword",
29 regex : "(?:" + labels + "):|(?:" + keywords + ")\\b"
30 }, {
31 token : "keyword",
32 regex : "\\*"
33 }, {
34 token : "string", // multi line """ string start
35 regex : '"{3}',
36 next : "qqstring3"
37 }, {
38 token : "string", // " string
39 regex : '"',
40 next : "qqstring"
41 }, {
42 token : "text",
43 regex : "^\\s*(?=@[\\w])",
44 next : [{
45 token : "text",
46 regex : "\\s+"
47 }, {
48 token : "variable.parameter",
49 regex : "@[\\w]+"
50 }, {
51 token : "empty",
52 regex : "",
53 next : "start"
54 }]
55 }, {
56 token : "comment",
57 regex : "<[^>]+>"
58 }, {
59 token : "comment",
60 regex : "\\|(?=.)",
61 next : "table-item"
62 }, {
63 token : "comment",
64 regex : "\\|$",
65 next : "start"
66 }],
67 "qqstring3" : [ {
68 token : "constant.language.escape",
69 regex : stringEscape
70 }, {
71 token : "string", // multi line """ string end
72 regex : '"{3}',
73 next : "start"
74 }, {
75 defaultToken : "string"
76 }],
77 "qqstring" : [{
78 token : "constant.language.escape",
79 regex : stringEscape
80 }, {
81 token : "string",
82 regex : "\\\\$",
83 next : "qqstring"
84 }, {
85 token : "string",
86 regex : '"|$',
87 next : "start"
88 }, {
89 defaultToken: "string"
90 }],
91 "table-item" : [{
92 token : "comment",
93 regex : /$/,
94 next : "start"
95 }, {
96 token : "comment",
97 regex : /\|/
98 }, {
99 token : "string",
100 regex : /\\./
101 }, {
102 defaultToken : "string"
103 }]
104 };
105 this.normalizeRules();
106 }
107  
108 oop.inherits(GherkinHighlightRules, TextHighlightRules);
109  
110 exports.GherkinHighlightRules = GherkinHighlightRules;
111 });
112  
113 define("ace/mode/gherkin",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gherkin_highlight_rules"], function(require, exports, module) {
114  
115 var oop = require("../lib/oop");
116 var TextMode = require("./text").Mode;
117 var GherkinHighlightRules = require("./gherkin_highlight_rules").GherkinHighlightRules;
118  
119 var Mode = function() {
120 this.HighlightRules = GherkinHighlightRules;
121 this.$behaviour = this.$defaultBehaviour;
122 };
123 oop.inherits(Mode, TextMode);
124  
125 (function() {
126 this.lineCommentStart = "#";
127 this.$id = "ace/mode/gherkin";
128  
129 this.getNextLineIndent = function(state, line, tab) {
130 var indent = this.$getIndent(line);
131 var space2 = " ";
132  
133 var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
134 var tokens = tokenizedLine.tokens;
135  
136 console.log(state)
137  
138 if(line.match("[ ]*\\|")) {
139 indent += "| ";
140 }
141  
142 if (tokens.length && tokens[tokens.length-1].type == "comment") {
143 return indent;
144 }
145  
146  
147 if (state == "start") {
148 if (line.match("Scenario:|Feature:|Scenario Outline:|Background:")) {
149 indent += space2;
150 } else if(line.match("(Given|Then).+(:)$|Examples:")) {
151 indent += space2;
152 } else if(line.match("\\*.+")) {
153 indent += "* ";
154 }
155 }
156  
157  
158 return indent;
159 };
160 }).call(Mode.prototype);
161  
162 exports.Mode = Mode;
163 });