-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_op_tables.aya
70 lines (49 loc) · 1.16 KB
/
gen_op_tables.aya
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.# This file generates the tables on the aya wiki
export ::op_page_str
import ::dataframe
{.lines :# {" "\+} "\n" %}:indent;
.# Type Key
{,
[
["Number" 'N]
["String" 'S]
["Char" 'C]
["Block" 'B]
["Dict" 'D]
["Symbol" 'J]
]:data;
["Type" "Abbreviation"]:colnames;
} dataframe! :abbr_table;
{, 1:noindex } abbr_table.to_csv indent :abbr_table_csv;
{:C "\"" "" .&}:sym_to_str;
{:& "" =! {"``"\+ "``" +} ?}:code;
.# "__foo__" => "\_\_foo\_\_"
{#{x, x'_=! x "\_" .?}S}:escape_underscore;
{,
0M?:#{op, [
op.name code
op.ops :K #sym_to_str '|% code
op.ops :# {k v,
k sym_to_str code :&""={"n/a"+}? " : $v" +
}:V ", " %
op.overload '/ S #code " / " %
]}:data;
["Name" "Args" "Ops" "Overload"]:colnames;
}dataframe! :op_table;
{, 1:noindex 1:border } op_table.to_csv indent :op_table_csv;
op_table_csv
("\\\\" "\\\\\\\\" .&)
("`" "\`" .&)
.# ("_" "\\\\_" .&)
:op_table_csv;
"""Operators
=========
Type Abbreviations
------------------
.. csv-table::
$abbr_table_csv
Operator Table
--------------
.. csv-table::
$op_table_csv
""" :B :op_page_str;