Lines Matching refs:in

15    GAS is distributed in the hope that it will be useful,
30 /* The routines in this file handle macro definition and expansion.
69 /* Whether we are in alternate syntax mode. */
73 /* Whether we are in MRI mode. */
103 /* Switch in and out of alternate mode on the fly. */
111 /* Switch in and out of MRI mode on the fly. */
151 to the dot. With the alternate, labels have to start in
240 get_token (int idx, sb *in, sb *name)
242 if (idx < in->len
243 && is_name_beginner (in->ptr[idx]))
245 sb_add_char (name, in->ptr[idx++]);
246 while (idx < in->len
247 && is_part_of_name (in->ptr[idx]))
249 sb_add_char (name, in->ptr[idx++]);
251 if (idx < in->len
252 && is_name_ender (in->ptr[idx]))
254 sb_add_char (name, in->ptr[idx++]);
258 if (macro_alternate && idx < in->len && in->ptr[idx] == '&')
266 getstring (int idx, sb *in, sb *acc)
268 while (idx < in->len
269 && (in->ptr[idx] == '"'
270 || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
271 || (in->ptr[idx] == '\'' && macro_alternate)))
273 if (in->ptr[idx] == '<')
277 while ((in->ptr[idx] != '>' || nest)
278 && idx < in->len)
280 if (in->ptr[idx] == '!')
283 sb_add_char (acc, in->ptr[idx++]);
287 if (in->ptr[idx] == '>')
289 if (in->ptr[idx] == '<')
291 sb_add_char (acc, in->ptr[idx++]);
296 else if (in->ptr[idx] == '"' || in->ptr[idx] == '\'')
298 char tchar = in->ptr[idx];
303 while (idx < in->len)
305 if (in->ptr[idx - 1] == '\\')
310 if (macro_alternate && in->ptr[idx] == '!')
314 sb_add_char (acc, in->ptr[idx]);
318 else if (escaped && in->ptr[idx] == tchar)
325 if (in->ptr[idx] == tchar)
329 if (idx >= in->len || in->ptr[idx] != tchar)
333 sb_add_char (acc, in->ptr[idx]);
352 get_any_string (int idx, sb *in, sb *out)
355 idx = sb_skip_white (idx, in);
357 if (idx < in->len)
359 if (in->len > idx + 2 && in->ptr[idx + 1] == '\'' && ISBASE (in->ptr[idx]))
361 while (!ISSEP (in->ptr[idx]))
362 sb_add_char (out, in->ptr[idx++]);
364 else if (in->ptr[idx] == '%' && macro_alternate)
373 in,
378 else if (in->ptr[idx] == '"'
379 || (in->ptr[idx] == '<' && (macro_alternate || macro_mri))
380 || (macro_alternate && in->ptr[idx] == '\''))
382 if (macro_alternate && ! macro_strip_at && in->ptr[idx] != '<')
386 idx = getstring (idx, in, out);
391 idx = getstring (idx, in, out);
400 while (idx < in->len
402 || (in->ptr[idx] != ' '
403 && in->ptr[idx] != '\t'))
404 && in->ptr[idx] != ','
405 && (in->ptr[idx] != '<'
408 char tchar = in->ptr[idx];
414 sb_add_char (out, in->ptr[idx++]);
415 while (idx < in->len
416 && in->ptr[idx] != tchar)
417 sb_add_char (out, in->ptr[idx++]);
418 if (idx == in->len)
484 do_formals (macro_entry *macro, int idx, sb *in)
489 idx = sb_skip_white (idx, in);
490 while (idx < in->len)
495 idx = get_token (idx, in, &formal->name);
502 idx = sb_skip_white (idx, in);
506 && idx < in->len
507 && in->ptr[idx] == ':'
509 || idx + 1 >= in->len
510 || ! is_part_of_name (in->ptr[idx + 1])))
516 idx = get_token (sb_skip_white (idx + 1, in), in, &qual);
521 _("Missing parameter qualifier for `%s' in macro `%s'"),
531 _("`%s' is not a valid parameter qualifier for `%s' in macro `%s'"),
536 idx = sb_skip_white (idx, in);
538 if (idx < in->len && in->ptr[idx] == '=')
541 idx = get_any_string (idx + 1, in, &formal->def);
542 idx = sb_skip_white (idx, in);
548 _("Pointless default value for required parameter `%s' in macro `%s'"),
570 idx = sb_skip_comma (idx, in);
571 if (idx != cidx && idx >= in->len)
597 _("Reserved word `%s' used as parameter in macro `%s'"),
614 define_macro (int idx, sb *in, sb *label,
633 idx = sb_skip_white (idx, in);
635 error = _("unexpected end of file in macro `%s' definition");
640 if (idx < in->len && in->ptr[idx] == '(')
643 idx = do_formals (macro, idx + 1, in);
644 if (idx < in->len && in->ptr[idx] == ')')
645 idx = sb_skip_white (idx + 1, in);
647 error = _("missing `)' after formals in macro definition `%s'");
652 idx = do_formals (macro, idx, in);
659 idx = get_token (idx, in, &name);
663 cidx = sb_skip_white (idx, in);
664 idx = sb_skip_comma (cidx, in);
665 if (idx == cidx || idx < in->len)
666 idx = do_formals (macro, idx, in);
670 if (!error && idx < in->len)
673 /* And stick it in the macro hash table. */
695 get_apost_token (int idx, sb *in, sb *name, int kind)
697 idx = get_token (idx, in, name);
698 if (idx < in->len
699 && in->ptr[idx] == kind
709 sub_actual (int start, sb *in, sb *t, struct hash_control *formal_hash,
715 src = get_apost_token (start, in, t, kind);
716 /* See if it's in the macro's hash table, unless this is
717 macro_strip_at and kind is '@' and the token did not end in '@'. */
720 && (src == start || in->ptr[src - 1] != '@'))
737 /* Doing this permits people to use & in macro bodies. */
756 macro_expand_body (sb *in, sb *out, formal_entry *formals,
766 while (src < in->len && !err)
768 if (in->ptr[src] == '&')
773 if (src + 1 < in->len && in->ptr[src + 1] == '&')
774 src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1);
776 sb_add_char (out, in->ptr[src++]);
781 /* At least in alternate mode this seems correct; without this
783 src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0);
786 else if (in->ptr[src] == '\\')
789 if (src < in->len && in->ptr[src] == '(')
791 /* Sub in till the next ')' literally. */
793 while (src < in->len && in->ptr[src] != ')')
795 sb_add_char (out, in->ptr[src++]);
797 if (src < in->len)
804 else if (src < in->len && in->ptr[src] == '@')
806 /* Sub in the macro invocation number. */
813 else if (src < in->len && in->ptr[src] == '&')
821 else if (macro_mri && src < in->len && ISALNUM (in->ptr[src]))
826 if (ISDIGIT (in->ptr[src]))
827 ind = in->ptr[src] - '0';
828 else if (ISUPPER (in->ptr[src]))
829 ind = in->ptr[src] - 'A' + 10;
831 ind = in->ptr[src] - 'a' + 10;
848 src = sub_actual (src, in, &t, formal_hash, '\'', out, 0);
852 && is_name_beginner (in->ptr[src])
855 || (src > 0 && in->ptr[src - 1] == '@')))
858 || src + 5 >= in->len
859 || strncasecmp (in->ptr + src, "LOCAL", 5) != 0
860 || ! ISWHITE (in->ptr[src + 5]))
863 src = sub_actual (src, in, &t, formal_hash,
869 src = sb_skip_white (src + 5, in);
870 while (in->ptr[src] != '\n')
875 src = get_token (src, in, &f->name);
902 src = sb_skip_comma (src, in);
906 else if (in->ptr[src] == '"'
907 || (macro_mri && in->ptr[src] == '\''))
910 sb_add_char (out, in->ptr[src++]);
912 else if (in->ptr[src] == '@' && macro_strip_at)
915 if (src < in->len
916 && in->ptr[src] == '@')
923 && in->ptr[src] == '='
924 && src + 1 < in->len
925 && in->ptr[src + 1] == '=')
930 src = get_token (src + 2, in, &t);
935 but we can't, because the == might be in the MRI
940 the == in place, which should cause a syntax error if
941 it is not in a comment. */
960 if (in->ptr[src] == '\n')
962 sb_add_char (out, in->ptr[src++]);
987 macro_expand (int idx, sb *in, macro_entry *m, sb *out)
1008 be referred to in the macro body as \0. */
1009 if (idx < in->len && in->ptr[idx] == '.')
1014 if ( idx < in->len
1015 && in->ptr[idx] != ' '
1016 && in->ptr[idx] != '\t')
1025 idx = get_any_string (idx, in, &n->actual);
1030 /* Peel off the actuals and store them away in the hash tables' actuals. */
1031 idx = sb_skip_white (idx, in);
1032 while (idx < in->len)
1038 while (scan < in->len
1039 && !ISSEP (in->ptr[scan])
1040 && !(macro_mri && in->ptr[scan] == '\'')
1041 && (!macro_alternate && in->ptr[scan] != '='))
1043 if (scan < in->len && !macro_alternate && in->ptr[scan] == '=')
1052 idx = get_token (idx, in, &t);
1053 if (in->ptr[idx] != '=')
1055 err = _("confusion in formal parameters");
1059 /* Lookup the formal in the macro's list. */
1075 idx = get_any_string (idx + 1, in, &ptr->actual);
1112 idx = get_any_string (idx, in, &f->actual);
1115 sb_add_buffer (&f->actual, in->ptr + idx, in->len - idx);
1116 idx = in->len;
1128 idx = sb_skip_comma (idx, in);
1131 if (in->ptr[idx] == ',')
1133 if (ISWHITE (in->ptr[idx]))
1221 /* Wrap the line up in an sb. */
1288 expand_irp (int irpc, int idx, sb *in, sb *out, int (*get_line) (sb *))
1295 idx = sb_skip_white (idx, in);
1299 return _("unexpected end of file in irp or irpc");
1305 idx = get_token (idx, in, &f.name);
1320 idx = sb_skip_comma (idx, in);
1321 if (idx >= in->len)
1330 if (irpc && in->ptr[idx] == '"')
1336 while (idx < in->len)
1339 idx = get_any_string (idx, in, &f.actual);
1342 if (in->ptr[idx] == '"')
1349 nxt = sb_skip_white (idx + 1, in);
1350 if (nxt >= in->len)
1357 sb_add_char (&f.actual, in->ptr[idx]);
1365 idx = sb_skip_comma (idx, in);
1367 idx = sb_skip_white (idx, in);