Exemplo n.º 1
0
//## Node Node.AppendParsedNode(Token[] tokenList, int beginIdx, int endIdx, String requiredTokenText);
static KMETHOD Node_AppendParsedNode(KonohaContext *kctx, KonohaStack *sfp)
{
	kNode *node = sfp[0].asNode;
	kArray *tokenList = sfp[1].asArray;
	int beginIdx = sfp[2].intValue;
	int endIdx = sfp[3].intValue;
	const char *requiredTokenText = IS_NULL(sfp[4].asString) ? NULL : kString_text(sfp[4].asString);
	KReturn(SUGAR AppendParsedNode(kctx, node, tokenList, beginIdx, endIdx, NULL, ParseExpressionOption, requiredTokenText));
}
Exemplo n.º 2
0
static KMETHOD Expression_Defined(KonohaContext *kctx, KonohaStack *sfp)
{
	VAR_Expression(expr, tokenList, beginIdx, currentIdx, endIdx);
	kNameSpace *ns = kNode_ns(expr);
	if(beginIdx == currentIdx && beginIdx + 1 < endIdx) {
		kTokenVar *definedToken = tokenList->TokenVarItems[beginIdx];   // defined
		kTokenVar *pToken = tokenList->TokenVarItems[beginIdx+1];
		if(IS_Array(pToken->GroupTokenList)) {
			SUGAR kNode_Op(kctx, expr, definedToken, 0);
			FilterDefinedParam(kctx, ns, RangeGroup(pToken->GroupTokenList));
			KReturn(SUGAR AppendParsedNode(kctx, expr, RangeGroup(pToken->GroupTokenList), NULL, ParseExpressionOption, "("));
		}
	}
}