mirror of
https://github.com/cc65/cc65.git
synced 2025-02-18 15:30:30 +00:00
Fixed a bug in FuncStrAt. New shortcut function GenLiteral0().
git-svn-id: svn://svn.cc65.org/cc65/trunk@3605 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
98f4a339ba
commit
476e3f9acc
@ -59,7 +59,7 @@ void DoEnum (void)
|
|||||||
{
|
{
|
||||||
/* Start at zero */
|
/* Start at zero */
|
||||||
long Offs = 0;
|
long Offs = 0;
|
||||||
ExprNode* BaseExpr = GenLiteralExpr (0);
|
ExprNode* BaseExpr = GenLiteral0 ();
|
||||||
|
|
||||||
/* Check for a name */
|
/* Check for a name */
|
||||||
int Anon = (Tok != TOK_IDENT);
|
int Anon = (Tok != TOK_IDENT);
|
||||||
|
@ -443,7 +443,7 @@ static ExprNode* DoMatch (enum TC EqualityLevel)
|
|||||||
/* We may not end-of-line of end-of-file here */
|
/* We may not end-of-line of end-of-file here */
|
||||||
if (TokIsSep (Tok)) {
|
if (TokIsSep (Tok)) {
|
||||||
Error ("Unexpected end of line");
|
Error ("Unexpected end of line");
|
||||||
return GenLiteralExpr (0);
|
return GenLiteral0 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a node with this token */
|
/* Get a node with this token */
|
||||||
@ -481,7 +481,7 @@ static ExprNode* DoMatch (enum TC EqualityLevel)
|
|||||||
/* We may not end-of-line of end-of-file here */
|
/* We may not end-of-line of end-of-file here */
|
||||||
if (TokIsSep (Tok)) {
|
if (TokIsSep (Tok)) {
|
||||||
Error ("Unexpected end of line");
|
Error ("Unexpected end of line");
|
||||||
return GenLiteralExpr (0);
|
return GenLiteral0 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare the tokens if the result is not already known */
|
/* Compare the tokens if the result is not already known */
|
||||||
@ -587,7 +587,7 @@ static ExprNode* FuncSizeOf (void)
|
|||||||
if (ParentScope == 0) {
|
if (ParentScope == 0) {
|
||||||
/* No such scope */
|
/* No such scope */
|
||||||
DoneStrBuf (&ScopeName);
|
DoneStrBuf (&ScopeName);
|
||||||
return GenLiteralExpr (0);
|
return GenLiteral0 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If ScopeName is empty, no explicit scope was specified. We have to
|
/* If ScopeName is empty, no explicit scope was specified. We have to
|
||||||
@ -651,8 +651,7 @@ static ExprNode* FuncStrAt (void)
|
|||||||
if (Tok != TOK_STRCON) {
|
if (Tok != TOK_STRCON) {
|
||||||
Error ("String constant expected");
|
Error ("String constant expected");
|
||||||
NextTok ();
|
NextTok ();
|
||||||
return 0;
|
return GenLiteral0 ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remember the string and skip it */
|
/* Remember the string and skip it */
|
||||||
@ -668,7 +667,7 @@ static ExprNode* FuncStrAt (void)
|
|||||||
/* Must be a valid index */
|
/* Must be a valid index */
|
||||||
if (Index >= (long) strlen (Str)) {
|
if (Index >= (long) strlen (Str)) {
|
||||||
Error ("Range error");
|
Error ("Range error");
|
||||||
return GenLiteralExpr (0);
|
return GenLiteral0 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the char, handle as unsigned. Be sure to translate it into
|
/* Get the char, handle as unsigned. Be sure to translate it into
|
||||||
@ -768,7 +767,7 @@ static ExprNode* Function (ExprNode* (*F) (void))
|
|||||||
if (Tok != TOK_LPAREN) {
|
if (Tok != TOK_LPAREN) {
|
||||||
Error ("'(' expected");
|
Error ("'(' expected");
|
||||||
SkipUntilSep ();
|
SkipUntilSep ();
|
||||||
return GenLiteralExpr (0);
|
return GenLiteral0 ();
|
||||||
}
|
}
|
||||||
NextTok ();
|
NextTok ();
|
||||||
|
|
||||||
@ -953,7 +952,7 @@ static ExprNode* Factor (void)
|
|||||||
/* A character constant */
|
/* A character constant */
|
||||||
N = GenLiteralExpr (TgtTranslateChar (SVal[0]));
|
N = GenLiteralExpr (TgtTranslateChar (SVal[0]));
|
||||||
} else {
|
} else {
|
||||||
N = GenLiteralExpr (0); /* Dummy */
|
N = GenLiteral0 (); /* Dummy */
|
||||||
Error ("Syntax error");
|
Error ("Syntax error");
|
||||||
}
|
}
|
||||||
NextTok ();
|
NextTok ();
|
||||||
@ -1429,6 +1428,14 @@ ExprNode* GenLiteralExpr (long Val)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ExprNode* GenLiteral0 (void)
|
||||||
|
/* Return an expression tree that encodes the the number zero */
|
||||||
|
{
|
||||||
|
return GenLiteralExpr (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExprNode* GenSymExpr (SymEntry* Sym)
|
ExprNode* GenSymExpr (SymEntry* Sym)
|
||||||
/* Return an expression node that encodes the given symbol */
|
/* Return an expression node that encodes the given symbol */
|
||||||
{
|
{
|
||||||
|
@ -79,6 +79,9 @@ ExprNode* SimplifyExpr (ExprNode* Expr, const struct ExprDesc* D);
|
|||||||
ExprNode* GenLiteralExpr (long Val);
|
ExprNode* GenLiteralExpr (long Val);
|
||||||
/* Return an expression tree that encodes the given literal value */
|
/* Return an expression tree that encodes the given literal value */
|
||||||
|
|
||||||
|
ExprNode* GenLiteral0 (void);
|
||||||
|
/* Return an expression tree that encodes the the number zero */
|
||||||
|
|
||||||
ExprNode* GenSymExpr (struct SymEntry* Sym);
|
ExprNode* GenSymExpr (struct SymEntry* Sym);
|
||||||
/* Return an expression node that encodes the given symbol */
|
/* Return an expression node that encodes the given symbol */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user