Class: CodeRay::Scanners::CPlusPlus

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

Overview

Scanner for C++.

Aliases: cplusplus, c++

Constant Summary collapse

KEYWORDS =
[
  'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break',
  'case', 'catch', 'class', 'compl', 'const_cast',
  'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else',
  'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new',
  'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return',
  'sizeof', 'static_assert', 'static_cast', 'struct', 'switch',
  'template', 'throw', 'try', 'typedef', 'typeid', 'typename', 'union',
  'while', 'xor', 'xor_eq',
]
PREDEFINED_TYPES =

:nodoc:

[
  'bool', 'char', 'char16_t', 'char32_t', 'double', 'float',
  'int', 'long', 'short', 'signed', 'unsigned',
  'wchar_t', 'string',
]
PREDEFINED_CONSTANTS =

:nodoc:

[
  'false', 'true',
  'EOF', 'NULL', 'nullptr'
]
PREDEFINED_VARIABLES =

:nodoc:

[
  'this',
]
DIRECTIVES =

:nodoc:

[
  'alignas', 'alignof', 'auto', 'const', 'constexpr', 'decltype', 'explicit',
  'extern', 'final', 'friend', 'inline', 'mutable', 'noexcept', 'operator',
  'override', 'private', 'protected', 'public', 'register', 'static',
  'thread_local', 'using', 'virtual', 'void', 'volatile',
]
IDENT_KIND =

:nodoc:

WordList.new(:ident).
add(KEYWORDS, :keyword).
add(PREDEFINED_TYPES, :predefined_type).
add(PREDEFINED_VARIABLES, :local_variable).
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