-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathcallIseNl.js
29 lines (23 loc) · 978 Bytes
/
callIseNl.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
26
27
28
29
const BaseNode = require("../basenode.js");
const constants = require("../../constants.js");
class CallIseNl extends BaseNode {
/*
* Whenever iseNameToken is provided, then the function call is being used in an expression
* e.g jeki a = sum(1,2);
* Whenever iseNameToken is not provided, then the function call is not being used in an expression
* e.g printName("femi");
*/
getNode (iseNameToken) {
iseNameToken = iseNameToken || {};
const node = {};
node.operation = constants.CALL_ISE;
node.name = iseNameToken.value || this.lexer().next().value;
node.paramValues = this.parseDelimited(
constants.SYM.L_BRACKET, constants.SYM.R_BRACKET, constants.SYM.COMMA,
this.parseExpression.bind(this), null
);
if (iseNameToken.value === undefined) this.skipPunctuation(constants.SYM.STATEMENT_TERMINATOR);
return node;
}
}
module.exports = new CallIseNl();