sun::parsing::Parser
class · Source (opens in a new tab)
class sun::parsing::ParserParses Sun source into syntax trees and collects source comments.
Types
- sun::parsing::Parser::ParsedPattern (public)
Public Functions
- Parser
- atMethodKeyword
- captureStart
- collectMoonImport
- createModuleStubs
- createStringParser
- extendSpan
- extendSpanStart
- finishIndexedAssignment
- finishMemberAssignment
- finishNode
- finishVariableAssignment
- getComments
- getCurrentOffset
- getFilePath
- getNextToken
- getPrecompiledImports
- getSourceText
- isLambdaLiteralStart
- isTypeToken
- parseArrayLiteral
- parseAssignmentOrExpression
- parseBinOpRhs
- parseBlock
- parseBreak
- parseCharLiteral
- parseClassDefinition
- parseConstModifier
- parseConstStatement
- parseContinue
- parseDeclareStatement
- parseEnumDefinition
- parseExpression
- parseExtern
- parseForLoop
- parseFunction
- parseFunctionLiteral
- parseIdentifierExpr
- parseIfStatement
- parseInterfaceDefinition
- parseLambda
- parseLifecycleMethod
- parseManifest
- parseManifestArchives
- parseManifestMoons
- parseManifestProtos
- parseManifestSuns
- parseManifestTargets
- parseMatchExpression
- parseModuleDecl
- parseNumberExpr
- parseParenExpr
- parsePattern
- parsePostfixExpr
- parsePrimary
- parseProgram
- parsePrototype
- parsePublic
- parseQualifiedNameTail
- parseQualifiedOrSimpleName
- parseRefStatement
- parseStatement
- parseStatementCore
- parseString
- parseStringLiteral
- parseStructLiteral
- parseTypeAnnotation
- parseTypeAnnotationImpl
- parseTypeConstraint
- parseTypeParameterList
- parseUnary
- parseUnsafeBlock
- parseUsingStatement
- parseVarDeclaration
- parseVarStatement
- parseVariadicParam
- parseWhileLoop
- pushToken
- setBaseDir
- setCollectComments
- setFilePath
- setPrecompiledImports
- setSourceFileId
- setUsesStringInterpolation
- usesStringInterpolation
Parser
Parser()
public · function · Source (opens in a new tab)
sun::parsing::Parser::Parser()Initializes a parser with empty input and default parsing state.
Parser(std::istream &input)
public · function · Source (opens in a new tab)
sun::parsing::Parser::Parser(std::istream &input)Updated constructor: takes both input stream and codegen context.
atMethodKeyword
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::atMethodKeyword() constTrue when the current token is the contextual method keyword.
method only starts a member of a class or interface; everywhere else it is an ordinary identifier, so a field or variable may still be called method.
captureStart
public · function · Source (opens in a new tab)
sun::support::Position sun::parsing::Parser::captureStart() constStart position of the node about to be parsed (curTok is its first token).
Related: sun::support::Position
collectMoonImport
public · function · Source (opens in a new tab)
std::unique_ptr< MoonScopeAST > sun::parsing::Parser::collectMoonImport(const sun::moon_bundling::MoonImport &moonImport)Collect AST stubs from a precompiled .moon file Returns a MoonScopeAST wrapping all module stubs with content hash Returns nullptr if the moon was already imported.
Related: sun::ast::MoonScopeAST, sun::moon_bundling::MoonImport, MoonScopeAST
createModuleStubs
public · function · Source (opens in a new tab)
void sun::parsing::Parser::createModuleStubs(const sun::moon::ModuleMetadata &metadata, std::vector< std::unique_ptr< ExprAST > > &collectedAST)Create AST stubs from module metadata and append to collectedAST Used by both .moon imports and .sun metadata-driven imports.
Related: ExprAST
createStringParser
public · function · static · Source (opens in a new tab)
static Parser sun::parsing::Parser::createStringParser(const std::string &source)Creates a parser reading the supplied source string.
Related: Parser
extendSpan
public · function · Source (opens in a new tab)
void sun::parsing::Parser::extendSpan(ExprAST &node, const sun::support::Position &start) constSpan variant for left-recursive constructs: start comes from an already-stamped sub-node's location.
Related: ExprAST, sun::support::Position
extendSpanStart
public · function · static · Source (opens in a new tab)
static void sun::parsing::Parser::extendSpanStart(ExprAST &node, sun::support::Position start)Move a node's span start back to start (e.g.
over a leading modifier)
Related: ExprAST, sun::support::Position
finishIndexedAssignment
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::finishIndexedAssignment(unique_ptr< ExprAST > expr)Parses an assignment to an already parsed indexed expression.
Related: ExprAST
finishMemberAssignment
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::finishMemberAssignment(unique_ptr< ExprAST > lhs)Parses an assignment to an already parsed member expression.
Related: ExprAST
finishNode
public · function · Source (opens in a new tab)
template <typename NodeT>
unique_ptr< NodeT > sun::parsing::Parser::finishNode(unique_ptr< NodeT > node, sun::support::Position start) constStamp span [start, end-of-last-consumed-token] onto a finished node.
Related: sun::support::Position
finishVariableAssignment
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::finishVariableAssignment(const std::string &name, const sun::support::Position &namePos)Parses the value assigned to an already parsed variable name.
Related: ExprAST, sun::support::Position
getComments
public · function · Source (opens in a new tab)
const std::map< int, Comment > & sun::parsing::Parser::getComments() constCollected comments, keyed by absolute start offset.
Related: Comment
getCurrentOffset
public · function · Source (opens in a new tab)
int sun::parsing::Parser::getCurrentOffset() constGet current position offset.
getFilePath
public · function · Source (opens in a new tab)
const std::string & sun::parsing::Parser::getFilePath() constReturns the file path stored by this object.
getNextToken
public · function · Source (opens in a new tab)
Token sun::parsing::Parser::getNextToken()Parsing functions.
Related: Token
getPrecompiledImports
public · function · Source (opens in a new tab)
const std::vector< std::string > & sun::parsing::Parser::getPrecompiledImports() constGet the list of precompiled imports discovered during parsing.
getSourceText
public · function · Source (opens in a new tab)
std::string sun::parsing::Parser::getSourceText(int startOffset, int endOffset) constGet source text from lexer buffer (for storing generic method source).
isLambdaLiteralStart
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::isLambdaLiteralStart()True when the current token begins a fat-arrow lambda.
The check restores all parser state before returning, so parentheses and array literals stay ordinary expressions when no lambda signature follows.
isTypeToken
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::isTypeToken(TokenKind kind)Reports whether a token can start a type annotation.
Related: TokenKind
parseArrayLiteral
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseArrayLiteral()Consumes tokens for a array literal and builds its syntax-tree representation.
Related: ExprAST
parseAssignmentOrExpression
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseAssignmentOrExpression()Consumes tokens for a assignment or value expression and builds its syntax-tree representation.
Related: ExprAST
parseBinOpRhs
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseBinOpRhs(int exprPrec, unique_ptr< ExprAST > lhs)Consumes tokens for a binary-operation continuation and builds its syntax-tree representation.
Related: ExprAST
parseBlock
public · function · Source (opens in a new tab)
unique_ptr< BlockExprAST > sun::parsing::Parser::parseBlock(sun::ast::BlockKind kind, bool itemLevel=false)Every block records what construct it is the body of (see BlockKind); only a match arm's or an unsafe block's body evaluates to a value.
Related: BlockExprAST, sun::ast::BlockKind, BlockKind
parseBreak
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::BreakAST > sun::parsing::Parser::parseBreak()Consumes tokens for a loop break and builds its syntax-tree representation.
Related: sun::ast::BreakAST
parseCharLiteral
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseCharLiteral()Consumes tokens for a character literal and builds its syntax-tree representation.
Related: ExprAST
parseClassDefinition
public · function · Source (opens in a new tab)
unique_ptr< ClassDefinitionAST > sun::parsing::Parser::parseClassDefinition()Class definition parsing: class Name { fields and methods }.
Related: sun::ast::ClassDefinitionAST
parseConstModifier
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::parseConstModifier()Consumes an optional const before a class/interface member.
parseConstStatement
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseConstStatement()const x = ...; or const ref r = x;
Related: ExprAST
parseContinue
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::ContinueAST > sun::parsing::Parser::parseContinue()Consumes tokens for a loop continuation and builds its syntax-tree representation.
Related: sun::ast::ContinueAST
parseDeclareStatement
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseDeclareStatement()Declare statement parsing:
- Forward function declaration: declare function name(args) RetType;
- Type declaration: declare [Alias =] Type<Args>;
Related: ExprAST
parseEnumDefinition
public · function · Source (opens in a new tab)
unique_ptr< EnumDefinitionAST > sun::parsing::Parser::parseEnumDefinition()Enum definition parsing: enum Name { Variant1, Variant2, ... }.
Related: sun::ast::EnumDefinitionAST
parseExpression
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseExpression()Consumes tokens for a expression and builds its syntax-tree representation.
Related: ExprAST
parseExtern
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseExtern()Parse an extern function or extern variable declaration.
Related: ExprAST
parseForLoop
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseForLoop()Consumes tokens for a for loop and builds its syntax-tree representation.
Related: ExprAST
parseFunction
public · function · Source (opens in a new tab)
unique_ptr< FunctionAST > sun::parsing::Parser::parseFunction(bool isClassMethod=false, bool isTest=false)Consumes tokens for a function definition and builds its syntax-tree representation.
Related: sun::ast::FunctionAST
parseFunctionLiteral
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseFunctionLiteral(const std::string &name="", std::vector< sun::ast::TypeParameter > typeParameters={}, bool isLambda=false, bool isLifecycleMethod=false, std::vector< sun::ast::LifetimeParameter > lifetimeParameters={}, bool isTestFunction=false)Consumes tokens for a function body and builds its syntax-tree representation.
Related: ExprAST, sun::ast::TypeParameter, sun::ast::LifetimeParameter
parseIdentifierExpr
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseIdentifierExpr()Consumes tokens for a identifier expression and builds its syntax-tree representation.
Related: ExprAST
parseIfStatement
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::IfExprAST > sun::parsing::Parser::parseIfStatement()Consumes tokens for a conditional statement and builds its syntax-tree representation.
Related: sun::ast::IfExprAST
parseInterfaceDefinition
public · function · Source (opens in a new tab)
unique_ptr< InterfaceDefinitionAST > sun::parsing::Parser::parseInterfaceDefinition()Interface definition parsing: interface Name { fields and methods }.
Related: sun::ast::InterfaceDefinitionAST
parseLambda
public · function · Source (opens in a new tab)
unique_ptr< LambdaAST > sun::parsing::Parser::parseLambda()Consumes tokens for a lambda expression and builds its syntax-tree representation.
Related: sun::ast::LambdaAST
parseLifecycleMethod
public · function · Source (opens in a new tab)
unique_ptr< FunctionAST > sun::parsing::Parser::parseLifecycleMethod()Parse a constructor or destructor member: init(args) { } / deinit() { }.
They are written without 'public' or 'method' and are always public.
Related: sun::ast::FunctionAST
parseManifest
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::ManifestAST > sun::parsing::Parser::parseManifest()Consumes tokens for a dependency manifest and builds its syntax-tree representation.
Related: sun::ast::ManifestAST
parseManifestArchives
public · function · Source (opens in a new tab)
std::vector< ManifestArchiveDependency > sun::parsing::Parser::parseManifestArchives()Consumes tokens for a archive dependency list and builds its syntax-tree representation.
Related: sun::ast::ManifestArchiveDependency
parseManifestMoons
public · function · Source (opens in a new tab)
std::vector< ManifestMoonDependency > sun::parsing::Parser::parseManifestMoons()Consumes tokens for a compiled-library dependency list and builds its syntax-tree representation.
Related: sun::ast::ManifestMoonDependency
parseManifestProtos
public · function · Source (opens in a new tab)
std::vector< ManifestProtoDependency > sun::parsing::Parser::parseManifestProtos()Consumes tokens for a protobuf dependency list and builds its syntax-tree representation.
Related: sun::ast::ManifestProtoDependency
parseManifestSuns
public · function · Source (opens in a new tab)
std::vector< ManifestSunDependency > sun::parsing::Parser::parseManifestSuns()Consumes tokens for a source dependency list and builds its syntax-tree representation.
Related: sun::ast::ManifestSunDependency
parseManifestTargets
public · function · Source (opens in a new tab)
std::vector< ManifestTargetBlock > sun::parsing::Parser::parseManifestTargets()Consumes tokens for a target-specific dependency settings and builds its syntax-tree representation.
Related: sun::ast::ManifestTargetBlock
parseMatchExpression
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::MatchExprAST > sun::parsing::Parser::parseMatchExpression()Consumes tokens for a pattern match and builds its syntax-tree representation.
Related: sun::ast::MatchExprAST
parseModuleDecl
public · function · Source (opens in a new tab)
unique_ptr< ModuleAST > sun::parsing::Parser::parseModuleDecl()Module declaration parsing: module Name { ... }.
Related: sun::ast::ModuleAST
parseNumberExpr
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseNumberExpr()Consumes tokens for a numeric literal and builds its syntax-tree representation.
Related: ExprAST
parseParenExpr
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseParenExpr()Consumes tokens for a parenthesized expression and builds its syntax-tree representation.
Related: ExprAST
parsePattern
public · function · Source (opens in a new tab)
Parser::ParsedPattern sun::parsing::Parser::parsePattern()Consumes tokens for a match pattern and builds its syntax-tree representation.
Related: ParsedPattern
parsePostfixExpr
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parsePostfixExpr(unique_ptr< ExprAST > base)Consumes tokens for a postfix expression and builds its syntax-tree representation.
Related: ExprAST
parsePrimary
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parsePrimary()Consumes tokens for a primary expression and builds its syntax-tree representation.
Related: ExprAST
parseProgram
public · function · Source (opens in a new tab)
unique_ptr< BlockExprAST > sun::parsing::Parser::parseProgram()Consumes tokens for a complete program and builds its syntax-tree representation.
Related: BlockExprAST
parsePrototype
public · function · Source (opens in a new tab)
std::unique_ptr< PrototypeAST > sun::parsing::Parser::parsePrototype()Consumes tokens for a function signature and builds its syntax-tree representation.
Related: sun::ast::PrototypeAST
parsePublic
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::parsePublic()Consumes an optional public; errors on a duplicate.
parseQualifiedNameTail
public · function · Source (opens in a new tab)
void sun::parsing::Parser::parseQualifiedNameTail(std::string &name)Append dotted path segments after the first identifier of a name.
parseQualifiedOrSimpleName
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseQualifiedOrSimpleName()Parse a qualified name: Namespace::name or Namespace::Nested::name.
Related: ExprAST
parseRefStatement
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::ReferenceCreationAST > sun::parsing::Parser::parseRefStatement(sun::support::Position start, bool isMutable)ref r = x; (mutable) or, after const, const ref r = x;
Related: sun::ast::ReferenceCreationAST, sun::support::Position
parseStatement
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseStatement()Consumes tokens for a statement and builds its syntax-tree representation.
Related: ExprAST
parseStatementCore
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseStatementCore()Consumes tokens for a statement and builds its syntax-tree representation.
Related: ExprAST
parseString
public · function · Source (opens in a new tab)
std::unique_ptr< BlockExprAST > sun::parsing::Parser::parseString(const std::string &source)Consumes tokens for a string literal and builds its syntax-tree representation.
Related: BlockExprAST
parseStringLiteral
public · function · Source (opens in a new tab)
std::unique_ptr< ExprAST > sun::parsing::Parser::parseStringLiteral()Consumes tokens for a string literal and builds its syntax-tree representation.
Related: ExprAST
parseStructLiteral
public · function · Source (opens in a new tab)
unique_ptr< StructLiteralAST > sun::parsing::Parser::parseStructLiteral()Consumes tokens for a field initializer list and builds its syntax-tree representation.
Related: sun::ast::StructLiteralAST
parseTypeAnnotation
public · function · Source (opens in a new tab)
sun::ast::TypeAnnotation sun::parsing::Parser::parseTypeAnnotation()Type parsing.
parseTypeAnnotation stamps the source span; the Impl variant holds the grammar and leaves the span unset.
Related: sun::ast::TypeAnnotation
parseTypeAnnotationImpl
public · function · Source (opens in a new tab)
sun::ast::TypeAnnotation sun::parsing::Parser::parseTypeAnnotationImpl()Consumes tokens for a type annotation and builds its syntax-tree representation.
Related: sun::ast::TypeAnnotation
parseTypeConstraint
public · function · Source (opens in a new tab)
sun::ast::TypeConstraint sun::parsing::Parser::parseTypeConstraint(const std::string ¶mName)The constraint after the colon in <T: _Numeric>.
Stamps the source span the way parseTypeAnnotation does, so diagnostics can point at it.
Related: sun::ast::TypeConstraint
parseTypeParameterList
public · function · Source (opens in a new tab)
std::vector< sun::ast::TypeParameter > sun::parsing::Parser::parseTypeParameterList(std::vector< sun::ast::LifetimeParameter > *lifetimesOut=nullptr)<T, U: _Numeric> or <'a, T> after a function, class, interface or enum name.
Returns empty when there is no '<' — the declaration is not generic. Each parameter may carry one constraint the type argument must satisfy: a built-in trait such as _Numeric, or an interface name. Lifetime parameters come first and land in lifetimesOut; passing nullptr rejects them for declarations that do not accept lifetimes.
Related: sun::ast::TypeParameter, sun::ast::LifetimeParameter
parseUnary
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseUnary()Consumes tokens for a unary operation and builds its syntax-tree representation.
Related: ExprAST
parseUnsafeBlock
public · function · Source (opens in a new tab)
unique_ptr< ExprAST > sun::parsing::Parser::parseUnsafeBlock()Unsafe block parsing: unsafe { ... }.
Related: ExprAST
parseUsingStatement
public · function · Source (opens in a new tab)
unique_ptr< UsingAST > sun::parsing::Parser::parseUsingStatement()Using statement parsing: using Namespace::name; or using Namespace::*;.
Related: sun::ast::UsingAST
parseVarDeclaration
public · function · Source (opens in a new tab)
unique_ptr< VariableCreationAST > sun::parsing::Parser::parseVarDeclaration()var x = ... or const x = ..., without the trailing semicolon
Related: sun::ast::VariableCreationAST
parseVarStatement
public · function · Source (opens in a new tab)
unique_ptr< VariableCreationAST > sun::parsing::Parser::parseVarStatement()Consumes tokens for a variable declaration and builds its syntax-tree representation.
Related: sun::ast::VariableCreationAST
parseVariadicParam
public · function · Source (opens in a new tab)
VariadicParam sun::parsing::Parser::parseVariadicParam(std::string name)The trailing value pack in a parameter list: args..., or args...: _params_of<T>.
Called with the name already consumed and '...' current. A pack ends the parameter list, so the caller stops after this.
Related: sun::ast::VariadicParam
parseWhileLoop
public · function · Source (opens in a new tab)
unique_ptr< sun::ast::WhileExprAST > sun::parsing::Parser::parseWhileLoop()Consumes tokens for a while loop and builds its syntax-tree representation.
Related: sun::ast::WhileExprAST
pushToken
public · function · Source (opens in a new tab)
void sun::parsing::Parser::pushToken(const Token &token)Returns a token to the parser's lookahead buffer.
Related: Token
setBaseDir
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setBaseDir(const std::string &dir)Setters for import resolution (used by Driver).
Related: Driver
setCollectComments
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setCollectComments(bool collect)Opt in to collecting comments into the side table (off by default).
setFilePath
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setFilePath(const std::string &path)Set the file path for error messages.
setPrecompiledImports
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setPrecompiledImports(std::shared_ptr< std::vector< std::string > > imports)Updates the precompiled imports stored by this object.
setSourceFileId
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setSourceFileId(sun::support::SourceFileId id)Parse an embedded expression in its enclosing source unit.
Related: sun::support::SourceFileId
setUsesStringInterpolation
public · function · Source (opens in a new tab)
void sun::parsing::Parser::setUsesStringInterpolation(bool value)Records whether this string contains embedded expressions.
usesStringInterpolation
public · function · Source (opens in a new tab)
bool sun::parsing::Parser::usesStringInterpolation() constCheck if string interpolation was used during parsing.
Private Functions
- consumeGreater
- expectCurrentTokenKind
- expectIdentifier
- isCommentToken
- isGreater
- parsingError
- recordComment
- splitLessIfShift
- throwIdentifierError
consumeGreater
private · function · Source (opens in a new tab)
void sun::parsing::Parser::consumeGreater(const std::string &msg)Helper: consume a '>' token, handling '>>' split for nested generics Returns true if consumed, throws error with msg if not.
expectCurrentTokenKind
private · function · Source (opens in a new tab)
void sun::parsing::Parser::expectCurrentTokenKind(TokenKind expected, const std::string &msg)Helper: expect current token to be a specific kind, or throw error.
Related: TokenKind
expectIdentifier
private · function · Source (opens in a new tab)
void sun::parsing::Parser::expectIdentifier(const std::string &msg)Helper: expect current token to be an identifier, or throw error.
isCommentToken
private · function · static · Source (opens in a new tab)
static bool sun::parsing::Parser::isCommentToken(const Token &tok)Reports whether a token contains a source comment.
Related: Token
isGreater
private · function · Source (opens in a new tab)
bool sun::parsing::Parser::isGreater() constHelper: check if current token starts with '>' (for lookahead).
parsingError
private · function · Source (opens in a new tab)
void sun::parsing::Parser::parsingError(const std::string &msg)Helper: throw parsing error with source context.
recordComment
private · function · Source (opens in a new tab)
void sun::parsing::Parser::recordComment(const Token &tok, int lastEndLine)Retains a comment and its attachment position for source formatting.
Related: Token
splitLessIfShift
private · function · Source (opens in a new tab)
void sun::parsing::Parser::splitLessIfShift()Helper: when the current token is '<<' (lexed as one shift token), split it into two '<' so a '<'a>' lambda-type marker can open right after a generic argument list: Box<<'a>() => i32>.
throwIdentifierError
private · function · Source (opens in a new tab)
void sun::parsing::Parser::throwIdentifierError(const std::string &msg)Helper: throw the error for a missing identifier.
A keyword standing where a name belongs is reported as such, since "expected identifier" reads as a syntax problem rather than a name collision.
Private Fields
- atItemLevel_
- baseDir
- collectComments_
- comments_
- curTok
- currentFilePath
- lexer
- precompiledImports
- prevTok_
- sourceFileId_
- tokenStack
- usesStringInterpolation_
atItemLevel_
private · variable · Source (opens in a new tab)
bool sun::parsing::Parser::atItemLevel_ = trueNo documentation comment.
baseDir
private · variable · Source (opens in a new tab)
std::string sun::parsing::Parser::baseDirNo documentation comment.
collectComments_
private · variable · Source (opens in a new tab)
bool sun::parsing::Parser::collectComments_ = falseNo documentation comment.
comments_
private · variable · Source (opens in a new tab)
std::map<int, Comment> sun::parsing::Parser::comments_No documentation comment.
Related: Comment
curTok
private · variable · Source (opens in a new tab)
Token sun::parsing::Parser::curTok = Token::eof({0, 0, 0})No documentation comment.
Related: Token, Token::eof
currentFilePath
private · variable · Source (opens in a new tab)
std::string sun::parsing::Parser::currentFilePathNo documentation comment.
lexer
private · variable · Source (opens in a new tab)
Lexer sun::parsing::Parser::lexerNo documentation comment.
Related: Lexer
precompiledImports
private · variable · Source (opens in a new tab)
std::shared_ptr<std::vector<std::string> > sun::parsing::Parser::precompiledImports =
std::make_shared<std::vector<std::string>>()No documentation comment.
prevTok_
private · variable · Source (opens in a new tab)
Token sun::parsing::Parser::prevTok_ = Token::eof({0, 0, 0})No documentation comment.
Related: Token, Token::eof
sourceFileId_
private · variable · Source (opens in a new tab)
sun::support::SourceFileId sun::parsing::Parser::sourceFileId_ = sun::support::nextSourceFileId()No documentation comment.
Related: sun::support::SourceFileId, sun::support::nextSourceFileId
tokenStack
private · variable · Source (opens in a new tab)
std::vector<Token> sun::parsing::Parser::tokenStackNo documentation comment.
Related: Token
usesStringInterpolation_
private · variable · Source (opens in a new tab)
bool sun::parsing::Parser::usesStringInterpolation_ = falseNo documentation comment.