summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/java.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/java.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/java.rb')
-rw-r--r--lib/coderay/scanners/java.rb29
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb
index 17c7eaa..203385d 100644
--- a/lib/coderay/scanners/java.rb
+++ b/lib/coderay/scanners/java.rb
@@ -1,6 +1,7 @@
module CodeRay
module Scanners
-
+
+ # Scanner for Java.
class Java < Scanner
include Streamable
@@ -13,18 +14,18 @@ module Scanners
finally for if instanceof import new package
return switch throw try typeof while
debugger export
- ]
- RESERVED = %w[ const goto ]
- CONSTANTS = %w[ false null true ]
- MAGIC_VARIABLES = %w[ this super ]
+ ] # :nodoc:
+ RESERVED = %w[ const goto ] # :nodoc:
+ CONSTANTS = %w[ false null true ] # :nodoc:
+ MAGIC_VARIABLES = %w[ this super ] # :nodoc:
TYPES = %w[
boolean byte char class double enum float int interface long
short void
- ] << '[]' # because int[] should be highlighted as a type
+ ] << '[]' # :nodoc: because int[] should be highlighted as a type
DIRECTIVES = %w[
abstract extends final implements native private protected public
static strictfp synchronized throws transient volatile
- ]
+ ] # :nodoc:
IDENT_KIND = WordList.new(:ident).
add(KEYWORDS, :keyword).
@@ -34,16 +35,18 @@ module Scanners
add(TYPES, :type).
add(BuiltinTypes::List, :pre_type).
add(BuiltinTypes::List.select { |builtin| builtin[/(Error|Exception)$/] }, :exception).
- add(DIRECTIVES, :directive)
+ add(DIRECTIVES, :directive) # :nodoc:
- ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
- UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
+ ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
+ UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
STRING_CONTENT_PATTERN = {
"'" => /[^\\']+/,
'"' => /[^\\"]+/,
'/' => /[^\\\/]+/,
- }
- IDENT = /[a-zA-Z_][A-Za-z_0-9]*/
+ } # :nodoc:
+ IDENT = /[a-zA-Z_][A-Za-z_0-9]*/ # :nodoc:
+
+ protected
def scan_tokens tokens, options
@@ -151,7 +154,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
end