Class: CodeRay::Scanners::C

Inherits:
Scanner
  • Object
show all
Defined in:
lib/coderay/scanners/c.rb

Overview

Scanner for C.

Constant Summary collapse

KEYWORDS =
[
  'asm', 'break', 'case', 'continue', 'default', 'do',
  'else', 'enum', 'for', 'goto', 'if', 'return',
  'sizeof', 'struct', 'switch', 'typedef', 'union', 'while',
  'restrict',  # added in C99
]
PREDEFINED_TYPES =

:nodoc:

[
  'int', 'long', 'short', 'char',
  'signed', 'unsigned', 'float', 'double',
  'bool', 'complex',  # added in C99
]
PREDEFINED_CONSTANTS =

:nodoc:

[
  'EOF', 'NULL',
  'true', 'false',  # added in C99
]
DIRECTIVES =

:nodoc:

[
  'auto', 'extern', 'register', 'static', 'void',
  'const', 'volatile',  # added in C89
  'inline',  # added in C99
]
IDENT_KIND =

:nodoc:

WordList.new(:ident).
add(KEYWORDS, :keyword).
add(PREDEFINED_TYPES, :predefined_type).
add(DIRECTIVES, :directive).
add(PREDEFINED_CONSTANTS, :predefined_constant)
ESCAPE =

:nodoc:

/ [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
UNICODE_ESCAPE =

:nodoc:

/ u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x

Constants inherited from Scanner

Scanner::DEFAULT_OPTIONS, Scanner::KINDS_NOT_LOC, Scanner::ScanError

Instance Attribute Summary

Attributes inherited from Scanner

#state

Attributes included from Plugin

#plugin_id

Method Summary

Methods inherited from Scanner

#binary_string, #column, #each, encoding, file_extension, #file_extension, #initialize, #lang, lang, #line, normalize, #reset, #string=, #tokenize, #tokens

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Constructor Details

This class inherits a constructor from CodeRay::Scanners::Scanner