Skip to content

Commit a887ebe

Browse files
committed
Strip trailing whitespaces at the last line of actions
1 parent 0327256 commit a887ebe

33 files changed

+2522
-2521
lines changed

lib/racc/grammarfileparser.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ def scan_action
450450
nest -= 1
451451
if nest == 0
452452
@in_block = nil
453+
buf.sub!(/[ \t\f]+\z/, '')
453454
return buf
454455
end
455456
buf << (pre = ch)

sample/calc-ja.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ end
2626
---- header
2727
# $Id$
2828
---- inner
29-
29+
3030
def evaluate(str)
3131
@tokens = []
3232
until str.empty?

sample/calc.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424
---- header
2525
# $Id$
2626
---- inner
27-
27+
2828
def parse(str)
2929
@q = []
3030
until str.empty?

sample/hash.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class HashParser
77
rule
88
hash : '{' contents '}' { val[1] }
99
| '{' '}' { Hash.new }
10-
10+
1111
# Racc can handle string over 2 bytes.
1212
contents: IDENT '=>' IDENT { {val[0] => val[2]} }
1313
| contents ',' IDENT '=>' IDENT { val[0][val[2]] = val[4]; val[0] }

sample/syntax.y

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rule
2828
print 'cba'
2929
}
3030
| cont
31-
31+
3232
cont : A c2 B c2 C
3333

3434
c2 : C C C C C

setup.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ def command(*args)
660660
def ruby(*args)
661661
command config('rubyprog'), *args
662662
end
663-
663+
664664
def make(task = nil)
665665
command(*[config('makeprog'), task].compact)
666666
end
@@ -723,7 +723,7 @@ def srcexist?(path)
723723
def srcdirectory?(path)
724724
File.dir?(srcfile(path))
725725
end
726-
726+
727727
def srcfile?(path)
728728
File.file?(srcfile(path))
729729
end
@@ -827,7 +827,7 @@ def invoke
827827
__send__ "exec_#{task}"
828828
end
829829
end
830-
830+
831831
def run_metaconfigs
832832
@config.load_script "#{@ardir}/metaconfig"
833833
end
@@ -1405,7 +1405,7 @@ def mapdir(ents)
14051405
end
14061406

14071407
# picked up many entries from cvs-1.11.1/src/ignore.c
1408-
JUNK_FILES = %w(
1408+
JUNK_FILES = %w(
14091409
core RCSLOG tags TAGS .make.state
14101410
.nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
14111411
*~ *.old *.bak *.BAK *.orig *.rej _$* *$

test/assets/intp.y

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ rule
2727
result.push val[1]
2828
}
2929
| stmt_list EOL
30-
30+
3131
stmt : expr
3232
| assign
3333
| IDENT realprim
@@ -38,7 +38,7 @@ rule
3838
| if_stmt
3939
| while_stmt
4040
| defun
41-
41+
4242
if_stmt : IF stmt THEN EOL stmt_list else_stmt END
4343
{
4444
result = IfNode.new( @fname, val[0][0],
@@ -261,7 +261,7 @@ module Intp
261261
262262
class Core
263263
264-
def initialize
264+
def initialize
265265
@ftab = {}
266266
@obj = Object.new
267267
@stack = []
@@ -318,7 +318,7 @@ module Intp
318318
def lvar?(name)
319319
@lvars.key? name
320320
end
321-
321+
322322
def [](key)
323323
@lvars[key]
324324
end

test/assets/mailp.y

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ rule
3535
@field.domain = mb.domain
3636
}
3737
;
38-
38+
3939
datetime : day DIGIT ATOM DIGIT hour zone
4040
# 0 1 2 3 4 5
4141
# day month year
@@ -44,11 +44,11 @@ rule
4444
result = (t + val[4] - val[5]).localtime
4545
}
4646
;
47-
47+
4848
day : /* none */
4949
| ATOM ','
5050
;
51-
51+
5252
hour : DIGIT ':' DIGIT
5353
{
5454
result = (result.to_i * 60 * 60) + (val[2].to_i * 60)
@@ -60,16 +60,16 @@ rule
6060
+ val[4].to_i
6161
}
6262
;
63-
63+
6464
zone : ATOM
6565
{
6666
result = ::TMail.zonestr2i( val[0] ) * 60
6767
}
6868
;
69-
69+
7070
received : from by via with id for recvdatetime
7171
;
72-
72+
7373
from : /* none */
7474
| FROM domain
7575
{
@@ -84,28 +84,28 @@ rule
8484
@field.from = Address.join( val[1] )
8585
}
8686
;
87-
87+
8888
by : /* none */
8989
| BY domain
9090
{
9191
@field.by = Address.join( val[1] )
9292
}
9393
;
94-
94+
9595
via : /* none */
9696
| VIA ATOM
9797
{
9898
@field.via = val[1]
9999
}
100100
;
101-
101+
102102
with : /* none */
103103
| WITH ATOM
104104
{
105105
@field.with.push val[1]
106106
}
107107
;
108-
108+
109109
id : /* none */
110110
| ID msgid
111111
{
@@ -116,22 +116,22 @@ rule
116116
@field.msgid = val[1]
117117
}
118118
;
119-
119+
120120
for : /* none */
121121
| FOR addr
122122
{
123123
@field.for_ = val[1].address
124124
}
125125
;
126-
126+
127127
recvdatetime
128128
: /* none */
129129
| ';' datetime
130130
{
131131
@field.date = val[1]
132132
}
133133
;
134-
134+
135135
returnpath: '<' '>'
136136
| routeaddr
137137
{
@@ -173,7 +173,7 @@ rule
173173
}
174174
# | phrase ':' ';' { result = AddressGroup.new( result ) }
175175
;
176-
176+
177177
routeaddr : '<' route spec '>'
178178
{
179179
result = val[2]
@@ -184,22 +184,22 @@ rule
184184
result = val[1]
185185
}
186186
;
187-
187+
188188
route : at_domains ':'
189189
;
190-
190+
191191
at_domains: '@' domain { result = [ val[1] ] }
192192
| at_domains ',' '@' domain { result.push val[3] }
193193
;
194-
194+
195195
spec : local '@' domain { result = Address.new( val[0], val[2] ) }
196196
| local { result = Address.new( result, nil ) }
197197
;
198-
198+
199199
local : word { result = val }
200200
| local '.' word { result.push val[2] }
201201
;
202-
202+
203203
domain : domword { result = val }
204204
| domain '.' domword { result.push val[2] }
205205
;
@@ -215,11 +215,11 @@ rule
215215
result = val.join('')
216216
}
217217
;
218-
218+
219219
phrase : word
220220
| phrase word { result << ' ' << val[1] }
221221
;
222-
222+
223223
word : atom
224224
| QUOTED
225225
| DIGIT
@@ -228,7 +228,7 @@ rule
228228
keys : phrase
229229
| keys ',' phrase
230230
;
231-
231+
232232
enc : word
233233
{
234234
@field.encrypter = val[0]
@@ -258,7 +258,7 @@ rule
258258
@field.sub = ''
259259
}
260260
;
261-
261+
262262
params : /* none */
263263
| params ';' TOKEN '=' value
264264
{
@@ -281,7 +281,7 @@ rule
281281
@field.disposition = val[0]
282282
}
283283
;
284-
284+
285285
disp_params
286286
: /* none */
287287
| disp_params ';' disp_param
@@ -293,7 +293,7 @@ rule
293293
@field.params[ val[0].downcase ] = val[2]
294294
}
295295
;
296-
296+
297297
atom : ATOM
298298
| FROM
299299
| BY
@@ -302,7 +302,7 @@ rule
302302
| ID
303303
| FOR
304304
;
305-
305+
306306
end
307307

308308

@@ -382,7 +382,7 @@ module TMail
382382
@scanner.scan @pass_array
383383
end
384384
end
385-
385+
386386
def on_error( tok, val, vstack )
387387
raise ParseError,
388388
"\nparse error in '#{@field.name}' header, on token #{val.inspect}"

0 commit comments

Comments
 (0)