Skip to content

Commit

Permalink
Fix wat parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
osa1 committed Sep 25, 2024
1 parent 0051cbb commit 56abcb5
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/parser/contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1778,16 +1778,26 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
}
contents = contents.substr(lineSize + 1);

lexer = Lexer(contents);
auto colSize = contents.find(':');
auto rest = std::string_view();
if (colSize == contents.npos) {
colSize = contents.size();
if (colSize == 0) {
return;
}
} else {
rest = contents.substr(colSize + 1);
}
lexer = Lexer(contents.substr(0, colSize));
auto col = lexer.takeU32();
if (!col || !lexer.empty()) {
if (!col && !lexer.empty()) {
return;
}
contents = rest;

std::optional<BinaryLocation> symbolNameIndex;
auto namePos = contents.find(':');
if (namePos != contents.npos) {
auto name = contents.substr(namePos + 1);
if (!contents.empty()) {
auto name = contents;
auto [it, inserted] =
debugSymbolNameIndices.insert({name, debugSymbolNameIndices.size()});
if (inserted) {
Expand Down

0 comments on commit 56abcb5

Please sign in to comment.