summaryrefslogtreecommitdiff
path: root/public/vendor/codemirror/mode/cobol
diff options
context:
space:
mode:
Diffstat (limited to 'public/vendor/codemirror/mode/cobol')
-rwxr-xr-xpublic/vendor/codemirror/mode/cobol/cobol.js255
-rwxr-xr-xpublic/vendor/codemirror/mode/cobol/index.html210
2 files changed, 465 insertions, 0 deletions
diff --git a/public/vendor/codemirror/mode/cobol/cobol.js b/public/vendor/codemirror/mode/cobol/cobol.js
new file mode 100755
index 00000000..897022b1
--- /dev/null
+++ b/public/vendor/codemirror/mode/cobol/cobol.js
@@ -0,0 +1,255 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+/**
+ * Author: Gautam Mehta
+ * Branched from CodeMirror's Scheme mode
+ */
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("cobol", function () {
+ var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
+ ATOM = "atom", NUMBER = "number", KEYWORD = "keyword", MODTAG = "header",
+ COBOLLINENUM = "def", PERIOD = "link";
+ function makeKeywords(str) {
+ var obj = {}, words = str.split(" ");
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+ return obj;
+ }
+ var atoms = makeKeywords("TRUE FALSE ZEROES ZEROS ZERO SPACES SPACE LOW-VALUE LOW-VALUES ");
+ var keywords = makeKeywords(
+ "ACCEPT ACCESS ACQUIRE ADD ADDRESS " +
+ "ADVANCING AFTER ALIAS ALL ALPHABET " +
+ "ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED " +
+ "ALSO ALTER ALTERNATE AND ANY " +
+ "ARE AREA AREAS ARITHMETIC ASCENDING " +
+ "ASSIGN AT ATTRIBUTE AUTHOR AUTO " +
+ "AUTO-SKIP AUTOMATIC B-AND B-EXOR B-LESS " +
+ "B-NOT B-OR BACKGROUND-COLOR BACKGROUND-COLOUR BEEP " +
+ "BEFORE BELL BINARY BIT BITS " +
+ "BLANK BLINK BLOCK BOOLEAN BOTTOM " +
+ "BY CALL CANCEL CD CF " +
+ "CH CHARACTER CHARACTERS CLASS CLOCK-UNITS " +
+ "CLOSE COBOL CODE CODE-SET COL " +
+ "COLLATING COLUMN COMMA COMMIT COMMITMENT " +
+ "COMMON COMMUNICATION COMP COMP-0 COMP-1 " +
+ "COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 " +
+ "COMP-7 COMP-8 COMP-9 COMPUTATIONAL COMPUTATIONAL-0 " +
+ "COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 " +
+ "COMPUTATIONAL-6 COMPUTATIONAL-7 COMPUTATIONAL-8 COMPUTATIONAL-9 COMPUTE " +
+ "CONFIGURATION CONNECT CONSOLE CONTAINED CONTAINS " +
+ "CONTENT CONTINUE CONTROL CONTROL-AREA CONTROLS " +
+ "CONVERTING COPY CORR CORRESPONDING COUNT " +
+ "CRT CRT-UNDER CURRENCY CURRENT CURSOR " +
+ "DATA DATE DATE-COMPILED DATE-WRITTEN DAY " +
+ "DAY-OF-WEEK DB DB-ACCESS-CONTROL-KEY DB-DATA-NAME DB-EXCEPTION " +
+ "DB-FORMAT-NAME DB-RECORD-NAME DB-SET-NAME DB-STATUS DBCS " +
+ "DBCS-EDITED DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE " +
+ "DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING " +
+ "DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED " +
+ "DELIMITER DEPENDING DESCENDING DESCRIBED DESTINATION " +
+ "DETAIL DISABLE DISCONNECT DISPLAY DISPLAY-1 " +
+ "DISPLAY-2 DISPLAY-3 DISPLAY-4 DISPLAY-5 DISPLAY-6 " +
+ "DISPLAY-7 DISPLAY-8 DISPLAY-9 DIVIDE DIVISION " +
+ "DOWN DROP DUPLICATE DUPLICATES DYNAMIC " +
+ "EBCDIC EGI EJECT ELSE EMI " +
+ "EMPTY EMPTY-CHECK ENABLE END END. END-ACCEPT END-ACCEPT. " +
+ "END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY " +
+ "END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY " +
+ "END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN " +
+ "END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT " +
+ "END-UNSTRING END-WRITE END-XML ENTER ENTRY " +
+ "ENVIRONMENT EOP EQUAL EQUALS ERASE " +
+ "ERROR ESI EVALUATE EVERY EXCEEDS " +
+ "EXCEPTION EXCLUSIVE EXIT EXTEND EXTERNAL " +
+ "EXTERNALLY-DESCRIBED-KEY FD FETCH FILE FILE-CONTROL " +
+ "FILE-STREAM FILES FILLER FINAL FIND " +
+ "FINISH FIRST FOOTING FOR FOREGROUND-COLOR " +
+ "FOREGROUND-COLOUR FORMAT FREE FROM FULL " +
+ "FUNCTION GENERATE GET GIVING GLOBAL " +
+ "GO GOBACK GREATER GROUP HEADING " +
+ "HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL " +
+ "ID IDENTIFICATION IF IN INDEX " +
+ "INDEX-1 INDEX-2 INDEX-3 INDEX-4 INDEX-5 " +
+ "INDEX-6 INDEX-7 INDEX-8 INDEX-9 INDEXED " +
+ "INDIC INDICATE INDICATOR INDICATORS INITIAL " +
+ "INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT " +
+ "INSTALLATION INTO INVALID INVOKE IS " +
+ "JUST JUSTIFIED KANJI KEEP KEY " +
+ "LABEL LAST LD LEADING LEFT " +
+ "LEFT-JUSTIFY LENGTH LENGTH-CHECK LESS LIBRARY " +
+ "LIKE LIMIT LIMITS LINAGE LINAGE-COUNTER " +
+ "LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE " +
+ "LOCALE LOCALLY LOCK " +
+ "MEMBER MEMORY MERGE MESSAGE METACLASS " +
+ "MODE MODIFIED MODIFY MODULES MOVE " +
+ "MULTIPLE MULTIPLY NATIONAL NATIVE NEGATIVE " +
+ "NEXT NO NO-ECHO NONE NOT " +
+ "NULL NULL-KEY-MAP NULL-MAP NULLS NUMBER " +
+ "NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OCCURS " +
+ "OF OFF OMITTED ON ONLY " +
+ "OPEN OPTIONAL OR ORDER ORGANIZATION " +
+ "OTHER OUTPUT OVERFLOW OWNER PACKED-DECIMAL " +
+ "PADDING PAGE PAGE-COUNTER PARSE PERFORM " +
+ "PF PH PIC PICTURE PLUS " +
+ "POINTER POSITION POSITIVE PREFIX PRESENT " +
+ "PRINTING PRIOR PROCEDURE PROCEDURE-POINTER PROCEDURES " +
+ "PROCEED PROCESS PROCESSING PROGRAM PROGRAM-ID " +
+ "PROMPT PROTECTED PURGE QUEUE QUOTE " +
+ "QUOTES RANDOM RD READ READY " +
+ "REALM RECEIVE RECONNECT RECORD RECORD-NAME " +
+ "RECORDS RECURSIVE REDEFINES REEL REFERENCE " +
+ "REFERENCE-MONITOR REFERENCES RELATION RELATIVE RELEASE " +
+ "REMAINDER REMOVAL RENAMES REPEATED REPLACE " +
+ "REPLACING REPORT REPORTING REPORTS REPOSITORY " +
+ "REQUIRED RERUN RESERVE RESET RETAINING " +
+ "RETRIEVAL RETURN RETURN-CODE RETURNING REVERSE-VIDEO " +
+ "REVERSED REWIND REWRITE RF RH " +
+ "RIGHT RIGHT-JUSTIFY ROLLBACK ROLLING ROUNDED " +
+ "RUN SAME SCREEN SD SEARCH " +
+ "SECTION SECURE SECURITY SEGMENT SEGMENT-LIMIT " +
+ "SELECT SEND SENTENCE SEPARATE SEQUENCE " +
+ "SEQUENTIAL SET SHARED SIGN SIZE " +
+ "SKIP1 SKIP2 SKIP3 SORT SORT-MERGE " +
+ "SORT-RETURN SOURCE SOURCE-COMPUTER SPACE-FILL " +
+ "SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 " +
+ "START STARTING STATUS STOP STORE " +
+ "STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA " +
+ "SUBFILE SUBSTITUTE SUBTRACT SUM SUPPRESS " +
+ "SYMBOLIC SYNC SYNCHRONIZED SYSIN SYSOUT " +
+ "TABLE TALLYING TAPE TENANT TERMINAL " +
+ "TERMINATE TEST TEXT THAN THEN " +
+ "THROUGH THRU TIME TIMES TITLE " +
+ "TO TOP TRAILING TRAILING-SIGN TRANSACTION " +
+ "TYPE TYPEDEF UNDERLINE UNEQUAL UNIT " +
+ "UNSTRING UNTIL UP UPDATE UPON " +
+ "USAGE USAGE-MODE USE USING VALID " +
+ "VALIDATE VALUE VALUES VARYING VLR " +
+ "WAIT WHEN WHEN-COMPILED WITH WITHIN " +
+ "WORDS WORKING-STORAGE WRITE XML XML-CODE " +
+ "XML-EVENT XML-NTEXT XML-TEXT ZERO ZERO-FILL " );
+
+ var builtins = makeKeywords("- * ** / + < <= = > >= ");
+ var tests = {
+ digit: /\d/,
+ digit_or_colon: /[\d:]/,
+ hex: /[0-9a-f]/i,
+ sign: /[+-]/,
+ exponent: /e/i,
+ keyword_char: /[^\s\(\[\;\)\]]/,
+ symbol: /[\w*+\-]/
+ };
+ function isNumber(ch, stream){
+ // hex
+ if ( ch === '0' && stream.eat(/x/i) ) {
+ stream.eatWhile(tests.hex);
+ return true;
+ }
+ // leading sign
+ if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
+ stream.eat(tests.sign);
+ ch = stream.next();
+ }
+ if ( tests.digit.test(ch) ) {
+ stream.eat(ch);
+ stream.eatWhile(tests.digit);
+ if ( '.' == stream.peek()) {
+ stream.eat('.');
+ stream.eatWhile(tests.digit);
+ }
+ if ( stream.eat(tests.exponent) ) {
+ stream.eat(tests.sign);
+ stream.eatWhile(tests.digit);
+ }
+ return true;
+ }
+ return false;
+ }
+ return {
+ startState: function () {
+ return {
+ indentStack: null,
+ indentation: 0,
+ mode: false
+ };
+ },
+ token: function (stream, state) {
+ if (state.indentStack == null && stream.sol()) {
+ // update indentation, but only if indentStack is empty
+ state.indentation = 6 ; //stream.indentation();
+ }
+ // skip spaces
+ if (stream.eatSpace()) {
+ return null;
+ }
+ var returnType = null;
+ switch(state.mode){
+ case "string": // multi-line string parsing mode
+ var next = false;
+ while ((next = stream.next()) != null) {
+ if (next == "\"" || next == "\'") {
+ state.mode = false;
+ break;
+ }
+ }
+ returnType = STRING; // continue on in string mode
+ break;
+ default: // default parsing mode
+ var ch = stream.next();
+ var col = stream.column();
+ if (col >= 0 && col <= 5) {
+ returnType = COBOLLINENUM;
+ } else if (col >= 72 && col <= 79) {
+ stream.skipToEnd();
+ returnType = MODTAG;
+ } else if (ch == "*" && col == 6) { // comment
+ stream.skipToEnd(); // rest of the line is a comment
+ returnType = COMMENT;
+ } else if (ch == "\"" || ch == "\'") {
+ state.mode = "string";
+ returnType = STRING;
+ } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
+ returnType = ATOM;
+ } else if (ch == ".") {
+ returnType = PERIOD;
+ } else if (isNumber(ch,stream)){
+ returnType = NUMBER;
+ } else {
+ if (stream.current().match(tests.symbol)) {
+ while (col < 71) {
+ if (stream.eat(tests.symbol) === undefined) {
+ break;
+ } else {
+ col++;
+ }
+ }
+ }
+ if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = KEYWORD;
+ } else if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = BUILTIN;
+ } else if (atoms && atoms.propertyIsEnumerable(stream.current().toUpperCase())) {
+ returnType = ATOM;
+ } else returnType = null;
+ }
+ }
+ return returnType;
+ },
+ indent: function (state) {
+ if (state.indentStack == null) return state.indentation;
+ return state.indentStack.indent;
+ }
+ };
+});
+
+CodeMirror.defineMIME("text/x-cobol", "cobol");
+
+});
diff --git a/public/vendor/codemirror/mode/cobol/index.html b/public/vendor/codemirror/mode/cobol/index.html
new file mode 100755
index 00000000..4352419a
--- /dev/null
+++ b/public/vendor/codemirror/mode/cobol/index.html
@@ -0,0 +1,210 @@
+<!doctype html>
+
+<title>CodeMirror: COBOL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/neat.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<link rel="stylesheet" href="../../theme/erlang-dark.css">
+<link rel="stylesheet" href="../../theme/night.css">
+<link rel="stylesheet" href="../../theme/monokai.css">
+<link rel="stylesheet" href="../../theme/cobalt.css">
+<link rel="stylesheet" href="../../theme/eclipse.css">
+<link rel="stylesheet" href="../../theme/rubyblue.css">
+<link rel="stylesheet" href="../../theme/lesser-dark.css">
+<link rel="stylesheet" href="../../theme/xq-dark.css">
+<link rel="stylesheet" href="../../theme/xq-light.css">
+<link rel="stylesheet" href="../../theme/ambiance.css">
+<link rel="stylesheet" href="../../theme/blackboard.css">
+<link rel="stylesheet" href="../../theme/vibrant-ink.css">
+<link rel="stylesheet" href="../../theme/solarized.css">
+<link rel="stylesheet" href="../../theme/twilight.css">
+<link rel="stylesheet" href="../../theme/midnight.css">
+<link rel="stylesheet" href="../../addon/dialog/dialog.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="cobol.js"></script>
+<script src="../../addon/selection/active-line.js"></script>
+<script src="../../addon/search/search.js"></script>
+<script src="../../addon/dialog/dialog.js"></script>
+<script src="../../addon/search/searchcursor.js"></script>
+<style>
+ .CodeMirror {
+ border: 1px solid #eee;
+ font-size : 20px;
+ height : auto !important;
+ }
+ .CodeMirror-activeline-background {background: #555555 !important;}
+ </style>
+<div id=nav>
+ <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
+
+ <ul>
+ <li><a href="../../index.html">Home</a>
+ <li><a href="../../doc/manual.html">Manual</a>
+ <li><a href="https://github.com/codemirror/codemirror">Code</a>
+ </ul>
+ <ul>
+ <li><a href="../index.html">Language modes</a>
+ <li><a class=active href="#">COBOL</a>
+ </ul>
+</div>
+
+<article>
+<h2>COBOL mode</h2>
+
+ <p> Select Theme <select onchange="selectTheme()" id="selectTheme">
+ <option>default</option>
+ <option>ambiance</option>
+ <option>blackboard</option>
+ <option>cobalt</option>
+ <option>eclipse</option>
+ <option>elegant</option>
+ <option>erlang-dark</option>
+ <option>lesser-dark</option>
+ <option>midnight</option>
+ <option>monokai</option>
+ <option>neat</option>
+ <option>night</option>
+ <option>rubyblue</option>
+ <option>solarized dark</option>
+ <option>solarized light</option>
+ <option selected>twilight</option>
+ <option>vibrant-ink</option>
+ <option>xq-dark</option>
+ <option>xq-light</option>
+ </select> Select Font Size <select onchange="selectFontsize()" id="selectFontSize">
+ <option value="13px">13px</option>
+ <option value="14px">14px</option>
+ <option value="16px">16px</option>
+ <option value="18px">18px</option>
+ <option value="20px" selected="selected">20px</option>
+ <option value="24px">24px</option>
+ <option value="26px">26px</option>
+ <option value="28px">28px</option>
+ <option value="30px">30px</option>
+ <option value="32px">32px</option>
+ <option value="34px">34px</option>
+ <option value="36px">36px</option>
+ </select>
+<label for="checkBoxReadOnly">Read-only</label>
+<input type="checkbox" id="checkBoxReadOnly" onchange="selectReadOnly()">
+<label for="id_tabToIndentSpace">Insert Spaces on Tab</label>
+<input type="checkbox" id="id_tabToIndentSpace" onchange="tabToIndentSpace()">
+</p>
+<textarea id="code" name="code">
+---------1---------2---------3---------4---------5---------6---------7---------8
+12345678911234567892123456789312345678941234567895123456789612345678971234567898
+000010 IDENTIFICATION DIVISION. MODTGHERE
+000020 PROGRAM-ID. SAMPLE.
+000030 AUTHOR. TEST SAM.
+000040 DATE-WRITTEN. 5 February 2013
+000041
+000042* A sample program just to show the form.
+000043* The program copies its input to the output,
+000044* and counts the number of records.
+000045* At the end this number is printed.
+000046
+000050 ENVIRONMENT DIVISION.
+000060 INPUT-OUTPUT SECTION.
+000070 FILE-CONTROL.
+000080 SELECT STUDENT-FILE ASSIGN TO SYSIN
+000090 ORGANIZATION IS LINE SEQUENTIAL.
+000100 SELECT PRINT-FILE ASSIGN TO SYSOUT
+000110 ORGANIZATION IS LINE SEQUENTIAL.
+000120
+000130 DATA DIVISION.
+000140 FILE SECTION.
+000150 FD STUDENT-FILE
+000160 RECORD CONTAINS 43 CHARACTERS
+000170 DATA RECORD IS STUDENT-IN.
+000180 01 STUDENT-IN PIC X(43).
+000190
+000200 FD PRINT-FILE
+000210 RECORD CONTAINS 80 CHARACTERS
+000220 DATA RECORD IS PRINT-LINE.
+000230 01 PRINT-LINE PIC X(80).
+000240
+000250 WORKING-STORAGE SECTION.
+000260 01 DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES.
+000261 01 RECORDS-WRITTEN PIC 99.
+000270
+000280 01 DETAIL-LINE.
+000290 05 FILLER PIC X(7) VALUE SPACES.
+000300 05 RECORD-IMAGE PIC X(43).
+000310 05 FILLER PIC X(30) VALUE SPACES.
+000311
+000312 01 SUMMARY-LINE.
+000313 05 FILLER PIC X(7) VALUE SPACES.
+000314 05 TOTAL-READ PIC 99.
+000315 05 FILLER PIC X VALUE SPACE.
+000316 05 FILLER PIC X(17)
+000317 VALUE 'Records were read'.
+000318 05 FILLER PIC X(53) VALUE SPACES.
+000319
+000320 PROCEDURE DIVISION.
+000321
+000330 PREPARE-SENIOR-REPORT.
+000340 OPEN INPUT STUDENT-FILE
+000350 OUTPUT PRINT-FILE.
+000351 MOVE ZERO TO RECORDS-WRITTEN.
+000360 READ STUDENT-FILE
+000370 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000380 END-READ.
+000390 PERFORM PROCESS-RECORDS
+000410 UNTIL DATA-REMAINS-SWITCH = 'NO'.
+000411 PERFORM PRINT-SUMMARY.
+000420 CLOSE STUDENT-FILE
+000430 PRINT-FILE.
+000440 STOP RUN.
+000450
+000460 PROCESS-RECORDS.
+000470 MOVE STUDENT-IN TO RECORD-IMAGE.
+000480 MOVE DETAIL-LINE TO PRINT-LINE.
+000490 WRITE PRINT-LINE.
+000500 ADD 1 TO RECORDS-WRITTEN.
+000510 READ STUDENT-FILE
+000520 AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000530 END-READ.
+000540
+000550 PRINT-SUMMARY.
+000560 MOVE RECORDS-WRITTEN TO TOTAL-READ.
+000570 MOVE SUMMARY-LINE TO PRINT-LINE.
+000571 WRITE PRINT-LINE.
+000572
+000580
+</textarea>
+ <script>
+ var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+ lineNumbers: true,
+ matchBrackets: true,
+ mode: "text/x-cobol",
+ theme : "twilight",
+ styleActiveLine: true,
+ showCursorWhenSelecting : true,
+ });
+ function selectTheme() {
+ var themeInput = document.getElementById("selectTheme");
+ var theme = themeInput.options[themeInput.selectedIndex].innerHTML;
+ editor.setOption("theme", theme);
+ }
+ function selectFontsize() {
+ var fontSizeInput = document.getElementById("selectFontSize");
+ var fontSize = fontSizeInput.options[fontSizeInput.selectedIndex].innerHTML;
+ editor.getWrapperElement().style.fontSize = fontSize;
+ editor.refresh();
+ }
+ function selectReadOnly() {
+ editor.setOption("readOnly", document.getElementById("checkBoxReadOnly").checked);
+ }
+ function tabToIndentSpace() {
+ if (document.getElementById("id_tabToIndentSpace").checked) {
+ editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection(" ", "end"); }});
+ } else {
+ editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection(" ", "end"); }});
+ }
+ }
+ </script>
+ </article>