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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
*** master/spider.web.old Wed Aug 23 14:08:45 1989
--- master/spider.web Wed Aug 23 14:03:12 1989
***************
*** 314,322 ****
# If the macro facility worked right,
we would use the following patterns to recognize items as they occur:
! #d cat_pattern = #=/[a-z][a-z_]*/#>
! #d trans_pattern = #=/<(([0-9]|[a-z][a-z_]*|"([^"]*\\")*[^"]*"|\*)-)*#>#&
! #=([0-9]|[a-z][a-z_]*|"([^"]*\\")*[^"]*"|\*)>/#>
# Here's where we swallow a translation and spit out the \.{WEAVE} code
to handle that translation.
--- 314,322 ----
# If the macro facility worked right,
we would use the following patterns to recognize items as they occur:
! #d cat_pattern = #=/[a-zA-Z][a-zA-Z_]*/#>
! #d trans_pattern = #=/<(([0-9]|[a-zA-Z][a-zA-Z_]*|"([^"]*\\")*[^"]*"|\*)-)*#>#&
! #=([0-9]|[a-zA-Z][a-zA-Z_]*|"([^"]*\\")*[^"]*"|\*)>/#>
# Here's where we swallow a translation and spit out the \.{WEAVE} code
to handle that translation.
***************
*** 341,347 ****
if (alternate ~ #=/^[0-9]$/#>) { ## digit
temp = sprintf("\tapp_str(\"%s\");\n",alternate)
outstring=outstring temp
! } else if (alternate ~ #=/^[a-z_]+$/#>) { ## key word
translation_keywords[alternate]=1 ## remember
temp = sprintf("\t%s(%s);\n",append_keyword,alternate)
##Call |app| or |small_app| depending whether we're reducing or creating scraps
--- 341,347 ----
if (alternate ~ #=/^[0-9]$/#>) { ## digit
temp = sprintf("\tapp_str(\"%s\");\n",alternate)
outstring=outstring temp
! } else if (alternate ~ #=/^[a-zA-Z_]+$/#>) { ## key word
translation_keywords[alternate]=1 ## remember
temp = sprintf("\t%s(%s);\n",append_keyword,alternate)
##Call |app| or |small_app| depending whether we're reducing or creating scraps
***************
*** 394,400 ****
if (alternate ~ #=/^[0-9]$/#>) { ## digit
print "Digit not allowed in restricted translation", wherestring
exitcode = -1
! } else if (alternate ~ #=/^[a-z_]+$/#>) { ## key word
print "Key word not allowed in restricted translation", wherestring
exitcode = -1
} else if (alternate ~ #=/^\"([^"]*\\\")*[^"]*\"$/#>) { ## string
--- 394,400 ----
if (alternate ~ #=/^[0-9]$/#>) { ## digit
print "Digit not allowed in restricted translation", wherestring
exitcode = -1
! } else if (alternate ~ #=/^[a-zA-Z_]+$/#>) { ## key word
print "Key word not allowed in restricted translation", wherestring
exitcode = -1
} else if (alternate ~ #=/^\"([^"]*\\\")*[^"]*\"$/#>) { ## string
***************
*** 576,582 ****
#<Process newline token description#>
} else if ($2=="pseudo_semi") {
#<Process |pseudo_semi| token description#>
! } else if ($2 ~ #=/[a-zA-Z0-9]+/#>) {
## we recognize no other names
print "Error: unknown token species:", $2
#<Punt this command#>
--- 576,582 ----
#<Process newline token description#>
} else if ($2=="pseudo_semi") {
#<Process |pseudo_semi| token description#>
! } else if ($2 ~ #=/[a-zA-ZA-Z0-9]+/#>) {
## we recognize no other names
print "Error: unknown token species:", $2
#<Punt this command#>
***************
*** 1200,1206 ****
that an item of ilk |fish_like| will get category |fish|.
#<If no category is specified, invent a default if you can#>=
! if ($2 ~ #=/^[a-z_]+_like$/#> && $0 !~ #=/ category /#>) {
## give default category
this_category = substr($2,1,length($2)-5)
categories[this_category]=1
--- 1200,1206 ----
that an item of ilk |fish_like| will get category |fish|.
#<If no category is specified, invent a default if you can#>=
! if ($2 ~ #=/^[a-zA-Z_]+_like$/#> && $0 !~ #=/ category /#>) {
## give default category
this_category = substr($2,1,length($2)-5)
categories[this_category]=1
***************
*** 1490,1498 ****
for (i=1; i<=NF; i++) {
if ($i ~ #=/<.*>/#>) { ## should be |trans_pattern|
#<Process a translation in |$i|#>
! } else if ($i ~ #=/^!?[a-z_]+(\*\*?)?$/#>) { ## |cat_pattern|
#<Process a single category#>
! } else if ($i ~ #=/^!?\(([a-z_]+\|)*[a-z_]+\)(\*\*?)?$/#>){
#<Process a list of alternative categories#>
} else if ($i == "?") {
#<Process a category wild card#>
--- 1490,1498 ----
for (i=1; i<=NF; i++) {
if ($i ~ #=/<.*>/#>) { ## should be |trans_pattern|
#<Process a translation in |$i|#>
! } else if ($i ~ #=/^!?[a-zA-Z_]+(\*\*?)?$/#>) { ## |cat_pattern|
#<Process a single category#>
! } else if ($i ~ #=/^!?\(([a-zA-Z_]+\|)*[a-zA-Z_]+\)(\*\*?)?$/#>){
#<Process a list of alternative categories#>
} else if ($i == "?") {
#<Process a category wild card#>
***************
*** 1632,1642 ****
#<Strip stars from |$i| (if any) and add appropriate
translations to |trans[pos]|#>=
! if ($i ~ #=/^([a-z_]+|\(([a-z_]+\|)*[a-z_]+\))\*\*$/#>) { ## it's double-starred
temp = sprintf("\tmake_underlined(pp+%d);\n",pos-1)
trans[pos] = trans[pos] temp
$i = substr($i,1,length($i)-2)
! } else if ($i ~ #=/^([a-z_]+|\(([a-z_]+\|)*[a-z_]+\))\*$/#>) { ## it's starred
temp = sprintf("\tmake_underlined(pp+%d);\n",pos-1)
trans[pos] = trans[pos] temp
$i = substr($i,1,length($i)-1)
--- 1632,1642 ----
#<Strip stars from |$i| (if any) and add appropriate
translations to |trans[pos]|#>=
! if ($i ~ #=/^([a-zA-Z_]+|\(([a-zA-Z_]+\|)*[a-zA-Z_]+\))\*\*$/#>) { ## it's double-starred
temp = sprintf("\tmake_underlined(pp+%d);\n",pos-1)
trans[pos] = trans[pos] temp
$i = substr($i,1,length($i)-2)
! } else if ($i ~ #=/^([a-zA-Z_]+|\(([a-zA-Z_]+\|)*[a-zA-Z_]+\))\*$/#>) { ## it's starred
temp = sprintf("\tmake_underlined(pp+%d);\n",pos-1)
trans[pos] = trans[pos] temp
$i = substr($i,1,length($i)-1)
***************
*** 1751,1757 ****
targetcategory[prodnum]="Unnamed category"
temp = sprintf("(pp+%d)->cat", $i-1)
unnamed_cat[prodnum]=temp
! } else if ($i ~ #=/[a-z][a-z_]*/#>) { ## a category
targetcategory[prodnum]=$i
categories[$i]=1 ## remember this is a category
} else {
--- 1751,1757 ----
targetcategory[prodnum]="Unnamed category"
temp = sprintf("(pp+%d)->cat", $i-1)
unnamed_cat[prodnum]=temp
! } else if ($i ~ #=/[a-zA-Z][a-zA-Z_]*/#>) { ## a category
targetcategory[prodnum]=$i
categories[$i]=1 ## remember this is a category
} else {
***************
*** 1827,1833 ****
temp = field[pos]
tempa = substr(temp,1,1)
if (tempa != "!") {
! if (temp ~ #=/^\(([a-z_]+\|)*[a-z_]+\)(\*\*?)?$/#>) {
## list of alternatives
#<Remove trailing stars from |temp|#>
temp = substr(temp,2,length(temp)-2)
--- 1827,1833 ----
temp = field[pos]
tempa = substr(temp,1,1)
if (tempa != "!") {
! if (temp ~ #=/^\(([a-zA-Z_]+\|)*[a-zA-Z_]+\)(\*\*?)?$/#>) {
## list of alternatives
#<Remove trailing stars from |temp|#>
temp = substr(temp,2,length(temp)-2)
***************
*** 1836,1842 ****
alternate = tok[j]
reduced[alternate]=1
}
! } else if (temp ~ #=/^[a-z_]+(\*\*?)?$/#>) {
#<Remove trailing stars from |temp|#>
reduced[temp]=1
} else if (temp != "?") {
--- 1836,1842 ----
alternate = tok[j]
reduced[alternate]=1
}
! } else if (temp ~ #=/^[a-zA-Z_]+(\*\*?)?$/#>) {
#<Remove trailing stars from |temp|#>
reduced[temp]=1
} else if (temp != "?") {
|