sun::ast::CharLiteralAST
class · Source (opens in a new tab)
class sun::ast::CharLiteralAST : public sun::ast::ExprASTA character literal ('a', type char) or a byte literal (b'a', type u8).
Both are their own node rather than a flag on NumberExprAST: an integer literal takes its type from context, and these two do not. A char is always a char and b'a' is always a u8, so they must be immune to the literal coercion that keys off ASTNodeType::NUMBER.
Inherits
- sun::ast::ExprAST (public)
Public Functions
CharLiteralAST
public · function · Source (opens in a new tab)
sun::ast::CharLiteralAST::CharLiteralAST(uint32_t value, bool isByte)Creates this syntax node and takes ownership of any supplied child expressions.
dotLabel
public · function · Source (opens in a new tab)
std::string sun::ast::CharLiteralAST::dotLabel() const overrideReturns the node label used in syntax-tree graph visualizations.
getType
public · function · Source (opens in a new tab)
ASTNodeType sun::ast::CharLiteralAST::getType() const overrideReturns the syntax-node kind used to dispatch tree visitors.
Related: ASTNodeType
getValue
public · function · Source (opens in a new tab)
uint32_t sun::ast::CharLiteralAST::getValue() constReturns the value represented by this object.
isByte
public · function · Source (opens in a new tab)
bool sun::ast::CharLiteralAST::isByte() constReports whether this syntax node represents a byte literal rather than a Unicode character.
toString
public · function · Source (opens in a new tab)
std::string sun::ast::CharLiteralAST::toString() const overrideA readable spelling for diagnostics and the AST dump.
The formatter does not use this — it reprints literals verbatim from the source.
Private Fields
isByte_
private · variable · Source (opens in a new tab)
bool sun::ast::CharLiteralAST::isByte_No documentation comment.
value_
private · variable · Source (opens in a new tab)
uint32_t sun::ast::CharLiteralAST::value_No documentation comment.