6 last if /^initSyms = /;
13 left
=> 'left-associative infix',
14 right
=> 'right-associative infix',
15 non
=> 'non-associative infix',
17 chain
=> 'chaining infix',
23 last unless /^\\\\n[^"]/;
26 my (undef, $ret, $assoc, $name, $args) = split ' ', $_, 5;
28 $name =~ s/\\(.)/$1/g;
30 $args =~ m/\((.*)\)/ or die "Bad args spec";
33 my @args = split /, *| +/, $args;
35 if (exists $assoc{$assoc}) {
36 $assoc = $assoc{$assoc};
38 $assoc = "FIXME: $assoc";
41 push @ops, {name
=>$name, ret
=>$ret, assoc
=>$assoc, args
=>[@args], line
=>$.}
44 print '<?xml version="1.1" encoding="UTF-8" ?><html><body><table border="1">';
50 $a->{name
} cmp $b->{name
} or
51 $a->{assoc
} cmp $b->{assoc
} or
52 @
{$a->{args
}} <=> @
{$b->{args
}}} @ops
57 local $_=$op->{assoc
};
58 my $name = $op->{name
};
59 my $a0 = $op->{args
}[0];
60 my $a1 = $op->{args
}[1];
61 my $arity = 0+@
{$op->{args
}};
64 if (($arity>1 and $a0 =~ s/:$//) or
66 $example = "\$$a0.$name(".join(', ', map {"\$$_"} @
{$op->{args
}}[1..$arity-1]).")<br />";
68 $example .= "$name(". join(', ', map {$a=$_; $a=~s/:$//; '$'.$a} @
{$op->{args
}}) .")";
69 } elsif (/(list|chaining) infix/) {
70 $example = "\$$a0 $name \$$a0 $name \$$a0";
71 } elsif (/left-associative/ and $arity==2) {
72 $example = "(\$$a0 $name \$$a1) $name \$$a1";
73 } elsif (/left-associative/ and $arity==2) {
74 $example = "HUH: left-associative with arity $arity";
75 } elsif (/right-associative/) {
76 $example = "\$$a0 $name (\$$a0 $name \$$a1)";
77 } elsif (/non-associative/) {
78 $example = "\$$a0 $name \$$a1";
79 } elsif (/postfix/ and $arity == 1) {
80 $example = "\$$a0$name";
81 } elsif (/special/ and $arity == 1) {
82 $example = "$name\$$a0 # ???";
84 $example = "$_ ($arity)";
88 print "<td><tt>$example</tt></td>";
89 print "<td>$op->{assoc}</td>";
90 print "<td>$op->{ret}</td>";
91 print "<td><tt>$op->{name}</tt></td>";
93 print "<td><table border='1' width='100%'><tr>";
94 foreach my $arg (@
{$op->{args
}}) {
95 print "<td>$arg</td>";
97 print "</td></tr></table>";
99 # print "<td>Prim.hs line $op->{line}</td>";
103 print "</table></body></html>";