mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
DIRECTOR: LINGO: Implement non-fatal Ligo errors
And use it in value.lingo test where syntax errors are expected
This commit is contained in:
parent
fadf91a5af
commit
a4eb40bf5a
@ -317,6 +317,7 @@ public:
|
||||
Common::Path _traceLogFile;
|
||||
|
||||
uint16 _framesRan = 0; // used by kDebugFewFramesOnly
|
||||
bool _noFatalLingoError = false;
|
||||
};
|
||||
|
||||
// An extension of MacPlotData for interfacing with inks and patterns without
|
||||
|
@ -231,6 +231,7 @@ static BuiltinProto builtins[] = {
|
||||
// ScummVM Asserts: Used for testing ScummVM's Lingo implementation
|
||||
{ "scummvmAssert", LB::b_scummvmassert,1, 2, 200, HBLTIN },
|
||||
{ "scummvmAssertEqual", LB::b_scummvmassertequal,2,3,200,HBLTIN },
|
||||
{ "scummvmNoFatalError", LB::b_scummvmNoFatalError,1,1,200,HBLTIN },
|
||||
|
||||
// XCMD/XFCN (HyperCard), normally exposed
|
||||
{ "GetVolumes", LB::b_getVolumes, 0, 0, 400, FBLTIN },
|
||||
@ -3489,6 +3490,14 @@ void LB::b_scummvmassertequal(int nargs) {
|
||||
}
|
||||
}
|
||||
|
||||
void LB::b_scummvmNoFatalError(int nargs) {
|
||||
Datum flag = g_lingo->pop();
|
||||
|
||||
g_director->_noFatalLingoError = (flag.asInt() != 0);
|
||||
|
||||
warning("scummvmNoFatalEror is set to %d", g_director->_noFatalLingoError);
|
||||
}
|
||||
|
||||
void LB::b_getVolumes(int nargs) {
|
||||
// Right now, only "Journeyman Project 2: Buried in Time" is known to check
|
||||
// for its volume name.
|
||||
|
@ -196,6 +196,7 @@ void b_numberofwords(int nargs);
|
||||
|
||||
void b_scummvmassert(int nargs);
|
||||
void b_scummvmassertequal(int nargs);
|
||||
void b_scummvmNoFatalError(int nargs);
|
||||
|
||||
// XCMD/XFCN (HyperCard), normally exposed
|
||||
void b_getVolumes(int nargs);
|
||||
|
@ -99,8 +99,8 @@ using namespace Director;
|
||||
static void yyerror(const char *s) {
|
||||
LingoCompiler *compiler = g_lingo->_compiler;
|
||||
compiler->_hadError = true;
|
||||
warning("###################### LINGO: %s at line %d col %d in %s id: %d",
|
||||
s, compiler->_linenumber, compiler->_colnumber, scriptType2str(compiler->_assemblyContext->_scriptType),
|
||||
warning("%s LINGO: %s at line %d col %d in %s id: %d",
|
||||
(g_director->_noFatalLingoError ? "####" : "######################"), s, compiler->_linenumber, compiler->_colnumber, scriptType2str(compiler->_assemblyContext->_scriptType),
|
||||
compiler->_assemblyContext->_id);
|
||||
if (compiler->_lines[2] != compiler->_lines[1])
|
||||
warning("# %3d: %s", compiler->_linenumber - 2, Common::String(compiler->_lines[2], compiler->_lines[1] - 1).c_str());
|
||||
|
@ -81,8 +81,8 @@ using namespace Director;
|
||||
static void yyerror(const char *s) {
|
||||
LingoCompiler *compiler = g_lingo->_compiler;
|
||||
compiler->_hadError = true;
|
||||
warning("###################### LINGO: %s at line %d col %d in %s id: %d",
|
||||
s, compiler->_linenumber, compiler->_colnumber, scriptType2str(compiler->_assemblyContext->_scriptType),
|
||||
warning("%s LINGO: %s at line %d col %d in %s id: %d",
|
||||
(g_director->_noFatalLingoError ? "####" : "######################"), s, compiler->_linenumber, compiler->_colnumber, scriptType2str(compiler->_assemblyContext->_scriptType),
|
||||
compiler->_assemblyContext->_id);
|
||||
if (compiler->_lines[2] != compiler->_lines[1])
|
||||
warning("# %3d: %s", compiler->_linenumber - 2, Common::String(compiler->_lines[2], compiler->_lines[1] - 1).c_str());
|
||||
|
@ -13,9 +13,13 @@ scummvmAssertEqual(9, value("3*3"))
|
||||
|
||||
-- the kicker; you are allowed to have garbage on the end!!!
|
||||
-- if it hits a token it doesn't understand, the parser should try again but stopping just before that token.
|
||||
scummvmNoFatalError(true)
|
||||
|
||||
scummvmAssertEqual(9, value("3*3[34]"))
|
||||
scummvmAssertEqual([1, 2, 3], value("[1, 2, 3],4]"))
|
||||
|
||||
scummvmNoFatalError(false)
|
||||
|
||||
-- if there's no valid expression at all, return void
|
||||
set test = value("#")
|
||||
scummvmAssert(voidP(test))
|
||||
|
Loading…
x
Reference in New Issue
Block a user