summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/delphi.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/delphi.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/delphi.rb')
-rw-r--r--lib/coderay/scanners/delphi.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/lib/coderay/scanners/delphi.rb b/lib/coderay/scanners/delphi.rb
index fe91ae9..170f250 100644
--- a/lib/coderay/scanners/delphi.rb
+++ b/lib/coderay/scanners/delphi.rb
@@ -1,8 +1,11 @@
module CodeRay
module Scanners
+ # Scanner for the Delphi language (Object Pascal).
+ #
+ # Alias: +pascal+
class Delphi < Scanner
-
+
register_for :delphi
file_extension 'pas'
@@ -16,9 +19,9 @@ module Scanners
'procedure', 'program', 'property', 'raise', 'record', 'repeat',
'resourcestring', 'set', 'shl', 'shr', 'string', 'then', 'threadvar',
'to', 'try', 'type', 'unit', 'until', 'uses', 'var', 'while', 'with',
- 'xor', 'on'
- ]
-
+ 'xor', 'on',
+ ] # :nodoc:
+
DIRECTIVES = [
'absolute', 'abstract', 'assembler', 'at', 'automated', 'cdecl',
'contains', 'deprecated', 'dispid', 'dynamic', 'export',
@@ -27,19 +30,20 @@ module Scanners
'package', 'pascal', 'platform', 'private', 'protected', 'public',
'published', 'read', 'readonly', 'register', 'reintroduce',
'requires', 'resident', 'safecall', 'stdcall', 'stored', 'varargs',
- 'virtual', 'write', 'writeonly'
- ]
-
+ 'virtual', 'write', 'writeonly',
+ ] # :nodoc:
+
IDENT_KIND = CaseIgnoringWordList.new(:ident).
add(RESERVED_WORDS, :reserved).
- add(DIRECTIVES, :directive)
+ add(DIRECTIVES, :directive) # :nodoc:
NAME_FOLLOWS = CaseIgnoringWordList.new(false).
- add(%w(procedure function .))
-
- private
+ add(%w(procedure function .)) # :nodoc:
+
+ protected
+
def scan_tokens tokens, options
-
+
state = :initial
last_token = ''
@@ -130,7 +134,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, state
end