|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
576 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | class Node {
|
|---|
| 4 | constructor(node) {
|
|---|
| 5 | this.type = node.type;
|
|---|
| 6 | if (node.value) this.value = node.value;
|
|---|
| 7 | if (node.match) this.match = node.match;
|
|---|
| 8 | this.newline = node.newline || '';
|
|---|
| 9 | }
|
|---|
| 10 | get protected() {
|
|---|
| 11 | return Boolean(this.match) && this.match[1] === '!';
|
|---|
| 12 | }
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | class Block extends Node {
|
|---|
| 16 | constructor(node) {
|
|---|
| 17 | super(node);
|
|---|
| 18 | this.nodes = node.nodes || [];
|
|---|
| 19 | }
|
|---|
| 20 | push(node) {
|
|---|
| 21 | this.nodes.push(node);
|
|---|
| 22 | }
|
|---|
| 23 | get protected() {
|
|---|
| 24 | return this.nodes.length > 0 && this.nodes[0].protected === true;
|
|---|
| 25 | }
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | module.exports = { Node, Block };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.