File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 1
1
# Scanner for Bash
2
2
# Author: Petr Kovar <pejuko@gmail.com>
3
- module CodeRay
4
- module Scanners
3
+
4
+ module CodeRay module Scanners
5
+
5
6
class Bash < Scanner
6
7
7
8
register_for :bash
@@ -84,11 +85,15 @@ def scan_tokens tokens, options
84
85
elsif match = scan ( /"/ )
85
86
@state = :quote
86
87
@quote = match
87
- tokens << [ :open , : string]
88
+ tokens . begin_group : string
88
89
tokens << [ match , :delimiter ]
89
90
next
90
91
elsif match = scan ( /`/ )
91
- tokens << [ @shell ? :close : :open , :shell ]
92
+ if @shell
93
+ tokens . end_group :shell
94
+ else
95
+ tokens . begin_group :shell
96
+ end
92
97
@shell = ( not @shell )
93
98
tokens << [ match , :delimiter ]
94
99
next
@@ -165,7 +170,7 @@ def scan_tokens tokens, options
165
170
kind = :content
166
171
elsif match = scan ( /#{ @quote } / )
167
172
tokens << [ match , :delimiter ]
168
- tokens << [ :close , : string] if @quote == '"'
173
+ tokens . end_group : string
169
174
@quote = nil
170
175
@state = :initial
171
176
next
Original file line number Diff line number Diff line change 1
1
# Scanner for Bash
2
2
# Author: spam+github@codez.ch
3
- require 'coderay/scanners/rhtml '
3
+ require 'coderay/scanners/erb '
4
4
5
5
module CodeRay
6
6
module Scanners
7
- class ErbBash < RHTML
7
+ class ErbBash < ERB
8
8
register_for :erb_bash
9
9
10
10
protected
You can’t perform that action at this time.
0 commit comments