XPlor/libs/dsl/Token.h
njohnson d7285b5bbe Enhance DSL interpreter with new built-in functions
Add support for:
- basename() function for extracting filenames from paths
- cstring() function for reading null-terminated strings
- ascii() function for reading fixed-length ASCII strings
- Enhanced type registry with additional primitive types
- Improved parser with better error handling

These additions enable more flexible XScript definitions for
parsing binary file formats.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 16:35:35 -05:00

63 lines
920 B
C

#ifndef TOKEN_H
#define TOKEN_H
#include <QString>
enum class TokenKind {
End,
Identifier,
Number,
String,
// punctuation
LBrace, RBrace,
LParen, RParen,
LBracket, RBracket,
Semicolon, Comma,
Assign,
Pipe,
DotDot,
// operators
Plus, Minus, Star, Slash, Percent,
LShift, RShift, Bar,
Amp, Caret,
Bang,
EqEq, NotEq,
Lt, Lte, Gt, Gte,
AndAnd, OrOr,
// keywords
KwType,
KwByteOrder,
KwLE, KwBE,
KwSkip,
KwIf, KwElse,
KwWhile,
KwAlign,
KwSeek,
KwRepeat,
KwFor,
KwIn,
KwEOF,
KwCriteria,
KwRequire,
KwBool,
KwBreak,
// scalar keywords
KwU8, KwU16, KwU32, KwU64,
KwI8, KwI16, KwI32, KwI64,
KwF32, KwF64,
};
struct Token {
TokenKind kind = TokenKind::End;
QString text;
qint64 number = 0;
int line = 1;
int col = 1;
};
#endif // TOKEN_H