The Psyche Project
Public Member Functions | Private Attributes | List of all members
psy::C::VariableAndOrFunctionDeclarationSyntax Class Reference

The VariableAndOrFunctionDeclarationSyntax class. More...

#include <SyntaxNodes_Declarations.h>

Inheritance diagram for psy::C::VariableAndOrFunctionDeclarationSyntax:
psy::C::DeclaratorDeclarationSyntax psy::C::ValueDeclarationSyntax psy::C::DeclarationSyntax psy::C::SyntaxNode psy::C::Managed

Public Member Functions

const SpecifierListSyntaxspecifiers () const
 
const DeclaratorListSyntaxdeclarators () const
 
SyntaxToken semicolonToken () const
 
- Public Member Functions inherited from psy::C::SyntaxNode
 SyntaxNode (const SyntaxNode &other)=delete
 
SyntaxNodeoperator= (const SyntaxNode &other)=delete
 
const SyntaxTreesyntaxTree () const
 
SyntaxKind kind () const
 
bool isKind (SyntaxKind k)
 
SyntaxToken firstToken () const
 
SyntaxToken lastToken () const
 
virtual TranslationUnitSyntaxasTranslationUnit ()
 
virtual const TranslationUnitSyntaxasTranslationUnit () const
 
virtual DeclarationSyntaxasDeclaration ()
 
virtual const DeclarationSyntaxasDeclaration () const
 
virtual EmptyDeclarationSyntaxasEmptyDeclaration ()
 
virtual const EmptyDeclarationSyntaxasEmptyDeclaration () const
 
virtual NamedDeclarationSyntaxasNamedDeclaration ()
 
virtual const NamedDeclarationSyntaxasNamedDeclaration () const
 
virtual TypeDeclarationSyntaxasTypeDeclaration ()
 
virtual const TypeDeclarationSyntaxasTypeDeclaration () const
 
virtual TagDeclarationSyntaxasTagDeclaration ()
 
virtual const TagDeclarationSyntaxasTagDeclaration () const
 
virtual StructOrUnionDeclarationSyntaxasStructOrUnionDeclaration ()
 
virtual const StructOrUnionDeclarationSyntaxasStructOrUnionDeclaration () const
 
virtual EnumDeclarationSyntaxasEnumDeclaration ()
 
virtual const EnumDeclarationSyntaxasEnumDeclaration () const
 
virtual EnumMemberDeclarationSyntaxasEnumMemberDeclaration ()
 
virtual const EnumMemberDeclarationSyntaxasEnumMemberDeclaration () const
 
virtual ValueDeclarationSyntaxasValueDeclaration ()
 
virtual const ValueDeclarationSyntaxasValueDeclaration () const
 
virtual DeclaratorDeclarationSyntaxasDeclaratorDeclaration ()
 
virtual const DeclaratorDeclarationSyntaxasDeclaratorDeclaration () const
 
virtual VariableAndOrFunctionDeclarationSyntaxasVariableAndOrFunctionDeclaration ()
 
virtual const VariableAndOrFunctionDeclarationSyntaxasVariableAndOrFunctionDeclaration () const
 
virtual ParameterDeclarationSyntaxasParameterDeclaration ()
 
virtual const ParameterDeclarationSyntaxasParameterDeclaration () const
 
virtual FieldDeclarationSyntaxasFieldDeclaration ()
 
virtual const FieldDeclarationSyntaxasFieldDeclaration () const
 
virtual StaticAssertDeclarationSyntaxasStaticAssertDeclaration ()
 
virtual const StaticAssertDeclarationSyntaxasStaticAssertDeclaration () const
 
virtual FunctionDefinitionSyntaxasFunctionDefinition ()
 
virtual const FunctionDefinitionSyntaxasFunctionDefinition () const
 
virtual ExtPSY_TemplateDeclarationSyntaxasExtPSY_TemplateDeclaration ()
 
virtual const ExtPSY_TemplateDeclarationSyntaxasExtPSY_TemplateDeclaration () const
 
virtual ExtGNU_AsmStatementDeclarationSyntaxasExtGNU_AsmStatementDeclaration ()
 
virtual const ExtGNU_AsmStatementDeclarationSyntaxasExtGNU_AsmStatementDeclaration () const
 
virtual SpecifierSyntaxasSpecifier ()
 
virtual const SpecifierSyntaxasSpecifier () const
 
virtual TrivialSpecifierSyntaxasTrivialSpecifier ()
 
virtual const TrivialSpecifierSyntaxasTrivialSpecifier () const
 
virtual StorageClassSyntaxasStorageClass ()
 
virtual const StorageClassSyntaxasStorageClass () const
 
virtual BuiltinTypeSpecifierSyntaxasBuiltinTypeSpecifier ()
 
virtual const BuiltinTypeSpecifierSyntaxasBuiltinTypeSpecifier () const
 
virtual TaggedTypeSpecifierSyntaxasTaggedTypeSpecifier ()
 
virtual const TaggedTypeSpecifierSyntaxasTaggedTypeSpecifier () const
 
virtual TypeDeclarationAsSpecifierSyntaxasTypeDeclarationAsSpecifier ()
 
virtual const TypeDeclarationAsSpecifierSyntaxasTypeDeclarationAsSpecifier () const
 
virtual TypeQualifierSyntaxasTypeQualifier ()
 
virtual const TypeQualifierSyntaxasTypeQualifier () const
 
virtual FunctionSpecifierSyntaxasFunctionSpecifier ()
 
virtual const FunctionSpecifierSyntaxasFunctionSpecifier () const
 
virtual AlignmentSpecifierSyntaxasAlignmentSpecifier ()
 
virtual const AlignmentSpecifierSyntaxasAlignmentSpecifier () const
 
virtual TypedefNameSyntaxasTypedefName ()
 
virtual const TypedefNameSyntaxasTypedefName () const
 
virtual ExtGNU_AttributeSpecifierSyntaxasExtGNU_AttributeSpecifier ()
 
virtual const ExtGNU_AttributeSpecifierSyntaxasExtGNU_AttributeSpecifier () const
 
virtual ExtGNU_AttributeSyntaxasExtGNU_Attribute ()
 
virtual const ExtGNU_AttributeSyntaxasExtGNU_Attribute () const
 
virtual ExtGNU_TypeofSyntaxasExtGNU_Typeof ()
 
virtual const ExtGNU_TypeofSyntaxasExtGNU_Typeof () const
 
virtual ExtPSY_QuantifiedTypeSpecifierSyntaxasExtPSY_QuantifiedTypeSpecifier ()
 
virtual const ExtPSY_QuantifiedTypeSpecifierSyntaxasExtPSY_QuantifiedTypeSpecifier () const
 
virtual DeclaratorSyntaxasDeclarator ()
 
virtual const DeclaratorSyntaxasDeclarator () const
 
virtual PointerDeclaratorSyntaxasPointerDeclarator ()
 
virtual const PointerDeclaratorSyntaxasPointerDeclarator () const
 
virtual IdentifierDeclaratorSyntaxasIdentifierDeclarator ()
 
virtual const IdentifierDeclaratorSyntaxasIdentifierDeclarator () const
 
virtual AbstractDeclaratorSyntaxasAbstractDeclarator ()
 
virtual const AbstractDeclaratorSyntaxasAbstractDeclarator () const
 
virtual ParenthesizedDeclaratorSyntaxasParenthesizedDeclarator ()
 
virtual const ParenthesizedDeclaratorSyntaxasParenthesizedDeclarator () const
 
virtual ArrayOrFunctionDeclaratorSyntaxasArrayOrFunctionDeclarator ()
 
virtual const ArrayOrFunctionDeclaratorSyntaxasArrayOrFunctionDeclarator () const
 
virtual DeclaratorSuffixSyntaxasDeclaratorSuffix ()
 
virtual const DeclaratorSuffixSyntaxasDeclaratorSuffix () const
 
virtual SubscriptSuffixSyntaxasSubscriptSuffix ()
 
virtual const SubscriptSuffixSyntaxasSubscriptSuffix () const
 
virtual ParameterSuffixSyntaxasParameterSuffix ()
 
virtual const ParameterSuffixSyntaxasParameterSuffix () const
 
virtual BitfieldDeclaratorSyntaxasBitfieldDeclarator ()
 
virtual const BitfieldDeclaratorSyntaxasBitfieldDeclarator () const
 
virtual TypeNameSyntaxasTypeName ()
 
virtual const TypeNameSyntaxasTypeName () const
 
virtual InitializerSyntaxasInitializer ()
 
virtual const InitializerSyntaxasInitializer () const
 
virtual ExpressionInitializerSyntaxasExpressionInitializer ()
 
virtual const ExpressionInitializerSyntaxasExpressionInitializer () const
 
virtual BraceEnclosedInitializerSyntaxasBraceEnclosedInitializer ()
 
virtual const BraceEnclosedInitializerSyntaxasBraceEnclosedInitializer () const
 
virtual DesignatedInitializerSyntaxasDesignatedInitializer ()
 
virtual const DesignatedInitializerSyntaxasDesignatedInitializer () const
 
virtual DesignatorSyntaxasDesignator ()
 
virtual const DesignatorSyntaxasDesignator () const
 
virtual ArrayDesignatorSyntaxasArrayDesignator ()
 
virtual const ArrayDesignatorSyntaxasArrayDesignator () const
 
virtual FieldDesignatorSyntaxasFieldDesignator ()
 
virtual const FieldDesignatorSyntaxasFieldDesignator () const
 
virtual ExpressionSyntaxasExpression ()
 
virtual const ExpressionSyntaxasExpression () const
 
virtual IdentifierExpressionSyntaxasIdentifierExpression ()
 
virtual const IdentifierExpressionSyntaxasIdentifierExpression () const
 
virtual ConstantExpressionSyntaxasConstantExpression ()
 
virtual const ConstantExpressionSyntaxasConstantExpression () const
 
virtual StringLiteralExpressionSyntaxasStringLiteralExpression ()
 
virtual const StringLiteralExpressionSyntaxasStringLiteralExpression () const
 
virtual ParenthesizedExpressionSyntaxasParenthesizedExpression ()
 
virtual const ParenthesizedExpressionSyntaxasParenthesizedExpression () const
 
virtual GenericSelectionExpressionSyntaxasGenericSelectionExpression ()
 
virtual const GenericSelectionExpressionSyntaxasGenericSelectionExpression () const
 
virtual GenericAssociationSyntaxasGenericAssociation ()
 
virtual const GenericAssociationSyntaxasGenericAssociation () const
 
virtual ExtGNU_EnclosedCompoundStatementExpressionSyntaxasExtGNU_EnclosedCompoundStatementExpression ()
 
virtual const ExtGNU_EnclosedCompoundStatementExpressionSyntaxasExtGNU_EnclosedCompoundStatementExpression () const
 
virtual UnaryExpressionSyntaxasUnaryExpression ()
 
virtual const UnaryExpressionSyntaxasUnaryExpression () const
 
virtual PostfixUnaryExpressionSyntaxasPostfixUnaryExpression ()
 
virtual const PostfixUnaryExpressionSyntaxasPostfixUnaryExpression () const
 
virtual PrefixUnaryExpressionSyntaxasPrefixUnaryExpression ()
 
virtual const PrefixUnaryExpressionSyntaxasPrefixUnaryExpression () const
 
virtual MemberAccessExpressionSyntaxasMemberAccessExpression ()
 
virtual const MemberAccessExpressionSyntaxasMemberAccessExpression () const
 
virtual ArraySubscriptExpressionSyntaxasArraySubscriptExpression ()
 
virtual const ArraySubscriptExpressionSyntaxasArraySubscriptExpression () const
 
virtual TypeTraitExpressionSyntaxasTypeTraitExpression ()
 
virtual const TypeTraitExpressionSyntaxasTypeTraitExpression () const
 
virtual CallExpressionSyntaxasCallExpression ()
 
virtual const CallExpressionSyntaxasCallExpression () const
 
virtual CompoundLiteralExpressionSyntaxasCompoundLiteralExpression ()
 
virtual const CompoundLiteralExpressionSyntaxasCompoundLiteralExpression () const
 
virtual CastExpressionSyntaxasCastExpression ()
 
virtual const CastExpressionSyntaxasCastExpression () const
 
virtual BinaryExpressionSyntaxasBinaryExpression ()
 
virtual const BinaryExpressionSyntaxasBinaryExpression () const
 
virtual ConditionalExpressionSyntaxasConditionalExpression ()
 
virtual const ConditionalExpressionSyntaxasConditionalExpression () const
 
virtual AssignmentExpressionSyntaxasAssignmentExpression ()
 
virtual const AssignmentExpressionSyntaxasAssignmentExpression () const
 
virtual SequencingExpressionSyntaxasSequencingExpression ()
 
virtual const SequencingExpressionSyntaxasSequencingExpression () const
 
virtual StatementSyntaxasStatement ()
 
virtual const StatementSyntaxasStatement () const
 
virtual CompoundStatementSyntaxasCompoundStatement ()
 
virtual const CompoundStatementSyntaxasCompoundStatement () const
 
virtual DeclarationStatementSyntaxasDeclarationStatement ()
 
virtual const DeclarationStatementSyntaxasDeclarationStatement () const
 
virtual ExpressionStatementSyntaxasExpressionStatement ()
 
virtual const ExpressionStatementSyntaxasExpressionStatement () const
 
virtual LabeledStatementSyntaxasLabeledStatement ()
 
virtual const LabeledStatementSyntaxasLabeledStatement () const
 
virtual IfStatementSyntaxasIfStatement ()
 
virtual const IfStatementSyntaxasIfStatement () const
 
virtual SwitchStatementSyntaxasSwitchStatement ()
 
virtual const SwitchStatementSyntaxasSwitchStatement () const
 
virtual WhileStatementSyntaxasWhileStatement ()
 
virtual const WhileStatementSyntaxasWhileStatement () const
 
virtual DoStatementSyntaxasDoStatement ()
 
virtual const DoStatementSyntaxasDoStatement () const
 
virtual ForStatementSyntaxasForStatement ()
 
virtual const ForStatementSyntaxasForStatement () const
 
virtual GotoStatementSyntaxasGotoStatement ()
 
virtual const GotoStatementSyntaxasGotoStatement () const
 
virtual ContinueStatementSyntaxasContinueStatement ()
 
virtual const ContinueStatementSyntaxasContinueStatement () const
 
virtual BreakStatementSyntaxasBreakStatement ()
 
virtual const BreakStatementSyntaxasBreakStatement () const
 
virtual ReturnStatementSyntaxasReturnStatement ()
 
virtual const ReturnStatementSyntaxasReturnStatement () const
 
virtual ExtGNU_AsmStatementSyntaxasExtGNU_AsmStatement ()
 
virtual const ExtGNU_AsmStatementSyntaxasExtGNU_AsmStatement () const
 
virtual ExtGNU_AsmQualifierSyntaxasExtGNU_AsmQualifier ()
 
virtual const ExtGNU_AsmQualifierSyntaxasExtGNU_AsmQualifier () const
 
virtual ExtGNU_AsmOperandSyntaxasExtGNU_AsmOperand ()
 
virtual const ExtGNU_AsmOperandSyntaxasExtGNU_AsmOperand () const
 
virtual AmbiguousTypedefNameOrIdentifierExpressionSyntaxasAmbiguousTypedefNameOrIdentifierExpression ()
 
virtual const AmbiguousTypedefNameOrIdentifierExpressionSyntaxasAmbiguousTypedefNameOrIdentifierExpression () const
 
virtual AmbiguousCastOrBinaryExpressionSyntaxasAmbiguousCastOrBinaryExpression ()
 
virtual const AmbiguousCastOrBinaryExpressionSyntaxasAmbiguousCastOrBinaryExpression () const
 
virtual AmbiguousExpressionOrDeclarationStatementSyntaxasAmbiguousExpressionOrDeclarationStatement ()
 
virtual const AmbiguousExpressionOrDeclarationStatementSyntaxasAmbiguousExpressionOrDeclarationStatement () const
 
void acceptVisitor (SyntaxVisitor *visitor) const
 
- Public Member Functions inherited from psy::C::Managed
 Managed (const Managed &)=delete
 
void operator= (const Managed &)=delete
 
void * operator new (size_t size, MemoryPool *pool)
 
void operator delete (void *)
 
void operator delete (void *, MemoryPool *)
 

Private Attributes

SpecifierListSyntaxspecs_ = nullptr
 
DeclaratorListSyntaxdecltors_ = nullptr
 
LexedTokens::IndexType semicolonTkIdx_ = LexedTokens::invalidIndex()
 
SymbolList< Symbol * > * syms_ = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from psy::C::SyntaxNode
static void acceptVisitor (const SyntaxNode *node, SyntaxVisitor *visitor)
 
template<class PtrT , class DerivedListT >
static void acceptVisitor (List< PtrT, DerivedListT > *it, SyntaxVisitor *visitor)
 
- Protected Member Functions inherited from psy::C::SyntaxNode
 SyntaxNode (SyntaxTree *tree, SyntaxKind kind=Error)
 
SyntaxToken tokenAtIndex (LexedTokens::IndexType tkIdx) const
 
SyntaxToken findValidToken (const std::vector< SyntaxHolder > &syntaxHolders) const
 
void visitChildren (SyntaxVisitor *visitor) const
 
virtual std::vector< SyntaxHolderchildNodesAndTokens () const
 
virtual SyntaxVisitor::Action dispatchVisit (SyntaxVisitor *visitor) const =0
 
- Protected Attributes inherited from psy::C::SyntaxNode
SyntaxTreetree_
 
SyntaxKind kind_
 

Detailed Description

The VariableAndOrFunctionDeclarationSyntax class.

A declaration that declares one ore more of the following:

It isn't distinguished, by means of a further inherited type, the exact variety of the declaration, i.e., there are no "VariableDeclarationSyntax" or "FunctionDeclarationSyntax" class. Yet, the declarator within this declaration is refined enough: identifying either an object or a function. The reason for this design is explained through the snippet below:

double x, y();

According to the grammar of C, there's a single declaration in the above snippet, one that starts with double and ends with the semicolon ;. This declaration declares a variable named x, and a function named y. Specifically, the type specifier double is shared both declarators (in the latter case, it states the return type of y). Therefore, by providing only a "variable and/or function" syntax, we keep the AST consistent and rewritable, without introducing artificial artifacts.

Remarks
6.7.6-2
Note
Similar to:
  • clang::VarDecl and clang::FunctionDecl of LLVM/Clang.
  • Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclarationSyntax and Microsoft.CodeAnalysis.CSharp.Syntax.BaseMethodDeclarationSyntax of Roslyn.

The documentation for this class was generated from the following file: