Small fix

This commit is contained in:
Krzosa Karol
2024-06-06 13:38:11 +02:00
parent 322f9f27a8
commit 73ebb34787
5 changed files with 16 additions and 6 deletions

View File

@@ -102,7 +102,11 @@ LC_FUNCTION LC_Token *LC_MatchKeyword(LC_Intern intern) {
// Pratt expression parser
// Based on this really good article: https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html
// clang-format off
LC_FUNCTION LC_Precedence LC_MakePrecedence(int left, int right) { return {left, right}; }
LC_FUNCTION LC_Precedence LC_MakePrecedence(int left, int right) {
LC_Precedence result = {left, right};
return result;
}
LC_FUNCTION LC_Precedence LC_GetPrecedence(LC_PrecedenceKind p, LC_TokenKind kind) {
if (p == LC_PrecedenceKind_Prefix) goto Prefix;
if (p == LC_PrecedenceKind_Infix) goto Infix;

View File

@@ -115,12 +115,12 @@ void WASM_EXPORT(test)(void) {
LC_Intern name = LC_ILit("file");
LC_AddSingleFilePackage(name, LC_Lit("file.lc"));
LC_ASTRefList packages = LC_ParseAndResolve(name);
LC_ParseAndResolve(name);
if (L->errors == 0) {
LC_BeginStringGen(L->arena);
for (LC_ASTRef *it = packages.first; it; it = it->next) LC_GenCHeader(it->ast);
for (LC_ASTRef *it = packages.first; it; it = it->next) LC_GenCImpl(it->ast);
for (LC_ASTRef *it = L->ordered_packages.first; it; it = it->next) LC_GenCHeader(it->ast);
for (LC_ASTRef *it = L->ordered_packages.last; it; it = it->next) LC_GenCImpl(it->ast);
LC_String result = LC_EndStringGen(L->arena);
LC_String code_output = LC_Lit("//\n// Code output\n//");