@@ -76,7 +76,7 @@ def scan_tokens encoder, options
76
76
kind = match = nil
77
77
78
78
if match = scan ( /\n / )
79
- encoder . text_token ( match , :plain )
79
+ encoder . text_token ( match , :end_line )
80
80
next
81
81
end
82
82
@@ -85,9 +85,11 @@ def scan_tokens encoder, options
85
85
kind = :directive
86
86
elsif match = scan ( /\s *#.*/ )
87
87
kind = :comment
88
- elsif match = scan ( /. #/ )
88
+ elsif match = scan ( /[^"] #/ )
89
89
kind = :ident
90
- elsif match = scan ( /(?:\. |source ).*/ )
90
+ elsif match = scan ( /\. \. +/ )
91
+ kind = :plain
92
+ elsif match = scan ( /(?:\. |source)\s +/ )
91
93
kind = :reserved
92
94
elsif match = scan ( /(?:\\ .|,)/ )
93
95
kind = :plain
@@ -146,13 +148,11 @@ def scan_tokens encoder, options
146
148
encoder . begin_group :shell
147
149
encoder . text_token ( match , :delimiter )
148
150
next
149
- elsif match = scan ( / \) /ox )
150
- if @brace_shell > 0
151
- encoder . text_token ( match , :delimiter )
152
- encoder . end_group :shell
153
- @brace_shell -= 1
154
- next
155
- end
151
+ elsif @brace_shell > 0 && match = scan ( / \) /ox )
152
+ encoder . text_token ( match , :delimiter )
153
+ encoder . end_group :shell
154
+ @brace_shell -= 1
155
+ next
156
156
elsif match = scan ( PRE_CONSTANTS )
157
157
kind = :predefined_constant
158
158
elsif match = scan ( /[^\s '"]*[A-Za-z_][A-Za-z_0-9]*\+ ?=/ )
@@ -266,7 +266,7 @@ def scan_tokens encoder, options
266
266
267
267
268
268
def match_array ( match , encoder )
269
- match =~ /([A-Za-z_] +)\[ (.*?)\] /
269
+ match =~ /(. +)\[ (.*?)\] /
270
270
var = $1
271
271
key = $2
272
272
kind = IDENT_KIND [ var ]
0 commit comments