summaryrefslogtreecommitdiff
path: root/lib/coderay
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2009-10-19 17:34:39 +0000
committermurphy <murphy@rubychan.de>2009-10-19 17:34:39 +0000
commit9eba0c7decb383e3ef73a3fee375e725442cde56 (patch)
tree0e88e051c045bb2a7c5db6020024d8c47466676f /lib/coderay
parenteada01e24c1402c6e390579d60ca174f15e74f6b (diff)
downloadcoderay-9eba0c7decb383e3ef73a3fee375e725442cde56.tar.gz
Updating scanners: Ruby 1.9 warnings, KINDS_NOT_LOC
* Also, DATABASE is a SQL keyword.
Diffstat (limited to 'lib/coderay')
-rw-r--r--lib/coderay/scanners/html.rb11
-rw-r--r--lib/coderay/scanners/nitro_xhtml.rb2
-rw-r--r--lib/coderay/scanners/plaintext.rb4
-rw-r--r--lib/coderay/scanners/rhtml.rb4
-rw-r--r--lib/coderay/scanners/sql.rb4
-rw-r--r--lib/coderay/scanners/xml.rb2
-rw-r--r--lib/coderay/scanners/yaml.rb2
7 files changed, 22 insertions, 7 deletions
diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb
index 1f4d8fe..d59fa69 100644
--- a/lib/coderay/scanners/html.rb
+++ b/lib/coderay/scanners/html.rb
@@ -6,6 +6,13 @@ module Scanners
include Streamable
register_for :html
+
+ KINDS_NOT_LOC = [
+ :comment, :doctype, :preprocessor,
+ :tag, :attribute_name, :operator,
+ :attribute_value, :delimiter, :content,
+ :plain, :entity, :error
+ ]
ATTR_NAME = /[\w.:-]+/
ATTR_VALUE_UNQUOTED = ATTR_NAME
@@ -68,9 +75,9 @@ module Scanners
kind = :preprocessor
elsif scan(/<\?.*?\?>|<%.*?%>/m)
kind = :comment
- elsif scan(/<\/[-\w_.:]*>/m)
+ elsif scan(/<\/[-\w.:]*>/m)
kind = :tag
- elsif match = scan(/<[-\w_.:]+>?/m)
+ elsif match = scan(/<[-\w.:]+>?/m)
kind = :tag
state = :attribute unless match[-1] == ?>
elsif scan(/[^<>&]+/)
diff --git a/lib/coderay/scanners/nitro_xhtml.rb b/lib/coderay/scanners/nitro_xhtml.rb
index 7087ffa..356e049 100644
--- a/lib/coderay/scanners/nitro_xhtml.rb
+++ b/lib/coderay/scanners/nitro_xhtml.rb
@@ -12,6 +12,8 @@ module Scanners
file_extension :xhtml
title 'Nitro XHTML'
+ KINDS_NOT_LOC = HTML::KINDS_NOT_LOC
+
NITRO_RUBY_BLOCK = /
<\?r
(?>
diff --git a/lib/coderay/scanners/plaintext.rb b/lib/coderay/scanners/plaintext.rb
index a362f0b..6cbb119 100644
--- a/lib/coderay/scanners/plaintext.rb
+++ b/lib/coderay/scanners/plaintext.rb
@@ -7,7 +7,9 @@ module Scanners
title 'Plain text'
include Streamable
-
+
+ KINDS_NOT_LOC = [:plain]
+
def scan_tokens tokens, options
text = (scan_until(/\z/) || '')
tokens << [text, :plain]
diff --git a/lib/coderay/scanners/rhtml.rb b/lib/coderay/scanners/rhtml.rb
index 75790d8..581f1f8 100644
--- a/lib/coderay/scanners/rhtml.rb
+++ b/lib/coderay/scanners/rhtml.rb
@@ -9,7 +9,9 @@ module Scanners
include Streamable
register_for :rhtml
- title 'HTML.ERB'
+ title 'HTML ERB Template'
+
+ KINDS_NOT_LOC = HTML::KINDS_NOT_LOC
ERB_RUBY_BLOCK = /
<%(?!%)[=-]?
diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb
index d889be5..2b21c79 100644
--- a/lib/coderay/scanners/sql.rb
+++ b/lib/coderay/scanners/sql.rb
@@ -6,7 +6,7 @@ module CodeRay module Scanners
register_for :sql
RESERVED_WORDS = %w(
- create table index trigger drop primary key set select
+ create database table index trigger drop primary key set select
insert update delete replace into
on from values before and or if exists case when
then else as group order by avg where
@@ -35,7 +35,7 @@ module CodeRay module Scanners
add(PREDEFINED_FUNCTIONS, :predefined).
add(DIRECTIVES, :directive)
- ESCAPE = / [rbfnrtv\n\\\/'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | . /mx
+ ESCAPE = / [rbfntv\n\\\/'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | . /mx
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
STRING_PREFIXES = /[xnb]|_\w+/i
diff --git a/lib/coderay/scanners/xml.rb b/lib/coderay/scanners/xml.rb
index 0c7eab4..aeabeca 100644
--- a/lib/coderay/scanners/xml.rb
+++ b/lib/coderay/scanners/xml.rb
@@ -10,7 +10,7 @@ module Scanners
register_for :xml
file_extension 'xml'
-
+
end
end
diff --git a/lib/coderay/scanners/yaml.rb b/lib/coderay/scanners/yaml.rb
index 932e604..52fca90 100644
--- a/lib/coderay/scanners/yaml.rb
+++ b/lib/coderay/scanners/yaml.rb
@@ -9,6 +9,8 @@ module Scanners
register_for :yaml
file_extension 'yml'
+ KINDS_NOT_LOC = :all
+
def scan_tokens tokens, options
value_expected = nil