module AdLint::Cpp::BasicSourceCharacterSet

Constants

CHARS

NOTE: The ISO C99 standard says;

5.2 Environmental considerations 5.2.1 Character sets

1 Two sets of characters and their associated collating sequences shall

be defined: the set in which source files are written (the source
character set), and the set interpreted in the execution environment
(the execution character set). Each set is further divided into a basic
character set, whose contents are given by this subclause, and a set of
zero or more locale-specific members (which are not members of the
basic character set) called extended characters. The combined set is
also called the extended character set. The values of the members of
the execution character set are implementation-defined.

3 Both the basic source and basic execution character sets shall have the

following members: the 26 uppercase letters of the Latin alphabet
  A B C D E F G H I J K L M
  N O P Q R S T U V W X Y Z
the 26 lowercase letters of the Latin alphabet
  a b c d e f g h i j k l m
  n o p q r s t u v w x y z
the 10 decimal digits
  0 1 2 3 4 5 6 7 8 9
the following 29 graphic characters
  ! " # % & ' ( ) * + , - . / :
  ; < = > ? [ \ ] ^ _ { | } ~
the space character, and control characters representing horizontal
tab, vertical tab, and form feed.

Public Class Methods

include?(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 70
def include?(str)
  str.chars.all? { |ch| CHARS.include?(ch.ord) }
end
select_adapted(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 75
def select_adapted(str)
  str.chars.select { |ch| CHARS.include?(ch.ord) }
end
select_not_adapted(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 80
def select_not_adapted(str)
  str.chars.to_a - select_adapted(str)
end

Private Instance Methods

include?(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 70
def include?(str)
  str.chars.all? { |ch| CHARS.include?(ch.ord) }
end
select_adapted(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 75
def select_adapted(str)
  str.chars.select { |ch| CHARS.include?(ch.ord) }
end
select_not_adapted(str) click to toggle source
# File lib/adlint/cpp/util.rb, line 80
def select_not_adapted(str)
  str.chars.to_a - select_adapted(str)
end