@@ -4652,7 +4652,8 @@ static void ProcessStatement(SemanticState *state, Statement *statement, const S
46524652 case STATEMENT_TYPE_MACRO :
46534653 case STATEMENT_TYPE_MACROS :
46544654 case STATEMENT_TYPE_EQU :
4655- case STATEMENT_TYPE_EQUS :
4655+ case STATEMENT_TYPE_EQUS_STRING :
4656+ case STATEMENT_TYPE_EQUS_IDENTIFIER :
46564657 case STATEMENT_TYPE_SUBSTR :
46574658 case STATEMENT_TYPE_SET :
46584659 if (StringView_Empty (label ))
@@ -4740,10 +4741,22 @@ static void ProcessStatement(SemanticState *state, Statement *statement, const S
47404741 break ;
47414742 }
47424743
4743- case STATEMENT_TYPE_EQUS :
4744+ case STATEMENT_TYPE_EQUS_STRING :
47444745 PushSubstitute (state , label , String_View (& statement -> shared .string ));
47454746 break ;
47464747
4748+ case STATEMENT_TYPE_EQUS_IDENTIFIER :
4749+ {
4750+ const Dictionary_Entry * const dictionary_entry = LookupSymbol (state , String_View (& statement -> shared .string ));
4751+
4752+ if (dictionary_entry == NULL || dictionary_entry -> type != SYMBOL_STRING_CONSTANT )
4753+ SemanticError (state , "String constant can only be defined as a string or another string constant." );
4754+ else
4755+ PushSubstitute (state , label , String_View (& dictionary_entry -> shared .string ));
4756+
4757+ break ;
4758+ }
4759+
47474760 case STATEMENT_TYPE_SUBSTR :
47484761 {
47494762 unsigned long start , end ;
@@ -5509,6 +5522,7 @@ static void SubstituteAndParseLine(SemanticState *state, const StringView* const
55095522 /* Because of the below hack, we have to filter-out directives that do not use expressions or operands,
55105523 to prevent them from accidentally being substituted. This is needed for the Natsumi Z80 macros. */
55115524 if (StringView_CompareCStrCaseInsensitive (directive , "binclude" )
5525+ || StringView_CompareCStrCaseInsensitive (directive , "equs" )
55125526 || StringView_CompareCStrCaseInsensitive (directive , "incbin" )
55135527 || StringView_CompareCStrCaseInsensitive (directive , "include" )
55145528 || StringView_CompareCStrCaseInsensitive (directive , "macro" )
0 commit comments