File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 48
48
# XXX : Avert thine eyes.
49
49
function count_semicolons (ps)
50
50
dims = 0
51
+ has_newline = false
51
52
old_pos = position (ps. l. io)
52
53
seek (ps. l. io, ps. ws. startbyte)
53
54
while true
54
55
c = readchar (ps. l. io)
55
56
if c == ' ;'
56
57
dims += 1
58
+ elseif c == ' \n '
59
+ # technically, only trailing newlines are allowed; we're a bit more lenient here
60
+ has_newline = true
57
61
else
58
62
dims == 0 || break
59
63
end
60
64
end
61
65
seek (ps. l. io, old_pos)
62
- dims
66
+ return dims == 2 && has_newline ? 0 : dims
63
67
end
64
68
65
69
"""
@@ -98,11 +102,11 @@ function parse_array(ps::ParseState, isref = false)
98
102
end
99
103
100
104
binding_power (ps) =
101
- if kindof (ps. ws) == Tokens . SEMICOLON_WS
105
+ if kindof (ps. ws) == SemiColonWS
102
106
- count_semicolons (ps)
103
- elseif kindof (ps. ws) == Tokens . NEWLINE_WS
107
+ elseif kindof (ps. ws) == NewLineWS
104
108
- 1
105
- elseif kindof (ps. ws) == Tokens . WS
109
+ elseif kindof (ps. ws) == WS
106
110
0
107
111
else
108
112
1
You can’t perform that action at this time.
0 commit comments