TOK_FIRST_KEYWORD,
TOK_ABSOLUTE = TOK_FIRST_KEYWORD, /* ABSOLUTE keyword */
TOK_ADDRSIZE, /* ADDRSIZE keyword */
+ TOK_AUTO, /* AUTO keyword */
TOK_COUNT, /* COUNT keyword */
TOK_DEF, /* DEF keyword */
TOK_ENUM, /* ENUM keyword */
TOK_EQUATE, /* EQUATE keyword */
TOK_EXPORT, /* EXPORT keyword */
TOK_FILE, /* FILE keyword */
+ TOK_FUNC, /* FUNC keyword */
TOK_GLOBAL, /* GLOBAL keyword */
TOK_ID, /* ID keyword */
TOK_IMPORT, /* IMPORT keyword */
TOK_SIZE, /* SIZE keyword */
TOK_SPAN, /* SPAN keyword */
TOK_START, /* START keyword */
+ TOK_STATIC, /* STATIC keyword */
TOK_STRUCT, /* STRUCT keyword */
TOK_SYM, /* SYM keyword */
TOK_TYPE, /* TYPE keyword */
TOK_VALUE, /* VALUE keyword */
+ TOK_VAR, /* VAR keyword */
TOK_VERSION, /* VERSION keyword */
TOK_ZEROPAGE, /* ZEROPAGE keyword */
TOK_LAST_KEYWORD = TOK_ZEROPAGE,
} KeywordTable[] = {
{ "abs", TOK_ABSOLUTE },
{ "addrsize", TOK_ADDRSIZE },
+ { "auto", TOK_AUTO },
{ "count", TOK_COUNT },
{ "def", TOK_DEF },
{ "enum", TOK_ENUM },
{ "equ", TOK_EQUATE },
{ "exp", TOK_EXPORT },
{ "file", TOK_FILE },
+ { "func", TOK_FUNC },
{ "global", TOK_GLOBAL },
{ "id", TOK_ID },
{ "imp", TOK_IMPORT },
{ "size", TOK_SIZE },
{ "span", TOK_SPAN },
{ "start", TOK_START },
+ { "static", TOK_STATIC },
{ "struct", TOK_STRUCT },
{ "sym", TOK_SYM },
{ "type", TOK_TYPE },
{ "val", TOK_VALUE },
+ { "var", TOK_VAR },
{ "version", TOK_VERSION },
{ "zp", TOK_ZEROPAGE },
};
cc65_addr Start = 0;
cc65_addr Size = 0;
unsigned SegId = CC65_INV_ID;
+ StrBuf Type = STRBUF_INITIALIZER;
SpanInfo* S;
enum {
ibNone = 0x000,
ibSegId = 0x02,
ibSize = 0x04,
ibStart = 0x08,
+ ibType = 0x10,
ibRequired = ibId | ibSegId | ibSize | ibStart,
} InfoBits = ibNone;
/* Something we know? */
if (D->Tok != TOK_ID && D->Tok != TOK_SEGMENT &&
- D->Tok != TOK_SIZE && D->Tok != TOK_START) {
+ D->Tok != TOK_SIZE && D->Tok != TOK_START &&
+ D->Tok != TOK_TYPE) {
/* Try smart error recovery */
if (D->Tok == TOK_IDENT || TokenIsKeyword (D->Tok)) {
InfoBits |= ibStart;
break;
+ case TOK_TYPE:
+ if (!StrConstFollows (D)) {
+ goto ErrorExit;
+ }
+ SB_Copy (&Type, &D->SVal);
+ SB_Terminate (&Type);
+ InfoBits |= ibType;
+ NextToken (D);
+ break;
+
default:
/* NOTREACHED */
UnexpectedToken (D);
ErrorExit:
/* Entry point in case of errors */
+ SB_Done (&Type);
return;
}