Add better error message

This commit is contained in:
2025-12-16 03:11:52 -06:00
parent bbf122a7eb
commit deb492b8c4
18 changed files with 300 additions and 20 deletions

View File

@@ -1304,6 +1304,15 @@ namespace Tesses::CrossLang
}
return node;
}
bool Parser::CanEmit(LexTokenLineInfo& ifo)
{
if(!this->debug) return false;
bool same = ifo.line == this->lastLine && ifo.filename == this->lastFile;
this->lastFile = ifo.filename;
this->lastLine = ifo.line;
return !same;
}
SyntaxNode Parser::ParseNode(bool isRoot)
{
std::string documentation="";
@@ -1324,6 +1333,8 @@ namespace Tesses::CrossLang
while(i < tokens.size() && (isRoot || !IsSymbol("}",false)))
{
auto token = tokens[i];
if(CanEmit(token.lineInfo)) aSN.nodes.push_back(AdvancedSyntaxNode::Create(LineNode,false, {(int64_t)tokens[i].lineInfo.line,tokens[i].lineInfo.filename}));
aSN.nodes.push_back(ParseNode());
IsSymbol(";");
}