From: uz Date: Tue, 17 Jul 2012 18:28:07 +0000 (+0000) Subject: Permit the .string builtin function to work with scoped identifiers. X-Git-Tag: V2.14~285 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b4214634b286f215190e9f770c7609bf2f7d3976;p=cc65 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 --- 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 ();