1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const main_1 = require("./main");
|
4 | const line_1 = require("./line");
|
5 | class ParserDirective extends line_1.Line {
|
6 | constructor(document, range, nameRange, valueRange) {
|
7 | super(document, range);
|
8 | this.nameRange = nameRange;
|
9 | this.valueRange = valueRange;
|
10 | }
|
11 | toString() {
|
12 | return "# " + this.getName() + '=' + this.getValue();
|
13 | }
|
14 | getNameRange() {
|
15 | return this.nameRange;
|
16 | }
|
17 | getValueRange() {
|
18 | return this.valueRange;
|
19 | }
|
20 | getName() {
|
21 | return this.document.getText().substring(this.document.offsetAt(this.nameRange.start), this.document.offsetAt(this.nameRange.end));
|
22 | }
|
23 | getValue() {
|
24 | return this.document.getText().substring(this.document.offsetAt(this.valueRange.start), this.document.offsetAt(this.valueRange.end));
|
25 | }
|
26 | getDirective() {
|
27 | const directive = main_1.Directive[this.getName().toLowerCase()];
|
28 | return directive === undefined ? null : directive;
|
29 | }
|
30 | }
|
31 | exports.ParserDirective = ParserDirective;
|