Sha256: f8575eb1530b5e08088ea9083e0c91a4962c01eda48e185b2afa353112ec1d6b

Contents?: true

Size: 1.91 KB

Versions: 23

Compression:

Stored size: 1.91 KB

Contents

import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
import { Type } from '../constants';
import Node from './Node';
import Range from './Range';

var Directive = /*#__PURE__*/function (_Node) {
  _inherits(Directive, _Node);

  function Directive() {
    var _this;

    _classCallCheck(this, Directive);

    _this = _possibleConstructorReturn(this, _getPrototypeOf(Directive).call(this, Type.DIRECTIVE));
    _this.name = null;
    return _this;
  }

  _createClass(Directive, [{
    key: "parseName",
    value: function parseName(start) {
      var src = this.context.src;
      var offset = start;
      var ch = src[offset];

      while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') {
        ch = src[offset += 1];
      }

      this.name = src.slice(start, offset);
      return offset;
    }
  }, {
    key: "parseParameters",
    value: function parseParameters(start) {
      var src = this.context.src;
      var offset = start;
      var ch = src[offset];

      while (ch && ch !== '\n' && ch !== '#') {
        ch = src[offset += 1];
      }

      this.valueRange = new Range(start, offset);
      return offset;
    }
  }, {
    key: "parse",
    value: function parse(context, start) {
      this.context = context;
      var offset = this.parseName(start + 1);
      offset = this.parseParameters(offset);
      offset = this.parseComment(offset);
      this.range = new Range(start, offset);
      return offset;
    }
  }, {
    key: "parameters",
    get: function get() {
      var raw = this.rawValue;
      return raw ? raw.trim().split(/[ \t]+/) : [];
    }
  }]);

  return Directive;
}(Node);

export { Directive as default };

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.6 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.5 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.4 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.3 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.2 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.1 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3.5 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-5.0.0 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3.4 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3.3 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3.2 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3.1 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.3 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.2.3 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.2.2 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.2.1 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.2 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.1.9 node_modules/yaml/browser/dist/cst/Directive.js
trusty-cms-4.1.8 node_modules/yaml/browser/dist/cst/Directive.js