Class: AdLint::Cc1::EnumSpecifier
- Inherits:
-
TypeSpecifier
- Object
- SyntaxNode
- TypeSpecifier
- AdLint::Cc1::EnumSpecifier
- Defined in:
- lib/adlint/cc1/syntax.rb
Instance Attribute Summary collapse
-
#enumerators ⇒ Object
readonly
Returns the value of attribute enumerators.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#trailing_comma ⇒ Object
readonly
Returns the value of attribute trailing_comma.
Attributes inherited from SyntaxNode
#head_token, #subsequent_sequence_point, #tail_token
Instance Method Summary collapse
- #anonymous? ⇒ Boolean
-
#initialize(id, enums, trailing_comma = nil, anonymous = false) ⇒ EnumSpecifier
constructor
A new instance of EnumSpecifier.
- #inspect(indent = 0) ⇒ Object
- #location ⇒ Object
- #to_s ⇒ Object
Methods inherited from SyntaxNode
#head_location, #short_class_name, #tail_location
Methods included from LocationHolder
Methods included from Visitable
Constructor Details
#initialize(id, enums, trailing_comma = nil, anonymous = false) ⇒ EnumSpecifier
Returns a new instance of EnumSpecifier.
2951 2952 2953 2954 2955 2956 2957 |
# File 'lib/adlint/cc1/syntax.rb', line 2951 def initialize(id, enums, trailing_comma = nil, anonymous = false) super() @identifier = id @enumerators = enums @trailing_comma = trailing_comma @anonymous = anonymous end |
Instance Attribute Details
#enumerators ⇒ Object (readonly)
Returns the value of attribute enumerators.
2960 2961 2962 |
# File 'lib/adlint/cc1/syntax.rb', line 2960 def enumerators @enumerators end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
2959 2960 2961 |
# File 'lib/adlint/cc1/syntax.rb', line 2959 def identifier @identifier end |
#trailing_comma ⇒ Object (readonly)
Returns the value of attribute trailing_comma.
2961 2962 2963 |
# File 'lib/adlint/cc1/syntax.rb', line 2961 def trailing_comma @trailing_comma end |
Instance Method Details
#anonymous? ⇒ Boolean
2967 2968 2969 |
# File 'lib/adlint/cc1/syntax.rb', line 2967 def anonymous? @anonymous end |
#inspect(indent = 0) ⇒ Object
2984 2985 2986 |
# File 'lib/adlint/cc1/syntax.rb', line 2984 def inspect(indent = 0) " " * indent + short_class_name end |
#location ⇒ Object
2963 2964 2965 |
# File 'lib/adlint/cc1/syntax.rb', line 2963 def location @identifier.location end |
#to_s ⇒ Object
2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 |
# File 'lib/adlint/cc1/syntax.rb', line 2971 def to_s if @enumerators if @enumerators.empty? "enum #{@identifier.value} {}" else "enum #{@identifier.value} { " + @enumerators.map { |enum| enum.to_s }.join(", ") + " }" end else "enum #{identifier.value}" end end |