Permalink
Browse files

rename CaseIgnoringWordList to WordList::CaseIgnoring

  • Loading branch information...
korny committed Aug 19, 2011
1 parent 5b0d3ed commit 5dd7ca65fdb90d6ffe53790abf1fe5a29a66675e
View
@@ -289,6 +289,7 @@ h3. @WordList@
Stripped down to 19 LOC.
+* *RENAMED* @CaseIgnoringWordList@ to @WordList::CaseIgnoring@
* *REMOVED* caching option because it creates memory leaks.
* *REMOVED* block option.
View
@@ -37,20 +37,20 @@
<string>../README_INDEX.rdoc</string>
<key>lastUsed</key>
<date>2011-08-19T02:16:06Z</date>
- <key>selected</key>
- <true/>
</dict>
<dict>
<key>filename</key>
<string>../README.textile</string>
<key>lastUsed</key>
- <date>2011-08-19T02:05:36Z</date>
+ <date>2011-08-19T02:29:46Z</date>
+ <key>selected</key>
+ <true/>
</dict>
<dict>
<key>filename</key>
<string>../.travis.yml</string>
<key>lastUsed</key>
- <date>2011-08-19T02:05:37Z</date>
+ <date>2011-08-19T02:21:33Z</date>
</dict>
<dict>
<key>filename</key>
@@ -15,7 +15,7 @@ module CodeRay
# WordList is optimized to be used in Scanners,
# typically to decide whether a given ident is a special token.
#
- # For case insensitive words use CaseIgnoringWordList.
+ # For case insensitive words use WordList::CaseIgnoring.
#
# Example:
#
@@ -60,9 +60,9 @@ def add words, value = true
end
- # A CaseIgnoringWordList is like a WordList, only that
+ # A CaseIgnoring WordList is like a WordList, only that
# keys are compared case-insensitively (normalizing keys using +downcase+).
- class CaseIgnoringWordList < WordList
+ class WordList::CaseIgnoring < WordList
def [] key
super key.downcase
View
@@ -4,8 +4,6 @@
module CodeRay
autoload :WordList, 'coderay/helpers/word_list'
- # FIXME: Rename CaseIgnoringWordList to WordList::CaseIgnoring.
- autoload :CaseIgnoringWordList, 'coderay/helpers/word_list'
# = Scanners
#
@@ -155,7 +153,7 @@ def initialize code = '', options = {}
setup
end
- # Sets back the scanner. Subclasses should to define the reset_instance
+ # Sets back the scanner. Subclasses should redefine the reset_instance
# method instead of this one.
def reset
super
@@ -33,11 +33,11 @@ class Delphi < Scanner
'virtual', 'write', 'writeonly',
] # :nodoc:
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
+ IDENT_KIND = WordList::CaseIgnoring.new(:ident).
add(KEYWORDS, :keyword).
add(DIRECTIVES, :directive) # :nodoc:
- NAME_FOLLOWS = CaseIgnoringWordList.new(false).
+ NAME_FOLLOWS = WordList::CaseIgnoring.new(false).
add(%w(procedure function .)) # :nodoc:
protected
@@ -32,7 +32,7 @@ class HTML < Scanner
onvolumechange onwaiting
)
- IN_ATTRIBUTE = CaseIgnoringWordList.new(nil).
+ IN_ATTRIBUTE = WordList::CaseIgnoring.new(nil).
add(EVENT_ATTRIBUTES, :script)
ATTR_NAME = /[\w.:-]+/ # :nodoc:
@@ -58,8 +58,7 @@ class HTML < Scanner
'"' => /[^&">\n]+/,
} # :nodoc:
- def reset # :nodoc:
- # FIXME: why not overwrite reset_instance?
+ def reset_instance # :nodoc:
super
@state = :initial
end
@@ -181,7 +181,7 @@ module Words # :nodoc:
$argc $argv
]
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
+ IDENT_KIND = WordList::CaseIgnoring.new(:ident).
add(KEYWORDS, :keyword).
add(TYPES, :predefined_type).
add(LANGUAGE_CONSTRUCTS, :keyword).
@@ -42,7 +42,7 @@ class SQL < Scanner
PREDEFINED_CONSTANTS = %w( null true false )
- IDENT_KIND = CaseIgnoringWordList.new(:ident).
+ IDENT_KIND = WordList::CaseIgnoring.new(:ident).
add(KEYWORDS, :keyword).
add(OBJECTS, :type).
add(COMMANDS, :class).
View
@@ -39,13 +39,13 @@ def test_word_list
end
def test_case_ignoring_word_list
- list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved)
+ list = WordList::CaseIgnoring.new(:ident).add(['foobar'], :reserved)
assert_equal :ident, list['foo']
assert_equal :reserved, list['foobar']
assert_equal :reserved, list['FooBar']
assert_equal 1, list.size
- list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
+ list = WordList::CaseIgnoring.new(:ident).add(['FooBar'], :reserved)
assert_equal :ident, list['foo']
assert_equal :reserved, list['foobar']
assert_equal :reserved, list['FooBar']

0 comments on commit 5dd7ca6

Please sign in to comment.