规范 include

This commit is contained in:
2026-02-03 19:20:51 +08:00
parent 4535f75058
commit 45e18cc773
13 changed files with 47 additions and 95 deletions

View File

@@ -1,4 +1,4 @@
#include "Ast/Expressions/VarExpr.hpp"
#include <Ast/Expressions/VarExpr.hpp>
#include <Ast/Statements/ErrorFlow.hpp>
#include <Ast/Statements/ImplementSt.hpp>
#include <Ast/astBase.hpp>
@@ -194,7 +194,8 @@ namespace Fig
else if (isThis(TokenType::Colon)) // :
{
next(); // skip `:`
Ast::Expression type_exp = parseExpression(0, TokenType::Comma, TokenType::RightParen, TokenType::Assign);
Ast::Expression type_exp =
parseExpression(0, TokenType::Comma, TokenType::RightParen, TokenType::Assign);
if (isThis(TokenType::Assign)) // =
{
next(); // skip `=`
@@ -927,10 +928,7 @@ namespace Fig
}
expect(TokenType::RightBrace);
next(); // consume `}`
return makeAst<Ast::InitExprAst>(
structe,
args,
static_cast<Ast::InitExprAst::InitMode>(mode));
return makeAst<Ast::InitExprAst>(structe, args, static_cast<Ast::InitExprAst::InitMode>(mode));
}
Ast::Expression Parser::__parseTupleOrParenExpr()

View File

@@ -1,6 +1,6 @@
#pragma once
#include "Token/token.hpp"
#include <Token/token.hpp>
#include <Ast/astBase.hpp>
#include <Ast/ast.hpp>
#include <Lexer/lexer.hpp>
@@ -154,10 +154,8 @@ namespace Fig
tokenPruduced++;
if (tok == IllegalTok) throw lexer.getError();
currentTokenIndex = tokenPruduced - 1;
setCurrentAAI(Ast::AstAddressInfo{.line = tok.line,
.column = tok.column,
.sourcePath = sourcePathPtr,
.sourceLines = sourceLinesPtr});
setCurrentAAI(Ast::AstAddressInfo{
.line = tok.line, .column = tok.column, .sourcePath = sourcePathPtr, .sourceLines = sourceLinesPtr});
previousTokens.push_back(tok);
}
@@ -314,16 +312,18 @@ namespace Fig
Ast::MapExpr __parseMapExpr(); // entry: current is `{`
Ast::InitExpr __parseInitExpr(Ast::Expression); // entry: current is `{`, ahead is struct type exp.
Ast::Expression __parseTupleOrParenExpr(); // entry: current is `(`
Ast::Expression __parseTupleOrParenExpr(); // entry: current is `(`
Ast::FunctionLiteralExpr __parseFunctionLiteralExpr(); // entry: current is Token::LParen after Token::Function
Ast::Import __parseImport(); // entry: current is Token::Import
Ast::Statement __parseStatement(bool = true); // entry: (idk)
Ast::Expression parseExpression(Precedence, TokenType = TokenType::Semicolon, TokenType = TokenType::Semicolon, TokenType = TokenType::Semicolon);
Ast::Expression parseExpression(Precedence,
TokenType = TokenType::Semicolon,
TokenType = TokenType::Semicolon,
TokenType = TokenType::Semicolon);
std::vector<Ast::AstBase> parseAll();
};
}; // namespace Fig