Support C-Style enum in preproc (#1984)

* [preproc] C-style enums

- asm files parseable from stdin
- 2nd preproc pass
- add parser for C-style `enum`
- positional arguments at end of command

---------

Co-authored-by: sbird <sbird@no.tld>
Co-authored-by: Martin Griffin <martinrgriffin@gmail.com>
This commit is contained in:
Philipp AUER
2024-07-13 19:26:33 +02:00
committed by GitHub
parent a0a02f9733
commit 550e6688aa
9 changed files with 339 additions and 103 deletions

View File

@@ -31,13 +31,14 @@ enum class Directive
Include,
String,
Braille,
Enum,
Unknown
};
class AsmFile
{
public:
AsmFile(std::string filename);
AsmFile(std::string filename, bool isStdin, bool doEnum);
AsmFile(AsmFile&& other);
AsmFile(const AsmFile&) = delete;
~AsmFile();
@@ -49,9 +50,11 @@ public:
bool IsAtEnd();
void OutputLine();
void OutputLocation();
bool ParseEnum();
private:
char* m_buffer;
bool m_doEnum;
long m_pos;
long m_size;
long m_lineNum;
@@ -68,6 +71,10 @@ private:
void RaiseError(const char* format, ...);
void RaiseWarning(const char* format, ...);
void VerifyStringLength(int length);
int SkipWhitespaceAndEol();
int FindLastLineNumber(std::string& filename);
std::string ReadIdentifier();
long ReadInteger(std::string filename, long line);
};
#endif // ASM_FILE_H