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.
2970 2971 2972 2973 2974 2975 2976 |
# File 'lib/adlint/cc1/syntax.rb', line 2970 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.
2979 2980 2981 |
# File 'lib/adlint/cc1/syntax.rb', line 2979 def enumerators @enumerators end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
2978 2979 2980 |
# File 'lib/adlint/cc1/syntax.rb', line 2978 def identifier @identifier end |
#trailing_comma ⇒ Object (readonly)
Returns the value of attribute trailing_comma.
2980 2981 2982 |
# File 'lib/adlint/cc1/syntax.rb', line 2980 def trailing_comma @trailing_comma end |
Instance Method Details
#anonymous? ⇒ Boolean
2986 2987 2988 |
# File 'lib/adlint/cc1/syntax.rb', line 2986 def anonymous? @anonymous end |
#inspect(indent = 0) ⇒ Object
3003 3004 3005 |
# File 'lib/adlint/cc1/syntax.rb', line 3003 def inspect(indent = 0) " " * indent + short_class_name end |
#location ⇒ Object
2982 2983 2984 |
# File 'lib/adlint/cc1/syntax.rb', line 2982 def location @identifier.location end |
#to_s ⇒ Object
2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 |
# File 'lib/adlint/cc1/syntax.rb', line 2990 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 |