4 # Copyright (C) 2006 Red Hat Inc.
6 # This file is part of GAS, the GNU Assembler.
8 # GAS is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # GAS is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GAS; see the file COPYING. If not, write to
20 # the Free Software Foundation, 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA. */
27 while ($ARGV[0] =~ /^-/) {
39 $inbase =~ s@
[^a
-zA
-Z0
-9].*@@
;
45 open(OUT
, ">$outfile");
47 open(OUT
, ">&STDOUT");
50 open(I
, "$incdir/macros.inc") || die("$incdir/macros.inc: $!");
53 open(I
, $infile) || die("$infile: $!");
62 if (/^macro\s+(\S+)\s+(.*)/) {
63 ($name, $val) = ($1,$2);
64 print "set macro \"$name\" to \"$val\"\n" if $t;
74 # There's no way to quote braces so you can output them :-P
78 my ($a, $b, $p, $e, @params);
80 print "explode($s)\n" if $t;
82 ($b, $a, @params) = &split_braces
($s);
83 @params = explode_params
(@params);
84 if (! $a && ! @params) {
86 print "\033[33m$s\033[0m\n";
92 if (@params == 1 && defined $macro{$params[0]}) {
93 $p = $macro{$params[0]};
109 ($b,$a,@e) = split_braces
($p);
111 for $e (reverse @e) {
112 unshift (@p, "$b$e$a");
122 my ($v) = $macro{$_[0]};
124 print STDERR
"$line: Error: macro $_[0] not defined\n";
132 0 while $l =~ s/{([^{};]+)}/&getmacro($1)/ge;
136 # returns (before, after, list of variances)
139 my (@l, $i, $a, @parms, $b, $n,$p);
141 print "split_braces($l) = (" if $t;
143 $l = &expand_macros
($l);
145 if ($l !~ /\{.*\}/) {
146 print "nothing)\n" if $t;
149 if ($l =~ /^{([^{};]+)}/) {
150 print "macro:", $macro{$1}, ")\n" if $t;
151 return (&getmacro
($1), "");
158 ($a, $l) = $l =~ m@
^([^\
{]*)\
{(.*)@
;
161 while (defined ($i = shift @l)) {
163 print "\033[32m$i" if $t;
165 print "\033[0m$a, ", join('', @l), ", (", join("\033[31m;\033[0m", @parms), ")\n" if $t;
166 return ($a, join('',@l), @parms);
167 } elsif ($i eq ';') {
175 print "\033[34m$i" if $t;
181 print "$a, <null>, (", join(';', @parms), ")\n" if $t;
182 return ($a, "", @parms);
188 foo
{a
;b
},{{rest
};e
;}
This page took 0.035993 seconds and 4 git commands to generate.