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, "(")); } } }
static kNode* kNode_ParseClassNodeNULL(KonohaContext *kctx, kNode *stmt, kToken *tokenClassName) { kNode *block = NULL; kTokenVar *blockToken = (kTokenVar *)kNode_GetObject(kctx, stmt, KSymbol_BlockPattern, NULL); if(blockToken != NULL) { kNameSpace *ns = kNode_ns(stmt); SUGAR kToken_ToBraceGroup(kctx, blockToken, ns, NULL); KTokenSeq source = {ns, RangeGroup(blockToken->GroupTokenList)}; block = SUGAR ParseNewNode(kctx, ns, source.tokenList, &source.beginIdx, source.endIdx, ParseMetaPatternOption, NULL); KLIB kObjectProto_SetObject(kctx, stmt, KSymbol_BlockPattern, KType_Node, block); } return block; }