File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,6 @@ Rouge/NoBuildingAlternationPatternInRegexp:
6565 - ' lib/rouge/lexers/bicep.rb'
6666 - ' lib/rouge/lexers/cfscript.rb'
6767 - ' lib/rouge/lexers/cmhg.rb'
68- - ' lib/rouge/lexers/console.rb'
6968 - ' lib/rouge/lexers/crystal.rb'
7069 - ' lib/rouge/lexers/csharp.rb'
7170 - ' lib/rouge/lexers/d.rb'
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def comment_regex
7575
7676 def end_chars
7777 @end_chars ||= if @prompt . any?
78- @prompt . reject { |c | c . empty? }
78+ @prompt . reject { |c | c . empty? } . uniq . first ( 20 )
7979 elsif allow_comments?
8080 %w( $ > ; )
8181 else
@@ -173,9 +173,13 @@ def prompt_prefix_regex
173173 end
174174
175175 def prompt_regex
176+ # [jneen] these characters can come from user input. They are escaped here,
177+ # and we limit the user to 20.
178+ #rubocop:disable Rouge/NoBuildingAlternationPatternInRegexp
176179 @prompt_regex ||= begin
177180 /^#{ prompt_prefix_regex } (?:#{ end_chars . map { |c | Regexp . escape ( c ) } . join ( '|' ) } )/
178181 end
182+ #rubocop:enable Rouge/NoBuildingAlternationPatternInRegexp
179183 end
180184
181185 def stream_tokens ( input , &output )
You can’t perform that action at this time.
0 commit comments