Lines Matching refs:lb
113 label *lb; in addlabel() local
124 lb = &ll->ll_label[ll->ll_nlabels++]; in addlabel()
125 lb->lb_type = type; in addlabel()
126 lb->lb_str = strdup(str); in addlabel()
129 PyGrammar_LabelRepr(lb)); in addlabel()
130 return lb - ll->ll_label; in addlabel()
167 translabel(grammar *g, label *lb) in translabel() argument
172 printf("Translating label %s ...\n", PyGrammar_LabelRepr(lb)); in translabel()
174 if (lb->lb_type == NAME) { in translabel()
176 if (strcmp(lb->lb_str, g->g_dfa[i].d_name) == 0) { in translabel()
180 lb->lb_str, in translabel()
182 lb->lb_type = g->g_dfa[i].d_type; in translabel()
183 free(lb->lb_str); in translabel()
184 lb->lb_str = NULL; in translabel()
189 if (strcmp(lb->lb_str, _PyParser_TokenNames[i]) == 0) { in translabel()
192 lb->lb_str, i); in translabel()
193 lb->lb_type = i; in translabel()
194 free(lb->lb_str); in translabel()
195 lb->lb_str = NULL; in translabel()
199 printf("Can't translate NAME label '%s'\n", lb->lb_str); in translabel()
203 if (lb->lb_type == STRING) { in translabel()
204 if (isalpha(Py_CHARMASK(lb->lb_str[1])) || in translabel()
205 lb->lb_str[1] == '_') { in translabel()
211 printf("Label %s is a keyword\n", lb->lb_str); in translabel()
212 lb->lb_type = NAME; in translabel()
213 src = lb->lb_str + 1; in translabel()
226 free(lb->lb_str); in translabel()
227 lb->lb_str = dest; in translabel()
229 else if (lb->lb_str[2] == lb->lb_str[0]) { in translabel()
230 int type = (int) PyToken_OneChar(lb->lb_str[1]); in translabel()
232 lb->lb_type = type; in translabel()
233 free(lb->lb_str); in translabel()
234 lb->lb_str = NULL; in translabel()
238 lb->lb_str); in translabel()
240 else if (lb->lb_str[2] && lb->lb_str[3] == lb->lb_str[0]) { in translabel()
241 int type = (int) PyToken_TwoChars(lb->lb_str[1], in translabel()
242 lb->lb_str[2]); in translabel()
244 lb->lb_type = type; in translabel()
245 free(lb->lb_str); in translabel()
246 lb->lb_str = NULL; in translabel()
250 lb->lb_str); in translabel()
252 else if (lb->lb_str[2] && lb->lb_str[3] && lb->lb_str[4] == lb->lb_str[0]) { in translabel()
253 int type = (int) PyToken_ThreeChars(lb->lb_str[1], in translabel()
254 lb->lb_str[2], in translabel()
255 lb->lb_str[3]); in translabel()
257 lb->lb_type = type; in translabel()
258 free(lb->lb_str); in translabel()
259 lb->lb_str = NULL; in translabel()
263 lb->lb_str); in translabel()
267 lb->lb_str); in translabel()
271 PyGrammar_LabelRepr(lb)); in translabel()