mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 21:14:40 -05:00
94 lines
3.3 KiB
JavaScript
94 lines
3.3 KiB
JavaScript
ace.define("ace/mode/cobol_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = require("../lib/oop");
|
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
|
|
|
var CobolHighlightRules = function() {
|
|
var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" +
|
|
"AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" +
|
|
"ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" +
|
|
"TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" +
|
|
"UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" +
|
|
"PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" +
|
|
"CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" +
|
|
"COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" +
|
|
"RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" +
|
|
"DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" +
|
|
"ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" +
|
|
"EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT";
|
|
|
|
var builtinConstants = (
|
|
"true|false|null"
|
|
);
|
|
|
|
var builtinFunctions = (
|
|
"count|min|max|avg|sum|rank|now|coalesce|main"
|
|
);
|
|
|
|
var keywordMapper = this.createKeywordMapper({
|
|
"support.function": builtinFunctions,
|
|
"keyword": keywords,
|
|
"constant.language": builtinConstants
|
|
}, "identifier", true);
|
|
|
|
this.$rules = {
|
|
"start" : [ {
|
|
token : "comment",
|
|
regex : "\\*.*$"
|
|
}, {
|
|
token : "string", // " string
|
|
regex : '".*?"'
|
|
}, {
|
|
token : "string", // ' string
|
|
regex : "'.*?'"
|
|
}, {
|
|
token : "constant.numeric", // float
|
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
|
}, {
|
|
token : keywordMapper,
|
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
|
}, {
|
|
token : "keyword.operator",
|
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
|
}, {
|
|
token : "paren.lparen",
|
|
regex : "[\\(]"
|
|
}, {
|
|
token : "paren.rparen",
|
|
regex : "[\\)]"
|
|
}, {
|
|
token : "text",
|
|
regex : "\\s+"
|
|
} ]
|
|
};
|
|
};
|
|
|
|
oop.inherits(CobolHighlightRules, TextHighlightRules);
|
|
|
|
exports.CobolHighlightRules = CobolHighlightRules;
|
|
});
|
|
|
|
ace.define("ace/mode/cobol",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cobol_highlight_rules","ace/range"], function(require, exports, module) {
|
|
"use strict";
|
|
|
|
var oop = require("../lib/oop");
|
|
var TextMode = require("./text").Mode;
|
|
var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
|
|
var Range = require("../range").Range;
|
|
|
|
var Mode = function() {
|
|
this.HighlightRules = CobolHighlightRules;
|
|
};
|
|
oop.inherits(Mode, TextMode);
|
|
|
|
(function() {
|
|
|
|
this.lineCommentStart = "*";
|
|
|
|
this.$id = "ace/mode/cobol";
|
|
}).call(Mode.prototype);
|
|
|
|
exports.Mode = Mode;
|
|
|
|
});
|