• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/wp-file-manager/lib/codemirror/mode/smarty/smarty.js
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
     
    1
    // CodeMirror, copyright (c) by Marijn Haverbeke and others
    2
    // Distributed under an MIT license: http://codemirror.net/LICENSE
    3
    ​
    4
    /**
    5
     * Smarty 2 and 3 mode.
    6
     */
    7
    ​
    8
    (function(mod) {
    9
      if (typeof exports == "object" && typeof module == "object") // CommonJS
    10
        mod(require("../../lib/codemirror"));
    11
      else if (typeof define == "function" && define.amd) // AMD
    12
        define(["../../lib/codemirror"], mod);
    13
      else // Plain browser env
    14
        mod(CodeMirror);
    15
    })(function(CodeMirror) {
    16
      "use strict";
    17
    ​
    18
      CodeMirror.defineMode("smarty", function(config, parserConf) {
    19
        var rightDelimiter = parserConf.rightDelimiter || "}";
    20
        var leftDelimiter = parserConf.leftDelimiter || "{";
    21
        var version = parserConf.version || 2;
    22
        var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null");
    23
    ​
    24
        var keyFunctions = ["debug", "extends", "function", "include", "literal"];
    25
        var regs = {
    26
          operatorChars: /[+\-*&%=<>!?]/,
    27
          validIdentifier: /[a-zA-Z0-9_]/,
    28
          stringChar: /['"]/
    29
        };
    30
    ​
    31
        var last;
    32
        function cont(style, lastType) {
    33
          last = lastType;
    34
          return style;
    35
        }
    36
    ​
    37
        function chain(stream, state, parser) {
    38
          state.tokenize = parser;
    39
          return parser(stream, state);
    40
        }
    41
    ​
    42
        // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
    43
        function doesNotCount(stream, pos) {
    44
          if (pos == null) pos = stream.pos;
    45
          return version === 3 && leftDelimiter == "{" &&
    46
            (pos == stream.string.length || /\s/.test(stream.string.charAt(pos)));
    47
        }
    48
    ​
    49
        function tokenTop(stream, state) {
    50
          var string = stream.string;
    51
          for (var scan = stream.pos;;) {
    52
            var nextMatch = string.indexOf(leftDelimiter, scan);
    53
            scan = nextMatch + leftDelimiter.length;
    54
            if (nextMatch == -1 || !doesNotCount(stream, nextMatch + leftDelimiter.length)) break;
    55
          }
    56
          if (nextMatch == stream.pos) {
    57
            stream.match(leftDelimiter);
    58
            if (stream.eat("*")) {
    59
              return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter));
    60
            } else {
    61
              state.depth++;
    62
              state.tokenize = tokenSmarty;
    63
              last = "startTag";
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.