Lines Matching refs:sp
345 struct symbol *sp; /* The look-ahead symbol */ member
519 rc = ap1->sp->index - ap2->sp->index; in actioncmp()
544 struct symbol *sp, in Action_add() argument
552 newaction->sp = sp; in Action_add()
817 struct symbol *sp = rp->rhs[i]; in FindRulePrecedences() local
818 if( sp->type==MULTITERMINAL ){ in FindRulePrecedences()
819 for(j=0; j<sp->nsubsym; j++){ in FindRulePrecedences()
820 if( sp->subsym[j]->prec>=0 ){ in FindRulePrecedences()
821 rp->precsym = sp->subsym[j]; in FindRulePrecedences()
825 }else if( sp->prec>=0 ){ in FindRulePrecedences()
858 struct symbol *sp = rp->rhs[i]; in FindFirstSets() local
859 assert( sp->type==NONTERMINAL || sp->lambda==LEMON_FALSE ); in FindFirstSets()
860 if( sp->lambda==LEMON_FALSE ) break; in FindFirstSets()
904 struct symbol *sp; in FindStates() local
911 sp = Symbol_find(lemp->start); in FindStates()
912 if( sp==0 ){ in FindStates()
918 sp = lemp->startRule->lhs; in FindStates()
921 sp = lemp->startRule->lhs; in FindStates()
933 if( rp->rhs[i]==sp ){ /* FIX ME: Deal with multiterminals */ in FindStates()
937 "does not work properly.",sp->name); in FindStates()
946 for(rp=sp->rule; rp; rp=rp->nextlhs){ in FindStates()
1029 struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ in buildshifts() local
1042 sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ in buildshifts()
1051 if( !same_symbol(bsp,sp) ) continue; /* Must be same as for "cfp" */ in buildshifts()
1063 if( sp->type==MULTITERMINAL ){ in buildshifts()
1065 for(i=0; i<sp->nsubsym; i++){ in buildshifts()
1066 Action_add(&stp->ap,SHIFT,sp->subsym[i],(char*)newstp); in buildshifts()
1069 Action_add(&stp->ap,SHIFT,sp,(char *)newstp); in buildshifts()
1155 struct symbol *sp; in FindActions() local
1179 sp = Symbol_find(lemp->start); in FindActions()
1180 if( sp==0 ){ in FindActions()
1186 sp = lemp->startRule->lhs; in FindActions()
1189 sp = lemp->startRule->lhs; in FindActions()
1194 Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); in FindActions()
1203 for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ in FindActions()
1245 assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ in resolve_conflict()
1251 spx = apx->sp; in resolve_conflict()
1404 struct symbol *sp, *xsp; in Configlist_closure() local
1412 sp = rp->rhs[dot]; in Configlist_closure()
1413 if( sp->type==NONTERMINAL ){ in Configlist_closure()
1414 if( sp->rule==0 && sp!=lemp->errsym ){ in Configlist_closure()
1416 sp->name); in Configlist_closure()
1419 for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ in Configlist_closure()
2576 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2577 psp->declargslot = &sp->destructor; in parseonetoken()
2578 psp->decllinenoslot = &sp->destLineno; in parseonetoken()
2590 struct symbol *sp = Symbol_find(x); in parseonetoken() local
2591 if((sp) && (sp->datatype)){ in parseonetoken()
2597 if (!sp){ in parseonetoken()
2598 sp = Symbol_new(x); in parseonetoken()
2600 psp->declargslot = &sp->datatype; in parseonetoken()
2610 struct symbol *sp; in parseonetoken() local
2611 sp = Symbol_new(x); in parseonetoken()
2612 if( sp->prec>=0 ){ in parseonetoken()
2617 sp->prec = psp->preccounter; in parseonetoken()
2618 sp->assoc = psp->declassoc; in parseonetoken()
2695 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2697 psp->fallback = sp; in parseonetoken()
2698 }else if( sp->fallback ){ in parseonetoken()
2703 sp->fallback = psp->fallback; in parseonetoken()
2736 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2738 psp->gp->wildcard = sp; in parseonetoken()
3239 struct symbol *sp = rp->rhs[i]; in rule_print() local
3240 if( sp->type==MULTITERMINAL ){ in rule_print()
3241 fprintf(out," %s", sp->subsym[0]->name); in rule_print()
3242 for(j=1; j<sp->nsubsym; j++){ in rule_print()
3243 fprintf(out,"|%s", sp->subsym[j]->name); in rule_print()
3246 fprintf(out," %s", sp->name); in rule_print()
3257 struct symbol *sp; in Reprint() local
3262 sp = lemp->symbols[i]; in Reprint()
3263 len = lemonStrlen(sp->name); in Reprint()
3272 sp = lemp->symbols[j]; in Reprint()
3273 assert( sp->index==j ); in Reprint()
3274 printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); in Reprint()
3290 struct symbol *sp; in RulePrint() local
3296 sp = rp->rhs[i]; in RulePrint()
3297 if( sp->type==MULTITERMINAL ){ in RulePrint()
3298 fprintf(fp," %s", sp->subsym[0]->name); in RulePrint()
3299 for(j=1; j<sp->nsubsym; j++){ in RulePrint()
3300 fprintf(fp,"|%s",sp->subsym[j]->name); in RulePrint()
3303 fprintf(fp," %s", sp->name); in RulePrint()
3362 fprintf(fp,"%*s shift %-7d",indent,ap->sp->name,stp->statenum); in PrintAction()
3367 fprintf(fp,"%*s reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3373 fprintf(fp,"%*s shift-reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3378 fprintf(fp,"%*s accept",indent,ap->sp->name); in PrintAction()
3381 fprintf(fp,"%*s error",indent,ap->sp->name); in PrintAction()
3386 indent,ap->sp->name,ap->x.rp->iRule); in PrintAction()
3390 indent,ap->sp->name,ap->x.stp->statenum); in PrintAction()
3395 indent,ap->sp->name,ap->x.stp->statenum); in PrintAction()
3403 indent,ap->sp->name,ap->x.rp->iRule); in PrintAction()
3413 fprintf(fp," /* because %s==%s */", ap->sp->name, ap->spOpt->name); in PrintAction()
3464 struct symbol *sp; in ReportOutput() local
3466 sp = lemp->symbols[i]; in ReportOutput()
3467 fprintf(fp, " %3d: %s", i, sp->name); in ReportOutput()
3468 if( sp->type==NONTERMINAL ){ in ReportOutput()
3470 if( sp->lambda ){ in ReportOutput()
3474 if( sp->firstset && SetFind(sp->firstset, j) ){ in ReportOutput()
3479 if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec); in ReportOutput()
3487 struct symbol *sp = lemp->symbols[i]; in ReportOutput() local
3488 if( sp->bContent ) continue; in ReportOutput()
3489 w = (int)strlen(sp->name); in ReportOutput()
3498 fprintf(fp, "%s", sp->name); in ReportOutput()
3577 if( ap->sp->index>=lemp->nterminal in compute_action()
3578 && (lemp->errsym==0 || ap->sp->index!=lemp->errsym->index) in compute_action()
3731 struct symbol *sp, in emit_destructor_code() argument
3737 if( sp->type==TERMINAL ){ in emit_destructor_code()
3741 }else if( sp->destructor ){ in emit_destructor_code()
3742 cp = sp->destructor; in emit_destructor_code()
3746 tplt_linedir(out,sp->destLineno,lemp->filename); in emit_destructor_code()
3757 fprintf(out,"(yypminor->yy%d)",sp->dtnum); in emit_destructor_code()
3775 int has_destructor(struct symbol *sp, struct lemon *lemp) in has_destructor() argument
3778 if( sp->type==TERMINAL ){ in has_destructor()
3781 ret = lemp->vardest!=0 || sp->destructor!=0; in has_destructor()
3952 struct symbol *sp = rp->rhs[i]; in translate_code() local
3954 if( sp->type==MULTITERMINAL ){ in translate_code()
3955 dtnum = sp->subsym[0]->dtnum; in translate_code()
3957 dtnum = sp->dtnum; in translate_code()
4121 struct symbol *sp = lemp->symbols[i]; in print_stack_union() local
4122 if( sp->datatype==0 ) continue; in print_stack_union()
4123 len = lemonStrlen(sp->datatype); in print_stack_union()
4139 struct symbol *sp = lemp->symbols[i]; in print_stack_union() local
4141 if( sp==lemp->errsym ){ in print_stack_union()
4142 sp->dtnum = arraysize+1; in print_stack_union()
4145 if( sp->type!=NONTERMINAL || (sp->datatype==0 && lemp->vartype==0) ){ in print_stack_union()
4146 sp->dtnum = 0; in print_stack_union()
4149 cp = sp->datatype; in print_stack_union()
4157 sp->dtnum = 0; in print_stack_union()
4167 sp->dtnum = hash + 1; in print_stack_union()
4174 sp->dtnum = hash + 1; in print_stack_union()
4273 struct symbol *sp = rp->rhs[j]; in writeRuleText() local
4274 if( sp->type!=MULTITERMINAL ){ in writeRuleText()
4275 fprintf(out," %s", sp->name); in writeRuleText()
4278 fprintf(out," %s", sp->subsym[0]->name); in writeRuleText()
4279 for(k=1; k<sp->nsubsym; k++){ in writeRuleText()
4280 fprintf(out,"|%s",sp->subsym[k]->name); in writeRuleText()
4376 struct symbol *sp = rp->rhs[j]; in ReportTable() local
4377 if( sp->type!=MULTITERMINAL ){ in ReportTable()
4380 i,j,sp->index in ReportTable()
4384 for(k=0; k<sp->nsubsym; k++){ in ReportTable()
4387 i,j,sp->subsym[k]->index in ReportTable()
4540 if( ap->sp->index>=lemp->nterminal ) continue; in ReportTable()
4543 acttab_action(pActtab, ap->sp->index, action); in ReportTable()
4551 if( ap->sp->index<lemp->nterminal ) continue; in ReportTable()
4552 if( ap->sp->index==lemp->nsymbol ) continue; in ReportTable()
4555 acttab_action(pActtab, ap->sp->index, action); in ReportTable()
4791 struct symbol *sp = lemp->symbols[i]; in ReportTable() local
4792 if( sp==0 || sp->type!=TERMINAL ) continue; in ReportTable()
4797 fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; in ReportTable()
4809 struct symbol *sp = lemp->symbols[i]; in ReportTable() local
4810 if( sp==0 || sp->type==TERMINAL || in ReportTable()
4811 sp->index<=0 || sp->destructor!=0 ) continue; in ReportTable()
4816 fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; in ReportTable()
4817 dflt_sp = sp; in ReportTable()
4825 struct symbol *sp = lemp->symbols[i]; in ReportTable() local
4826 if( sp==0 || sp->type==TERMINAL || sp->destructor==0 ) continue; in ReportTable()
4827 if( sp->destLineno<0 ) continue; /* Already emitted */ in ReportTable()
4828 fprintf(out," case %d: /* %s */\n", sp->index, sp->name); lineno++; in ReportTable()
4834 && sp2->dtnum==sp->dtnum in ReportTable()
4835 && strcmp(sp->destructor,sp2->destructor)==0 ){ in ReportTable()
5004 if( ap->type==SHIFT && ap->sp==lemp->wildcard ){ in CompressTables()
5036 ap->sp = Symbol_new("{default}"); in CompressTables()
5087 if( ap->sp->index<lemp->nterminal ) continue; in CompressTables()
5091 for(ap2=stp->ap; ap2 && (ap2==ap || ap2->sp!=rp->lhs); ap2=ap2->next){} in CompressTables()
5093 ap->spOpt = ap2->sp; in CompressTables()
5143 if( ap->sp->index<lemp->nterminal ){ in ResortStates()
5145 }else if( ap->sp->index<lemp->nsymbol ){ in ResortStates()
5380 struct symbol *sp; in Symbol_new() local
5382 sp = Symbol_find(x); in Symbol_new()
5383 if( sp==0 ){ in Symbol_new()
5384 sp = (struct symbol *)calloc(1, sizeof(struct symbol) ); in Symbol_new()
5385 MemoryCheck(sp); in Symbol_new()
5386 sp->name = Strsafe(x); in Symbol_new()
5387 sp->type = ISUPPER(*x) ? TERMINAL : NONTERMINAL; in Symbol_new()
5388 sp->rule = 0; in Symbol_new()
5389 sp->fallback = 0; in Symbol_new()
5390 sp->prec = -1; in Symbol_new()
5391 sp->assoc = UNK; in Symbol_new()
5392 sp->firstset = 0; in Symbol_new()
5393 sp->lambda = LEMON_FALSE; in Symbol_new()
5394 sp->destructor = 0; in Symbol_new()
5395 sp->destLineno = 0; in Symbol_new()
5396 sp->datatype = 0; in Symbol_new()
5397 sp->useCnt = 0; in Symbol_new()
5398 Symbol_insert(sp,sp->name); in Symbol_new()
5400 sp->useCnt++; in Symbol_new()
5401 return sp; in Symbol_new()