mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix 1 s/r and 1 r/r conflict
Implements the fix suggested [here](https://github.com/rednex/rgbds/issues/44#issuecomment-69360499), which performed better than expected! I'm not \*too\* fond of this but this seems like the right way
This commit is contained in:
@@ -498,10 +498,12 @@ static void strsubUTF8(char *dest, const char *src, uint32_t pos, uint32_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
%type <sVal> relocconst
|
%type <sVal> relocconst
|
||||||
|
%type <sVal> relocconst_no_str
|
||||||
%type <nConstValue> const
|
%type <nConstValue> const
|
||||||
%type <nConstValue> uconst
|
%type <nConstValue> uconst
|
||||||
%type <nConstValue> const_3bit
|
%type <nConstValue> const_3bit
|
||||||
%type <sVal> const_8bit
|
%type <sVal> const_8bit
|
||||||
|
%type <sVal> const_8bit_no_str
|
||||||
%type <sVal> const_16bit
|
%type <sVal> const_16bit
|
||||||
%type <nConstValue> sectiontype
|
%type <nConstValue> sectiontype
|
||||||
|
|
||||||
@@ -1146,7 +1148,7 @@ constlist_8bit_entry : /* empty */
|
|||||||
out_Skip(1);
|
out_Skip(1);
|
||||||
nListCountEmpty++;
|
nListCountEmpty++;
|
||||||
}
|
}
|
||||||
| const_8bit
|
| const_8bit_no_str
|
||||||
{
|
{
|
||||||
out_RelByte(&$1);
|
out_RelByte(&$1);
|
||||||
}
|
}
|
||||||
@@ -1198,6 +1200,14 @@ const_8bit : relocconst
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
const_8bit_no_str : relocconst_no_str
|
||||||
|
{
|
||||||
|
if( (rpn_isKnown(&$1)) && (($1.nVal < -128) || ($1.nVal > 255)) )
|
||||||
|
warning(WARNING_TRUNCATION, "Expression must be 8-bit");
|
||||||
|
$$ = $1;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
const_16bit : relocconst
|
const_16bit : relocconst
|
||||||
{
|
{
|
||||||
if ((rpn_isKnown(&$1)) && (($1.nVal < -32768) || ($1.nVal > 65535)))
|
if ((rpn_isKnown(&$1)) && (($1.nVal < -32768) || ($1.nVal > 65535)))
|
||||||
@@ -1207,14 +1217,7 @@ const_16bit : relocconst
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
relocconst : T_ID
|
relocconst : relocconst_no_str
|
||||||
{
|
|
||||||
rpn_Symbol(&$$, $1);
|
|
||||||
}
|
|
||||||
| T_NUMBER
|
|
||||||
{
|
|
||||||
rpn_Number(&$$, $1);
|
|
||||||
}
|
|
||||||
| string
|
| string
|
||||||
{
|
{
|
||||||
char *s = $1;
|
char *s = $1;
|
||||||
@@ -1224,6 +1227,16 @@ relocconst : T_ID
|
|||||||
free(s);
|
free(s);
|
||||||
rpn_Number(&$$, r);
|
rpn_Number(&$$, r);
|
||||||
}
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
relocconst_no_str : T_ID
|
||||||
|
{
|
||||||
|
rpn_Symbol(&$$, $1);
|
||||||
|
}
|
||||||
|
| T_NUMBER
|
||||||
|
{
|
||||||
|
rpn_Number(&$$, $1);
|
||||||
|
}
|
||||||
| T_OP_LOGICNOT relocconst %prec NEG { rpn_LOGNOT(&$$, &$2); }
|
| T_OP_LOGICNOT relocconst %prec NEG { rpn_LOGNOT(&$$, &$2); }
|
||||||
| relocconst T_OP_LOGICOR relocconst { rpn_BinaryOp(RPN_LOGOR, &$$, &$1, &$3); }
|
| relocconst T_OP_LOGICOR relocconst { rpn_BinaryOp(RPN_LOGOR, &$$, &$1, &$3); }
|
||||||
| relocconst T_OP_LOGICAND relocconst { rpn_BinaryOp(RPN_LOGAND, &$$, &$1, &$3); }
|
| relocconst T_OP_LOGICAND relocconst { rpn_BinaryOp(RPN_LOGAND, &$$, &$1, &$3); }
|
||||||
|
|||||||
Reference in New Issue
Block a user