From 5dd7ca65fdb90d6ffe53790abf1fe5a29a66675e Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 19 Aug 2011 04:43:37 +0200 Subject: rename CaseIgnoringWordList to WordList::CaseIgnoring --- Changes-1.0.textile | 1 + etc/CodeRay.tmproj | 8 ++++---- lib/coderay/helpers/word_list.rb | 6 +++--- lib/coderay/scanner.rb | 4 +--- lib/coderay/scanners/delphi.rb | 4 ++-- lib/coderay/scanners/html.rb | 5 ++--- lib/coderay/scanners/php.rb | 2 +- lib/coderay/scanners/sql.rb | 2 +- test/unit/word_list.rb | 4 ++-- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Changes-1.0.textile b/Changes-1.0.textile index 8c74145..da79215 100644 --- a/Changes-1.0.textile +++ b/Changes-1.0.textile @@ -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. diff --git a/etc/CodeRay.tmproj b/etc/CodeRay.tmproj index cc1783c..1886802 100644 --- a/etc/CodeRay.tmproj +++ b/etc/CodeRay.tmproj @@ -37,20 +37,20 @@ ../README_INDEX.rdoc lastUsed 2011-08-19T02:16:06Z - selected - filename ../README.textile lastUsed - 2011-08-19T02:05:36Z + 2011-08-19T02:29:46Z + selected + filename ../.travis.yml lastUsed - 2011-08-19T02:05:37Z + 2011-08-19T02:21:33Z filename diff --git a/lib/coderay/helpers/word_list.rb b/lib/coderay/helpers/word_list.rb index 7f8eba6..ea969c3 100644 --- a/lib/coderay/helpers/word_list.rb +++ b/lib/coderay/helpers/word_list.rb @@ -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 @@ module CodeRay 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 diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb index e638c2c..ec89b87 100644 --- a/lib/coderay/scanner.rb +++ b/lib/coderay/scanner.rb @@ -4,8 +4,6 @@ require 'strscan' 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 @@ module CodeRay 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 diff --git a/lib/coderay/scanners/delphi.rb b/lib/coderay/scanners/delphi.rb index 1361869..b328155 100644 --- a/lib/coderay/scanners/delphi.rb +++ b/lib/coderay/scanners/delphi.rb @@ -33,11 +33,11 @@ module Scanners '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 diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb index 2f57e44..206ace0 100644 --- a/lib/coderay/scanners/html.rb +++ b/lib/coderay/scanners/html.rb @@ -32,7 +32,7 @@ module Scanners 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 @@ module Scanners '"' => /[^&">\n]+/, } # :nodoc: - def reset # :nodoc: - # FIXME: why not overwrite reset_instance? + def reset_instance # :nodoc: super @state = :initial end diff --git a/lib/coderay/scanners/php.rb b/lib/coderay/scanners/php.rb index b2632a2..dadab00 100644 --- a/lib/coderay/scanners/php.rb +++ b/lib/coderay/scanners/php.rb @@ -181,7 +181,7 @@ module Scanners $argc $argv ] - IDENT_KIND = CaseIgnoringWordList.new(:ident). + IDENT_KIND = WordList::CaseIgnoring.new(:ident). add(KEYWORDS, :keyword). add(TYPES, :predefined_type). add(LANGUAGE_CONSTRUCTS, :keyword). diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb index 807a41d..bb460cc 100644 --- a/lib/coderay/scanners/sql.rb +++ b/lib/coderay/scanners/sql.rb @@ -42,7 +42,7 @@ module CodeRay module Scanners 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). diff --git a/test/unit/word_list.rb b/test/unit/word_list.rb index 2d02d66..40d5a26 100644 --- a/test/unit/word_list.rb +++ b/test/unit/word_list.rb @@ -39,13 +39,13 @@ class WordListTest < Test::Unit::TestCase 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'] -- cgit v1.2.1