Sha256: 272ba6aba5feb43007856900f98771c93b600fa493a43226009a3cb099d55d33

Contents?: true

Size: 1.38 KB

Versions: 23

Compression:

Stored size: 1.38 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _constants = require("../constants");

var _Node = _interopRequireDefault(require("./Node"));

var _Range = _interopRequireDefault(require("./Range"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Directive extends _Node.default {
  constructor() {
    super(_constants.Type.DIRECTIVE);
    this.name = null;
  }

  get parameters() {
    const raw = this.rawValue;
    return raw ? raw.trim().split(/[ \t]+/) : [];
  }

  parseName(start) {
    const {
      src
    } = this.context;
    let offset = start;
    let ch = src[offset];

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

    this.name = src.slice(start, offset);
    return offset;
  }

  parseParameters(start) {
    const {
      src
    } = this.context;
    let offset = start;
    let ch = src[offset];

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

    this.valueRange = new _Range.default(start, offset);
    return offset;
  }

  parse(context, start) {
    this.context = context;
    let offset = this.parseName(start + 1);
    offset = this.parseParameters(offset);
    offset = this.parseComment(offset);
    this.range = new _Range.default(start, offset);
    return offset;
  }

}

exports.default = Directive;

Version data entries

23 entries across 23 versions & 1 rubygems

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