Lines Matching refs:sym
121 symbol_type_set (symbol *sym, uniqstr type_name, location loc) in symbol_type_set() argument
125 if (sym->type_name) in symbol_type_set()
126 redeclaration (sym, "%type", sym->type_location, loc); in symbol_type_set()
128 sym->type_name = type_name; in symbol_type_set()
129 sym->type_location = loc; in symbol_type_set()
139 symbol_destructor_set (symbol *sym, const char *destructor, location loc) in symbol_destructor_set() argument
143 if (sym->destructor) in symbol_destructor_set()
144 redeclaration (sym, "%destructor", sym->destructor_location, loc); in symbol_destructor_set()
145 sym->destructor = destructor; in symbol_destructor_set()
146 sym->destructor_location = loc; in symbol_destructor_set()
156 symbol_printer_set (symbol *sym, const char *printer, location loc) in symbol_printer_set() argument
160 if (sym->printer) in symbol_printer_set()
161 redeclaration (sym, "%printer", sym->destructor_location, loc); in symbol_printer_set()
162 sym->printer = printer; in symbol_printer_set()
163 sym->printer_location = loc; in symbol_printer_set()
174 symbol_precedence_set (symbol *sym, int prec, assoc a, location loc) in symbol_precedence_set() argument
178 if (sym->prec != 0) in symbol_precedence_set()
179 redeclaration (sym, assoc_to_string (a), sym->prec_location, loc); in symbol_precedence_set()
180 sym->prec = prec; in symbol_precedence_set()
181 sym->assoc = a; in symbol_precedence_set()
182 sym->prec_location = loc; in symbol_precedence_set()
186 symbol_class_set (sym, token_sym, loc, false); in symbol_precedence_set()
195 symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring) in symbol_class_set() argument
197 if (sym->class != unknown_sym && sym->class != class) in symbol_class_set()
199 complain_at (loc, _("symbol %s redefined"), sym->tag); in symbol_class_set()
200 sym->declared = false; in symbol_class_set()
203 if (class == nterm_sym && sym->class != nterm_sym) in symbol_class_set()
204 sym->number = nvars++; in symbol_class_set()
205 else if (class == token_sym && sym->number == NUMBER_UNDEFINED) in symbol_class_set()
206 sym->number = ntokens++; in symbol_class_set()
208 sym->class = class; in symbol_class_set()
212 if (sym->declared) in symbol_class_set()
213 warn_at (loc, _("symbol %s redeclared"), sym->tag); in symbol_class_set()
214 sym->declared = true; in symbol_class_set()
224 symbol_user_token_number_set (symbol *sym, int user_token_number, location loc) in symbol_user_token_number_set() argument
226 assert (sym->class == token_sym); in symbol_user_token_number_set()
228 if (sym->user_token_number != USER_NUMBER_UNDEFINED in symbol_user_token_number_set()
229 && sym->user_token_number != user_token_number) in symbol_user_token_number_set()
230 complain_at (loc, _("redefining user token number of %s"), sym->tag); in symbol_user_token_number_set()
232 sym->user_token_number = user_token_number; in symbol_user_token_number_set()
236 endtoken = sym; in symbol_user_token_number_set()
251 symbol_check_defined (symbol *sym) in symbol_check_defined() argument
253 if (sym->class == unknown_sym) in symbol_check_defined()
256 (sym->location, in symbol_check_defined()
258 sym->tag); in symbol_check_defined()
259 sym->class = nterm_sym; in symbol_check_defined()
260 sym->number = nvars++; in symbol_check_defined()
267 symbol_check_defined_processor (void *sym, void *null ATTRIBUTE_UNUSED) in symbol_check_defined_processor() argument
269 return symbol_check_defined (sym); in symbol_check_defined_processor()
279 symbol_make_alias (symbol *sym, symbol *symval, location loc) in symbol_make_alias() argument
284 else if (sym->alias) in symbol_make_alias()
286 sym->tag); in symbol_make_alias()
290 symval->user_token_number = sym->user_token_number; in symbol_make_alias()
291 sym->user_token_number = USER_NUMBER_ALIAS; in symbol_make_alias()
292 symval->alias = sym; in symbol_make_alias()
293 sym->alias = symval; in symbol_make_alias()
297 assert (ntokens == sym->number || ntokens == symval->number); in symbol_make_alias()
298 sym->number = symval->number = in symbol_make_alias()
299 (symval->number < sym->number) ? symval->number : sym->number; in symbol_make_alias()
300 symbol_type_set (symval, sym->type_name, loc); in symbol_make_alias()
533 symbol *sym; in dummy_symbol_get() local
536 sym = symbol_get (buf, loc); in dummy_symbol_get()
537 sym->class = nterm_sym; in dummy_symbol_get()
538 sym->number = nvars++; in dummy_symbol_get()
539 return sym; in dummy_symbol_get()