The Psyche Project
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
psy::C::SyntaxTree Class Reference

The SyntaxTree class. More...

#include <SyntaxTree.h>

Classes

struct  SyntaxTreeImpl
 

Public Types

enum  SyntaxCategory : uint8_t { UNSPECIFIED = 0, Declarations, Expressions, Statements }
 The SyntaxCategory enumeration. More...
 

Public Member Functions

std::string filePath () const
 
const SourceTexttext () const
 
SyntaxNoderoot () const
 
bool hasTranslationUnitRoot () const
 
TranslationUnitSyntaxtranslationUnitRoot () const
 
std::vector< Diagnosticdiagnostics () const
 

Static Public Member Functions

static std::unique_ptr< SyntaxTreeparseText (SourceText text, TextPreprocessingState textPPState, TextCompleteness textCompleteness, ParseOptions parseOptions=ParseOptions(), const std::string &filePath="", SyntaxCategory syntaxCategory=SyntaxCategory::UNSPECIFIED)
 

Detailed Description

The SyntaxTree class.

Note
This API is inspired by that of Microsoft.CodeAnalysis.SyntaxTree from Roslyn, the .NET Compiler Platform.

Member Enumeration Documentation

◆ SyntaxCategory

enum psy::C::SyntaxTree::SyntaxCategory : uint8_t
strong

The SyntaxCategory enumeration.

The possible categories of syntax that a SyntaxTree may represent. If unspecified, it is assumed that a SyntaxTree represents a translation-unit.

Member Function Documentation

◆ diagnostics()

std::vector< Diagnostic > SyntaxTree::diagnostics ( ) const

The diagnostics in this SyntaxTree.

◆ filePath()

std::string SyntaxTree::filePath ( ) const

The path of the file associated to this SyntaxTree.

◆ hasTranslationUnitRoot()

bool SyntaxTree::hasTranslationUnitRoot ( ) const

Whether this SyntaxTree has a TranslationUnit as the root node.

◆ parseText()

std::unique_ptr< SyntaxTree > SyntaxTree::parseText ( SourceText  text,
TextPreprocessingState  textPPState,
TextCompleteness  textCompleteness,
ParseOptions  parseOptions = ParseOptions(),
const std::string &  filePath = "",
SyntaxCategory  syntaxCategory = SyntaxCategory::UNSPECIFIED 
)
static

Parse the input text, as according to the syntaxCategory, in order to build this SyntaxTree.

◆ root()

SyntaxNode * SyntaxTree::root ( ) const

The root node of this this SyntaxTree.

◆ text()

const SourceText & SyntaxTree::text ( ) const

The SourceText associated to this SyntaxTree.

◆ translationUnitRoot()

TranslationUnitSyntax * SyntaxTree::translationUnitRoot ( ) const

The TranslationUnit root of this SyntaxTree (in one exists).


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