summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners
diff options
context:
space:
mode:
Diffstat (limited to 'lib/coderay/scanners')
-rw-r--r--lib/coderay/scanners/debug.rb2
-rw-r--r--lib/coderay/scanners/diff.rb1
-rw-r--r--lib/coderay/scanners/python.rb3
-rw-r--r--lib/coderay/scanners/raydebug.rb2
-rw-r--r--lib/coderay/scanners/ruby/string_state.rb1
5 files changed, 9 insertions, 0 deletions
diff --git a/lib/coderay/scanners/debug.rb b/lib/coderay/scanners/debug.rb
index 566bfa7..9d10864 100644
--- a/lib/coderay/scanners/debug.rb
+++ b/lib/coderay/scanners/debug.rb
@@ -21,6 +21,7 @@ module Scanners
encoder.text_token match, :space
elsif match = scan(/ (\w+) \( ( [^\)\\]* ( \\. [^\)\\]* )* ) \)? /x)
+ # FIXME: cache attack
kind = self[1].to_sym
match = self[2].gsub(/\\(.)/m, '\1')
unless TokenKinds.has_key? kind
@@ -30,6 +31,7 @@ module Scanners
encoder.text_token match, kind
elsif match = scan(/ (\w+) ([<\[]) /x)
+ # FIXME: cache attack
kind = self[1].to_sym
opened_tokens << kind
case self[2]
diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb
index fd1aed6..836fa41 100644
--- a/lib/coderay/scanners/diff.rb
+++ b/lib/coderay/scanners/diff.rb
@@ -21,6 +21,7 @@ module Scanners
line_kind = nil
state = :initial
deleted_lines_count = 0
+ # FIXME: cache attack
scanners = Hash.new do |h, lang|
h[lang] = Scanners[lang].new '', :keep_tokens => true, :keep_state => true
end
diff --git a/lib/coderay/scanners/python.rb b/lib/coderay/scanners/python.rb
index 09c8b6e..23630f9 100644
--- a/lib/coderay/scanners/python.rb
+++ b/lib/coderay/scanners/python.rb
@@ -75,10 +75,12 @@ module Scanners
<<=? | >>=? | [<>=]=? | != # comparison and assignment
/x # :nodoc:
+ # FIXME: cache attack
STRING_DELIMITER_REGEXP = Hash.new { |h, delimiter|
h[delimiter] = Regexp.union delimiter # :nodoc:
}
+ # FIXME: cache attack
STRING_CONTENT_REGEXP = Hash.new { |h, delimiter|
h[delimiter] = / [^\\\n]+? (?= \\ | $ | #{Regexp.escape(delimiter)} ) /x # :nodoc:
}
@@ -183,6 +185,7 @@ module Scanners
kind = :ident
elsif kind == :keyword
state = DEF_NEW_STATE[match]
+ # FIXME: cache attack
from_import_state << match.to_sym if state == :include_expected
end
encoder.text_token match, kind
diff --git a/lib/coderay/scanners/raydebug.rb b/lib/coderay/scanners/raydebug.rb
index d39d962..ca35de0 100644
--- a/lib/coderay/scanners/raydebug.rb
+++ b/lib/coderay/scanners/raydebug.rb
@@ -26,6 +26,7 @@ module Scanners
encoder.text_token kind, :class
encoder.text_token '(', :operator
match = self[2]
+ # FIXME: cache attack
encoder.text_token match, kind.to_sym unless match.empty?
encoder.text_token match, :operator if match = scan(/\)/)
@@ -39,6 +40,7 @@ module Scanners
else
raise 'CodeRay bug: This case should not be reached.'
end
+ # FIXME: cache attack
kind = kind.to_sym
opened_tokens << kind
encoder.begin_group kind
diff --git a/lib/coderay/scanners/ruby/string_state.rb b/lib/coderay/scanners/ruby/string_state.rb
index 2f398d1..fe37d07 100644
--- a/lib/coderay/scanners/ruby/string_state.rb
+++ b/lib/coderay/scanners/ruby/string_state.rb
@@ -14,6 +14,7 @@ module Scanners
{ }
] ].each { |k,v| k.freeze; v.freeze } # debug, if I try to change it with <<
+ # FIXME: cache attack
STRING_PATTERN = Hash.new do |h, k|
delim, interpreted = *k
# delim = delim.dup # workaround for old Ruby