Lines Matching refs:sp

346   struct symbol *sp;       /* The look-ahead symbol */  member
520 rc = ap1->sp->index - ap2->sp->index; in actioncmp()
545 struct symbol *sp, in Action_add() argument
553 newaction->sp = sp; in Action_add()
818 struct symbol *sp = rp->rhs[i]; in FindRulePrecedences() local
819 if( sp->type==MULTITERMINAL ){ in FindRulePrecedences()
820 for(j=0; j<sp->nsubsym; j++){ in FindRulePrecedences()
821 if( sp->subsym[j]->prec>=0 ){ in FindRulePrecedences()
822 rp->precsym = sp->subsym[j]; in FindRulePrecedences()
826 }else if( sp->prec>=0 ){ in FindRulePrecedences()
859 struct symbol *sp = rp->rhs[i]; in FindFirstSets() local
860 assert( sp->type==NONTERMINAL || sp->lambda==LEMON_FALSE ); in FindFirstSets()
861 if( sp->lambda==LEMON_FALSE ) break; in FindFirstSets()
905 struct symbol *sp; in FindStates() local
912 sp = Symbol_find(lemp->start); in FindStates()
913 if( sp==0 ){ in FindStates()
919 sp = lemp->startRule->lhs; in FindStates()
922 sp = lemp->startRule->lhs; in FindStates()
934 if( rp->rhs[i]==sp ){ /* FIX ME: Deal with multiterminals */ in FindStates()
938 "does not work properly.",sp->name); in FindStates()
947 for(rp=sp->rule; rp; rp=rp->nextlhs){ in FindStates()
1030 struct symbol *sp; /* Symbol following the dot in configuration "cfp" */ in buildshifts() local
1043 sp = cfp->rp->rhs[cfp->dot]; /* Symbol after the dot */ in buildshifts()
1052 if( !same_symbol(bsp,sp) ) continue; /* Must be same as for "cfp" */ in buildshifts()
1064 if( sp->type==MULTITERMINAL ){ in buildshifts()
1066 for(i=0; i<sp->nsubsym; i++){ in buildshifts()
1067 Action_add(&stp->ap,SHIFT,sp->subsym[i],(char*)newstp); in buildshifts()
1070 Action_add(&stp->ap,SHIFT,sp,(char *)newstp); in buildshifts()
1156 struct symbol *sp; in FindActions() local
1180 sp = Symbol_find(lemp->start); in FindActions()
1181 if( sp==0 ){ in FindActions()
1187 sp = lemp->startRule->lhs; in FindActions()
1190 sp = lemp->startRule->lhs; in FindActions()
1195 Action_add(&lemp->sorted[0]->ap,ACCEPT,sp,0); in FindActions()
1204 for(nap=ap->next; nap && nap->sp==ap->sp; nap=nap->next){ in FindActions()
1246 assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ in resolve_conflict()
1252 spx = apx->sp; in resolve_conflict()
1405 struct symbol *sp, *xsp; in Configlist_closure() local
1413 sp = rp->rhs[dot]; in Configlist_closure()
1414 if( sp->type==NONTERMINAL ){ in Configlist_closure()
1415 if( sp->rule==0 && sp!=lemp->errsym ){ in Configlist_closure()
1417 sp->name); in Configlist_closure()
1420 for(newrp=sp->rule; newrp; newrp=newrp->nextlhs){ in Configlist_closure()
2577 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2578 psp->declargslot = &sp->destructor; in parseonetoken()
2579 psp->decllinenoslot = &sp->destLineno; in parseonetoken()
2591 struct symbol *sp = Symbol_find(x); in parseonetoken() local
2592 if((sp) && (sp->datatype)){ in parseonetoken()
2598 if (!sp){ in parseonetoken()
2599 sp = Symbol_new(x); in parseonetoken()
2601 psp->declargslot = &sp->datatype; in parseonetoken()
2611 struct symbol *sp; in parseonetoken() local
2612 sp = Symbol_new(x); in parseonetoken()
2613 if( sp->prec>=0 ){ in parseonetoken()
2618 sp->prec = psp->preccounter; in parseonetoken()
2619 sp->assoc = psp->declassoc; in parseonetoken()
2696 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2698 psp->fallback = sp; in parseonetoken()
2699 }else if( sp->fallback ){ in parseonetoken()
2704 sp->fallback = psp->fallback; in parseonetoken()
2737 struct symbol *sp = Symbol_new(x); in parseonetoken() local
2739 psp->gp->wildcard = sp; in parseonetoken()
3240 struct symbol *sp = rp->rhs[i]; in rule_print() local
3241 if( sp->type==MULTITERMINAL ){ in rule_print()
3242 fprintf(out," %s", sp->subsym[0]->name); in rule_print()
3243 for(j=1; j<sp->nsubsym; j++){ in rule_print()
3244 fprintf(out,"|%s", sp->subsym[j]->name); in rule_print()
3247 fprintf(out," %s", sp->name); in rule_print()
3258 struct symbol *sp; in Reprint() local
3263 sp = lemp->symbols[i]; in Reprint()
3264 len = lemonStrlen(sp->name); in Reprint()
3273 sp = lemp->symbols[j]; in Reprint()
3274 assert( sp->index==j ); in Reprint()
3275 printf(" %3d %-*.*s",j,maxlen,maxlen,sp->name); in Reprint()
3291 struct symbol *sp; in RulePrint() local
3297 sp = rp->rhs[i]; in RulePrint()
3298 if( sp->type==MULTITERMINAL ){ in RulePrint()
3299 fprintf(fp," %s", sp->subsym[0]->name); in RulePrint()
3300 for(j=1; j<sp->nsubsym; j++){ in RulePrint()
3301 fprintf(fp,"|%s",sp->subsym[j]->name); in RulePrint()
3304 fprintf(fp," %s", sp->name); in RulePrint()
3363 fprintf(fp,"%*s shift %-7d",indent,ap->sp->name,stp->statenum); in PrintAction()
3368 fprintf(fp,"%*s reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3374 fprintf(fp,"%*s shift-reduce %-7d",indent,ap->sp->name,rp->iRule); in PrintAction()
3379 fprintf(fp,"%*s accept",indent,ap->sp->name); in PrintAction()
3382 fprintf(fp,"%*s error",indent,ap->sp->name); in PrintAction()
3387 indent,ap->sp->name,ap->x.rp->iRule); in PrintAction()
3391 indent,ap->sp->name,ap->x.stp->statenum); in PrintAction()
3396 indent,ap->sp->name,ap->x.stp->statenum); in PrintAction()
3404 indent,ap->sp->name,ap->x.rp->iRule); in PrintAction()
3414 fprintf(fp," /* because %s==%s */", ap->sp->name, ap->spOpt->name); in PrintAction()
3465 struct symbol *sp; in ReportOutput() local
3467 sp = lemp->symbols[i]; in ReportOutput()
3468 fprintf(fp, " %3d: %s", i, sp->name); in ReportOutput()
3469 if( sp->type==NONTERMINAL ){ in ReportOutput()
3471 if( sp->lambda ){ in ReportOutput()
3475 if( sp->firstset && SetFind(sp->firstset, j) ){ in ReportOutput()
3480 if( sp->prec>=0 ) fprintf(fp," (precedence=%d)", sp->prec); in ReportOutput()
3488 struct symbol *sp = lemp->symbols[i]; in ReportOutput() local
3489 if( sp->bContent ) continue; in ReportOutput()
3490 w = (int)strlen(sp->name); in ReportOutput()
3499 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()