diff --git a/doomsday/sdk/libcore/src/scriptsys/operatorexpression.cpp b/doomsday/sdk/libcore/src/scriptsys/operatorexpression.cpp index f04cdc2b89..78fb1f3383 100644 --- a/doomsday/sdk/libcore/src/scriptsys/operatorexpression.cpp +++ b/doomsday/sdk/libcore/src/scriptsys/operatorexpression.cpp @@ -495,7 +495,7 @@ Value *OperatorExpression::performSlice(Value &leftValue, Value &rightValue) con end = -1; } - begin = clamp(0, begin, leftSize - 1); + begin = clamp(0, begin, leftSize); end = clamp(-1, end, leftSize); for (dint i = begin; (end >= begin && i < end) || (begin > end && i > end); i += step) diff --git a/doomsday/sdk/libcore/src/scriptsys/parser.cpp b/doomsday/sdk/libcore/src/scriptsys/parser.cpp index 13d7f8669a..0b0e762091 100644 --- a/doomsday/sdk/libcore/src/scriptsys/parser.cpp +++ b/doomsday/sdk/libcore/src/scriptsys/parser.cpp @@ -431,7 +431,8 @@ void Parser::parseTryCatchSequence(Compound &compound) } CatchStatement *finalCatch = nullptr; bool expectEnd = false; - while (_statementRange.firstToken().equals(ScriptLex::CATCH)) + while (!_statementRange.isEmpty() && + _statementRange.firstToken().equals(ScriptLex::CATCH)) { dint colon = _statementRange.find(Token::COLON); expectEnd = (colon < 0); diff --git a/doomsday/tests/test_script/kitchen_sink.ds b/doomsday/tests/test_script/kitchen_sink.ds index 4532b7329b..8ce5d1f3f7 100644 --- a/doomsday/tests/test_script/kitchen_sink.ds +++ b/doomsday/tests/test_script/kitchen_sink.ds @@ -28,12 +28,13 @@ sections.begin('BASIC EXPRESSIONS') sections.subsection('Basic types (number, text, array, dictionary, time).') print 5, 5.5, -3.141592657 print 0x100, 0X123 -print 'Using underscores for readability:', 0x0012_3456 +print 'Using underscores for readability: %x' % 0x0012_3456 print "Hello", 'World' print """I can span newlines.""" print [1, 2, 3] print [1, [2, 3], 4] +print {'a': 10, 'b': Pi} print {'a': 'b', 1: ['b', {5:6, 6:7}], ['array', 'as', 'key']: 'oh my'} print 'The time is now:', Time() @@ -110,6 +111,7 @@ print 'a =', a path = '/some/path/' print 'path =', path print 'path =', path /= 'filename.ext' +print 'path =', path sections.subsection('Operators: []') transports = ['planes', 'trains', 'automobiles', 'bicycles']