some improvements i think

This commit is contained in:
2026-01-16 13:32:36 +02:00
parent 49adb21b81
commit c69f589439
16 changed files with 338 additions and 5 deletions

53
asmrigs/brb/lexer.cpp Normal file
View File

@@ -0,0 +1,53 @@
#include "brb.h"
abstract_class CBLexerWord: public IBLexerWord
{
public:
virtual int GetType() override;
CUtlVector<ILexerWord*> m_children;
EBWordType m_eType;
};
int CBLexerWord::GetType()
{
return m_eType;
}
uint32_t CBLexerWord::GetNumChildren()
{
return m_children.GetSize();
}
ILexerWord **CBLexerWord::GetChildren()
{
return m_children.GetData();
}
class CBLexer: public ILexer
{
public:
virtual ILexerWord *ParseTokens( CUtlVector<Token_t> tokens ) override;
CBLexerWord *ParseFunctionBody( Token_t *&pToken, const Token_t *pEnding );
bool GetExpectedToken();
CUtlString GetStringLiteral();
};
#define NEXT_TOKEN() \
pToken++; \
if (pToken == pEnding) \
goto eof \
ILexerWord *CBLexer::ParseTokens( CUtlVector<Token_t> tokens )
{
Token_t *pCurrentToken = tokens.GetData();
Token_t *pEndingToken = tokens.GetData() + tokens.GetSize();
CBLexerWord *pGlobalWord = new CBLexerWord;
return pGlobalWord;
};