-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathkwnodegbewole.js
25 lines (20 loc) · 899 Bytes
/
kwnodegbewole.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const constants = require("../../constants.js");
const BaseNode = require("../basenode.js");
const leafnl = require("../nodeLiterals/leafnl.js");
const path = require("path");
const feedbackMessages = require("../../feedbackMessages.js");
class KwNodeGbeWole extends BaseNode {
getNode () {
this.skipKeyword(constants.KW.GBE_WOLE);
const node = {};
node.operation = constants.KW.GBE_WOLE;
if (this.lexer().peek().type === constants.STRING) {
node.path = leafnl.getNode.call(this);
if (path.extname(node.path.value) !== constants.YL_EXT) { this.throwError(feedbackMessages.invalidFileMsg()); }
this.skipPunctuation(constants.SYM.STATEMENT_TERMINATOR);
return node;
}
this.lexer().throwError(feedbackMessages.expectStringMsg(constants.KW.GBE_WOLE));
}
}
module.exports = new KwNodeGbeWole();