From b4214634b286f215190e9f770c7609bf2f7d3976 Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 17 Jul 2012 18:28:07 +0000 Subject: [PATCH] Permit the .string builtin function to work with scoped identifiers. git-svn-id: svn://svn.cc65.org/cc65/trunk@5786 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/nexttok.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ca65/nexttok.c b/src/ca65/nexttok.c index dab0697f9..3761ebb67 100644 --- a/src/ca65/nexttok.c +++ b/src/ca65/nexttok.c @@ -629,10 +629,27 @@ static void FuncString (void) ConsumeLParen (); /* Accept identifiers or numeric expressions */ - if (CurTok.Tok == TOK_IDENT || CurTok.Tok == TOK_LOCAL_IDENT) { + if (CurTok.Tok == TOK_LOCAL_IDENT) { /* Save the identifier, then skip it */ SB_Copy (&Buf, &CurTok.SVal); NextTok (); + } else if (CurTok.Tok == TOK_NAMESPACE || CurTok.Tok == TOK_IDENT) { + + /* Parse a fully qualified symbol name. We cannot use + * ParseScopedSymName here since the name may be invalid. + */ + int NameSpace; + do { + NameSpace = (CurTok.Tok == TOK_NAMESPACE); + if (NameSpace) { + SB_AppendStr (&Buf, "::"); + } else { + SB_Append (&Buf, &CurTok.SVal); + } + NextTok (); + } while ((NameSpace != 0 && CurTok.Tok == TOK_IDENT) || + (NameSpace == 0 && CurTok.Tok == TOK_NAMESPACE)); + } else { /* Numeric expression */ long Val = ConstExpression (); -- 2.39.5