summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/php.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-03-26 03:18:12 +0000
committermurphy <murphy@rubychan.de>2010-03-26 03:18:12 +0000
commit7fd577f8c2959902c4eb79d3c20b70a274e41618 (patch)
treede117473e8d308f08900514dfcf0c27e9acfea53 /lib/coderay/scanners/php.rb
parentcfa0257f846a01e6777e6e620751165410b328c8 (diff)
downloadcoderay-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.rb12
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