[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/vendor/codemirror/mode/factor/ -> factor.js (source)

   1  // CodeMirror, copyright (c) by Marijn Haverbeke and others
   2  // Distributed under an MIT license: https://codemirror.net/5/LICENSE
   3  
   4  // Factor syntax highlight - simple mode
   5  //
   6  // by Dimage Sapelkin (https://github.com/kerabromsmu)
   7  
   8  (function(mod) {
   9    if (typeof exports == "object" && typeof module == "object") // CommonJS
  10      mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
  11    else if (typeof define == "function" && define.amd) // AMD
  12      define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
  13    else // Plain browser env
  14      mod(CodeMirror);
  15  })(function(CodeMirror) {
  16    "use strict";
  17  
  18    CodeMirror.defineSimpleMode("factor", {
  19      // The start state contains the rules that are initially used
  20      start: [
  21        // comments
  22        {regex: /#?!.*/, token: "comment"},
  23        // strings """, multiline --> state
  24        {regex: /"""/, token: "string", next: "string3"},
  25        {regex: /(STRING:)(\s)/, token: ["keyword", null], next: "string2"},
  26        {regex: /\S*?"/, token: "string", next: "string"},
  27        // numbers: dec, hex, unicode, bin, fractional, complex
  28        {regex: /(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/, token: "number"},
  29        //{regex: /[+-]?/} //fractional
  30        // definition: defining word, defined word, etc
  31        {regex: /((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "bracket"], next: "stack"},
  32        // method definition: defining word, type, defined word, etc
  33        {regex: /(M\:)(\s+)(\S+)(\s+)(\S+)/, token: ["keyword", null, "def", null, "tag"]},
  34        // vocabulary using --> state
  35        {regex: /USING\:/, token: "keyword", next: "vocabulary"},
  36        // vocabulary definition/use
  37        {regex: /(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "tag"]},
  38        // definition: a defining word, defined word
  39        {regex: /(\S+\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "def"]},
  40        // "keywords", incl. ; t f . [ ] { } defining words
  41        {regex: /(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>|<PRIVATE|\.|\S*\[|\]|\S*\{|\})(?=\s|$)/, token: "keyword"},
  42        // <constructors> and the like
  43        {regex: /\S+[\)>\.\*\?]+(?=\s|$)/, token: "builtin"},
  44        {regex: /[\)><]+\S+(?=\s|$)/, token: "builtin"},
  45        // operators
  46        {regex: /(?:[\+\-\=\/\*<>])(?=\s|$)/, token: "keyword"},
  47        // any id (?)
  48        {regex: /\S+/, token: "variable"},
  49        {regex: /\s+|./, token: null}
  50      ],
  51      vocabulary: [
  52        {regex: /;/, token: "keyword", next: "start"},
  53        {regex: /\S+/, token: "tag"},
  54        {regex: /\s+|./, token: null}
  55      ],
  56      string: [
  57        {regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"},
  58        {regex: /.*/, token: "string"}
  59      ],
  60      string2: [
  61        {regex: /^;/, token: "keyword", next: "start"},
  62        {regex: /.*/, token: "string"}
  63      ],
  64      string3: [
  65        {regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"},
  66        {regex: /.*/, token: "string"}
  67      ],
  68      stack: [
  69        {regex: /\)/, token: "bracket", next: "start"},
  70        {regex: /--/, token: "bracket"},
  71        {regex: /\S+/, token: "meta"},
  72        {regex: /\s+|./, token: null}
  73      ],
  74      // The meta property contains global information about the mode. It
  75      // can contain properties like lineComment, which are supported by
  76      // all modes, and also directives like dontIndentStates, which are
  77      // specific to simple modes.
  78      meta: {
  79        dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"],
  80        lineComment: "!"
  81      }
  82    });
  83  
  84    CodeMirror.defineMIME("text/x-factor", "factor");
  85  });


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer