module AdLint::Cpp::Scanner

DESCRIPTION

Utility module for scanning the C preprocessor language code.

Public Instance Methods

scan_keyword(cont) click to toggle source

DESCRIPTION

Scans CPP keyword.

PARAMETER

cont

StringContent – Scanning source.

RETURN VALUE

String – Returns CPP keyword string if found at head of the content.

# File lib/adlint/cpp/scanner.rb, line 46
def scan_keyword(cont)
  cont.scan(/defined\b/)
end
scan_punctuator(cont) click to toggle source

DESCRIPTION

Scans CPP punctuator.

PARAMETER

cont

StringContent – Scanning source.

RETURN VALUE

String – Returns CPP punctuator string if found at head of the content.

# File lib/adlint/cpp/scanner.rb, line 58
def scan_punctuator(cont)
  Language::C.scan_punctuator(cont) or cont.scan(/##?/)
end
scan_system_header_name(cont) click to toggle source

DESCRIPTION

Scans CPP system header name.

PARAMETER

cont

StringContent – Scanning source.

RETURN VALUE

String – Returns CPP system header name string if found at head of the content.

# File lib/adlint/cpp/scanner.rb, line 84
def scan_system_header_name(cont)
  cont.scan(/<[^>]*>/)
end
scan_user_header_name(cont) click to toggle source

DESCRIPTION

Scans CPP user header name.

PARAMETER

cont

StringContent – Scanning source.

RETURN VALUE

String – Returns CPP user header name string if found at head of the content.

# File lib/adlint/cpp/scanner.rb, line 71
def scan_user_header_name(cont)
  cont.scan(/"[^"]*"/)
end