-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathkwnodejeki.js
25 lines (20 loc) · 972 Bytes
/
kwnodejeki.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 variableNl = require("../nodeLiterals/variablenl.js");
const feedbackMessages = require("../../feedbackMessages.js");
class KwNodeJeki extends BaseNode {
getNode (config) {
config = config || { shouldExpectTerminator: true, };
this.skipKeyword(constants.KW.JEKI);
const node = {};
node.operation = constants.SYM.ASSIGN;
const varNode = variableNl.getNode.call(this);
if (varNode.operation === constants.CALL_ISE) this.throwError(feedbackMessages.invalidAssignment());
node.left = (varNode.operation === constants.GET_JEKI) ? varNode.name : varNode;
this.skipOperator(constants.SYM.ASSIGN);
node.right = this.parseExpression();
if (config.shouldExpectTerminator) this.skipPunctuation(constants.SYM.STATEMENT_TERMINATOR);
return node;
}
}
module.exports = new KwNodeJeki();