summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/php.rb
diff options
context:
space:
mode:
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