diff options
author | murphy <murphy@rubychan.de> | 2010-03-26 03:18:12 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-03-26 03:18:12 +0000 |
commit | 7fd577f8c2959902c4eb79d3c20b70a274e41618 (patch) | |
tree | de117473e8d308f08900514dfcf0c27e9acfea53 /lib/coderay/scanners/php.rb | |
parent | cfa0257f846a01e6777e6e620751165410b328c8 (diff) | |
download | coderay-7fd577f8c2959902c4eb79d3c20b70a274e41618.tar.gz |
Cleanups for C, C++, CSS, Delphi, Groovy, Java, PHP, Python, RHTML, XML, and YAML scanners.
Diffstat (limited to 'lib/coderay/scanners/php.rb')
-rw-r--r-- | lib/coderay/scanners/php.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/coderay/scanners/php.rb b/lib/coderay/scanners/php.rb index 41f217d..73c4fc8 100644 --- a/lib/coderay/scanners/php.rb +++ b/lib/coderay/scanners/php.rb @@ -3,6 +3,8 @@ module Scanners load :html + # Scanner for PHP. + # # Original by Stefan Walk. class PHP < Scanner @@ -11,6 +13,8 @@ module Scanners KINDS_NOT_LOC = HTML::KINDS_NOT_LOC + protected + def setup @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true end @@ -20,7 +24,7 @@ module Scanners @html_scanner.reset end - module Words + module Words # :nodoc: # according to http://www.php.net/manual/en/reserved.keywords.php KEYWORDS = %w[ @@ -189,7 +193,7 @@ module Scanners add(PREDEFINED, :predefined) end - module RE + module RE # :nodoc: PHP_START = / <script\s+[^>]*?language\s*=\s*"php"[^>]*?> | @@ -223,6 +227,8 @@ module Scanners end + protected + def scan_tokens tokens, options if check(RE::PHP_START) || # starts with <? @@ -507,7 +513,7 @@ module Scanners end match ||= matched - if $DEBUG and not kind + if $CODERAY_DEBUG and not kind raise_inspect 'Error token %p in line %d' % [[match, kind], line], tokens, states end |