1995-07-02 09:53:54 -07:00
|
|
|
#!/usr/local/bin/perl
|
|
|
|
|
|
|
|
while(<>) {
|
1996-06-22 07:14:59 -07:00
|
|
|
if (/([^\\])`/) {
|
|
|
|
print $`,$1;
|
1995-07-02 09:53:54 -07:00
|
|
|
$_ = $';
|
|
|
|
print "(";
|
|
|
|
$first = 1;
|
|
|
|
# Split into literal strings and {...} blocks
|
|
|
|
while(1) {
|
|
|
|
if (/^`/) {
|
|
|
|
$_ = $';
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
elsif (/^{([^}]*)}/) {
|
|
|
|
$_ = $';
|
|
|
|
if ($first) { $first = 0; } else { print "; "; }
|
|
|
|
print $1;
|
|
|
|
}
|
|
|
|
elsif (/^(([^`{\\]|\\[`"ntbr{\\]|\\[0-9][0-9][0-9])*)/) {
|
|
|
|
$_ = $';
|
|
|
|
$string = $1;
|
|
|
|
$string =~ s/\\([`{])/\1/g;
|
|
|
|
if ($first) { $first = 0; } else { print "; "; }
|
|
|
|
print "emit_string \"", $string, "\"";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print STDERR "Unterminated `...` at line $.\n";
|
|
|
|
exit(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
print ")", $_;
|
|
|
|
} else {
|
1996-06-22 07:14:59 -07:00
|
|
|
s/\\`/`/g;
|
1995-07-02 09:53:54 -07:00
|
|
|
print $_;
|
|
|
|
}
|
|
|
|
}
|