Class: AdLint::Cc1::SyntaxNode

Inherits:
Object
  • Object
show all
Includes:
LocationHolder, Visitable
Defined in:
lib/adlint/cc1/syntax.rb

Overview

DESCRIPTION

SyntaxNode class hierarchy

SyntaxNode
  <-- Expression
        <-- ErrorExpression
        <-- PrimaryExpression
              <-- ObjectSpecifier
              <-- ConstantSpecifier
              <-- StringLiteralSpecifier
              <-- NullConstantSpecifier
              <-- GroupedExpression
        <-- PostfixExpression
              <-- ArraySubscriptExpression
              <-- FunctionCallExpression
              <-- MemberAccessByValueExpression
              <-- MemberAccessByPointerExpression
              <-- BitAccessByValueExpression
              <-- BitAccessByPointerExpression
              <-- PostfixIncrementExpression
              <-- PostfixDecrementExpression
              <-- CompoundLiteralExpression
        <-- UnaryExpression
              <-- PrefixIncrementExpression
              <-- PrefixDecrementExpression
              <-- AddressExpression
              <-- IndirectionExpression
              <-- UnaryArithmeticExpression
              <-- SizeofExpression
              <-- SizeofTypeExpression
              <-- AlignofExpression
              <-- AlignofTypeExpression
        <-- CastExpression
        <-- BinaryExpression
              <-- MultiplicativeExpression
              <-- AdditiveExpression
              <-- ShiftExpression
              <-- RelationalExpression
              <-- EqualityExpression
              <-- AndExpression
              <-- ExclusiveOrExpression
              <-- InclusiveOrExpression
              <-- LogicalAndExpression
              <-- LogicalOrExpression
              <-- ConditionalExpression
              <-- SimpleAssignmentExpression
              <-- CompoundAssignmentExpression
        <-- CommaSeparatedExpression
  <-- Declaration
  <-- FunctionDeclaration -------------------- SymbolicElement <<module>>
  <-- VariableDeclaration ----------------------+  |  |  |  |
  <-- Definition                                   |  |  |  |
        <-- VariableDefinition --------------------+  |  |  |
              <-- PseudoVariableDefinition            |  |  |
        <-- FunctionDefinition -----------------------+  |  |
              <-- KandRFunctionDefinition                |  |
              <-- AnsiFunctionDefinition                 |  |
        <-- ParameterDefinition                          |  |
  <-- TypeDeclaration -----------------------------------+  |
        <-- TypedefDeclaration                              |
        <-- StructTypeDeclaration                           |
              <-- PseudoStructTypeDeclaration               |
        <-- UnionTypeDeclaration                            |
              <-- PseudoUnionTypeDeclaration                |
        <-- EnumTypeDeclaration                             |
              <-- PseudoEnumTypeDeclaration                 |
  <-- DeclarationSpecifiers                                 |
  <-- InitDeclarator                                        |
  <-- TypeSpecifier                                         |
        <-- StandardTypeSpecifier                           |
        <-- TypedefTypeSpecifier                            |
        <-- StructSpecifier                                 |
        <-- UnionSpecifier                                  |
        <-- TypeofTypeSpecifier                             |
  <-- StructDeclaration                                     |
  <-- MemberDeclaration                                     |
  <-- SpecifierQualifierList                                |
  <-- StructDeclarator                                      |
  <-- EnumSpecifier                                         |
  <-- Enumerator -------------------------------------------+
  <-- Declarator
        <-- IdentifierDeclarator
        <-- GroupedDeclarator
        <-- ArrayDeclarator
        <-- FunctionDeclarator
              <-- AnsiFunctionDeclarator
              <-- KandRFunctionDeclarator
              <-- AbbreviatedFunctionDeclarator
        <-- AbstractDeclarator
              <-- PointerAbstractDeclarator
              <-- GroupedAbstractDeclarator
              <-- ArrayAbstractDeclarator
              <-- FunctionAbstractDeclarator
  <-- ParameterTypeList
  <-- ParameterDeclaration
  <-- Statement
        <-- ErrorStatement
        <-- LabeledStatement
              <-- GenericLabeledStatement
              <-- CaseLabeledStatement
              <-- DefaultLabeledStatement
        <-- CompoundStatement
        <-- ExpressionStatement
        <-- SelectionStatement
              <-- IfStatement
              <-- IfElseStatement
              <-- SwitchStatement
        <-- IterationStatement
              <-- WhileStatement
              <-- DoStatement
              <-- ForStatement
              <-- C99ForStatement
        <-- JumpStatement
              <-- GotoStatement
              <-- ContinueStatement
              <-- BreakStatement
              <-- ReturnStatement
  <-- TranslationUnit
  <-- TypeName
  <-- Initializer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initializeSyntaxNode

Returns a new instance of SyntaxNode.



165
166
167
168
169
# File 'lib/adlint/cc1/syntax.rb', line 165

def initialize
  @head_token = nil
  @tail_token = nil
  @subsequent_sequence_point = nil
end

Instance Attribute Details

#head_tokenObject

Returns the value of attribute head_token.



171
172
173
# File 'lib/adlint/cc1/syntax.rb', line 171

def head_token
  @head_token
end

#subsequent_sequence_pointObject (readonly)

Returns the value of attribute subsequent_sequence_point.



173
174
175
# File 'lib/adlint/cc1/syntax.rb', line 173

def subsequent_sequence_point
  @subsequent_sequence_point
end

#tail_tokenObject

Returns the value of attribute tail_token.



172
173
174
# File 'lib/adlint/cc1/syntax.rb', line 172

def tail_token
  @tail_token
end

Instance Method Details

#head_locationObject



179
180
181
# File 'lib/adlint/cc1/syntax.rb', line 179

def head_location
  @head_token ? @head_token.location : nil
end

#inspect(indent = 0) ⇒ Object



187
188
189
# File 'lib/adlint/cc1/syntax.rb', line 187

def inspect(indent = 0)
  subclass_responsibility
end

#locationObject



175
176
177
# File 'lib/adlint/cc1/syntax.rb', line 175

def location
  subclass_responsibility
end

#short_class_nameObject



191
192
193
# File 'lib/adlint/cc1/syntax.rb', line 191

def short_class_name
  self.class.name.sub(/\A.*::/, "")
end

#tail_locationObject



183
184
185
# File 'lib/adlint/cc1/syntax.rb', line 183

def tail_location
  @tail_token ? @tail_token.location : nil
end