Gyoji Compiler
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Gyoji::frontend::tree::TerminalNonSyntax Class Reference

Represents whitespace, comments, and metadata for the source file. More...

#include <tree.hpp>

Public Types

enum  Type { EXTRA_COMMENT_SINGLE_LINE , EXTRA_COMMENT_MULTI_LINE , EXTRA_WHITESPACE , EXTRA_FILE_METADATA }
 

Public Member Functions

 TerminalNonSyntax (Type _type, const Gyoji::context::Token &_token)
 
 ~TerminalNonSyntax ()
 
const Typeget_type () const
 
const std::stringget_data () const
 

Detailed Description

Represents whitespace, comments, and metadata for the source file.

This class represents data obtained from the lexical stage that did not affect the syntax. This data includes whitespace, comments, and file metadata. This data is useful to track because it may be used in code-formatters to faithfully reproduce the input and is also useful in providing meaningful error messaging with context surrounding the error.

Member Enumeration Documentation

◆ Type

Enumerator
EXTRA_COMMENT_SINGLE_LINE 

This token is a single-line double-slash (C++-style) comment.

EXTRA_COMMENT_MULTI_LINE 

This token is a multi-line slash-star (C-style) comment.

EXTRA_WHITESPACE 

This token consists of whitespace between parsed tokens.

EXTRA_FILE_METADATA 

This token consists of a file metadata token used in error reporting for generated files so that errors can be traced back to their origin source-files.

Constructor & Destructor Documentation

◆ TerminalNonSyntax()

TerminalNonSyntax::TerminalNonSyntax ( TerminalNonSyntax::Type  _type,
const Gyoji::context::Token _token 
)

Constructs a non-syntax node corresponding to the given lexical token of the given token type.

◆ ~TerminalNonSyntax()

TerminalNonSyntax::~TerminalNonSyntax ( )

Destructor, nothing special.

Member Function Documentation

◆ get_data()

const std::string & TerminalNonSyntax::get_data ( ) const

This method provides access to the raw input for the type of non-syntax data available.

◆ get_type()

const TerminalNonSyntax::Type & TerminalNonSyntax::get_type ( ) const

This method returns the type of data from the enum above.


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