Added variable symbols using .set

git-svn-id: svn://svn.cc65.org/cc65/trunk@3510 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-05-11 08:31:42 +00:00
parent f06dc5dfa3
commit 945bbe2b50
8 changed files with 182 additions and 60 deletions

View File

@@ -562,16 +562,41 @@ static void OneLine (void)
* is no colon, it's an assignment.
*/
if (Tok == TOK_EQ || Tok == TOK_ASSIGN) {
/* If it's an assign token, we have a label */
/* Determine the symbol flags from the assignment token */
unsigned Flags = (Tok == TOK_ASSIGN)? SF_LABEL : SF_NONE;
/* Skip the '=' */
NextTok ();
/* Define the symbol with the expression following the '=' */
SymDef (Sym, Expression(), ADDR_SIZE_DEFAULT, Flags);
/* Don't allow anything after a symbol definition */
ConsumeSep ();
return;
} else if (Tok == TOK_SET) {
ExprNode* Expr;
/* .SET defines variables (= redefinable symbols) */
NextTok ();
/* Read the assignment expression, which must be constant */
Expr = GenLiteralExpr (ConstExpression ());
/* Define the symbol with the constant expression following
* the '='
*/
SymDef (Sym, Expr, ADDR_SIZE_DEFAULT, SF_VAR);
/* Don't allow anything after a symbol definition */
ConsumeSep ();
return;
} else {
/* A label. Remember the current segment, so we can later
* determine the size of the data stored under the label.
*/