Skip to content
Permalink
Browse files

DIRECTOR: LINGO: Changed semantics of 'me' keyword. Now it serves as …

…a defined method
  • Loading branch information
sev- committed Jan 14, 2020
1 parent a798549 commit 8fedec7cdaf57ae64fe6482d70171698052a8dde
@@ -221,7 +221,7 @@ static struct BuiltinProto {
// References
{ "cast", LB::b_cast, 1, 1, false, 4, RBLTIN }, // D4 f
{ "field", LB::b_field, 1, 1, false, 3, RBLTIN }, // D3 f
{ "me", LB::b_me, -1,0, false, 3, BLTIN }, // D3
// { "me", LB::b_me, -1,0, false, 3, FBLTIN }, // D3 // works as normal ID, see c_varpush
{ "script", LB::b_script, 1, 1, false, 4, RBLTIN }, // D4 f
{ "window", LB::b_window, 1, 1, false, 4, RBLTIN }, // D4 f
// Chunk operations
@@ -1751,12 +1751,6 @@ void LB::b_field(int nargs) {
g_lingo->push(d);
}

void LB::b_me(int nargs) {
g_lingo->printSTUBWithArglist("me", nargs);

g_lingo->dropStack(nargs);
}

void LB::b_script(int nargs) {
Datum d = g_lingo->pop();

@@ -196,7 +196,6 @@ namespace LB {

void b_cast(int nargs);
void b_field(int nargs);
void b_me(int nargs);
void b_script(int nargs);

void b_numberofchars(int nargs);
@@ -320,6 +320,10 @@ void LC::c_varpush() {
return;
}

if (name.equalsIgnoreCase("me")) {
warning("c_varpush: ME");
}

if (g_lingo->getHandler(name) != NULL) {
d.type = HANDLER;
d.u.s = new Common::String(name);

Large diffs are not rendered by default.

@@ -125,10 +125,9 @@
tTELL = 341,
tPROPERTY = 342,
tON = 343,
tME = 344,
tENDIF = 345,
tENDREPEAT = 346,
tENDTELL = 347
tENDIF = 344,
tENDREPEAT = 345,
tENDTELL = 346
};
#endif
/* Tokens. */
@@ -218,10 +217,9 @@
#define tTELL 341
#define tPROPERTY 342
#define tON 343
#define tME 344
#define tENDIF 345
#define tENDREPEAT 346
#define tENDTELL 347
#define tENDIF 344
#define tENDREPEAT 345
#define tENDTELL 346



@@ -244,7 +242,7 @@ typedef union YYSTYPE
} objectfield;
}
/* Line 1529 of yacc.c. */
#line 248 "engines/director/lingo/lingo-gr.hpp"
#line 246 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -113,7 +113,7 @@ void checkEnd(Common::String *token, const char *expect, bool required) {
%token tGE tLE tEQ tNEQ tAND tOR tNOT tMOD
%token tAFTER tBEFORE tCONCAT tCONTAINS tSTARTS tCHAR tITEM tLINE tWORD
%token tSPRITE tINTERSECTS tWITHIN tTELL tPROPERTY
%token tON tME tENDIF tENDREPEAT tENDTELL
%token tON tENDIF tENDREPEAT tENDTELL

%type<code> asgn begin elseif end expr if when repeatwhile
%type<code> repeatwith stmtlist tell reference simpleexpr list valuelist
@@ -448,9 +448,6 @@ expr: simpleexpr { $$ = $1; }
| tLINE expr tTO expr tOF expr { g_lingo->code1(LC::c_lineToOf); }
| tWORD expr tOF expr { g_lingo->code1(LC::c_wordOf); }
| tWORD expr tTO expr tOF expr { g_lingo->code1(LC::c_wordToOf); }
| tME '(' ID ')' { g_lingo->codeMe($3, 0); }
| tME '(' ID ',' arglist ')' { g_lingo->codeMe($3, $5); }
| tME { g_lingo->codeMe(nullptr, 0); }
;

reference: RBLTINONEARG simpleexpr {
@@ -1604,12 +1604,6 @@ YY_RULE_SETUP
if (g_lingo->_twoWordBuiltins.contains(yytext))
return TWOWORDBUILTIN;

// Special treatment of 'me'. First parameter is method name
if (!g_lingo->_currentFactory.empty()) {
if (yylval.s->equalsIgnoreCase("me"))
return tME;
}

if (g_lingo->_builtins.contains(yytext)) {
int type = g_lingo->_builtins[yytext]->type;
if ((type == BLTIN || type == FBLTIN || type == RBLTIN) && g_lingo->_builtins[yytext]->parens == false) {
@@ -1642,41 +1636,41 @@ YY_RULE_SETUP
YY_BREAK
case 69:
YY_RULE_SETUP
#line 376 "engines/director/lingo/lingo-lex.l"
#line 370 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 70:
YY_RULE_SETUP
#line 377 "engines/director/lingo/lingo-lex.l"
#line 371 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 71:
YY_RULE_SETUP
#line 378 "engines/director/lingo/lingo-lex.l"
#line 372 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
case 72:
/* rule 72 can match eol */
YY_RULE_SETUP
#line 379 "engines/director/lingo/lingo-lex.l"
#line 373 "engines/director/lingo/lingo-lex.l"
{ count(); return '\n'; }
YY_BREAK
case 73:
YY_RULE_SETUP
#line 380 "engines/director/lingo/lingo-lex.l"
#line 374 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 74:
YY_RULE_SETUP
#line 381 "engines/director/lingo/lingo-lex.l"
#line 375 "engines/director/lingo/lingo-lex.l"
{ count(); }
YY_BREAK
case 75:
YY_RULE_SETUP
#line 383 "engines/director/lingo/lingo-lex.l"
#line 377 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
#line 1680 "engines/director/lingo/lingo-lex.cpp"
#line 1674 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();

@@ -2636,7 +2630,7 @@ void yyfree (void * ptr )

#define YYTABLES_NAME "yytables"

#line 383 "engines/director/lingo/lingo-lex.l"
#line 377 "engines/director/lingo/lingo-lex.l"



@@ -338,12 +338,6 @@ whitespace [\t ]
if (g_lingo->_twoWordBuiltins.contains(yytext))
return TWOWORDBUILTIN;
// Special treatment of 'me'. First parameter is method name
if (!g_lingo->_currentFactory.empty()) {
if (yylval.s->equalsIgnoreCase("me"))
return tME;
}
if (g_lingo->_builtins.contains(yytext)) {
int type = g_lingo->_builtins[yytext]->type;
if ((type == BLTIN || type == FBLTIN || type == RBLTIN) && g_lingo->_builtins[yytext]->parens == false) {

0 comments on commit 8fedec7

Please sign in to comment.
You can’t perform that action at this time.