From 2d78239d238109e71981d5d848a764fc897c316e Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Fri, 28 Apr 2017 23:04:42 +0200 Subject: [PATCH] print returns the same type as the argument. --- lslopt/lslparse.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index b3a9d97..823a346 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -885,7 +885,11 @@ class parser(object): raise EParseTypeMismatch(self) if expr['t'] is None else EParseUndefined(self) self.expect(')') self.NextToken() - return {'nt':'PRINT', 't':None, 'ch':[expr]} + # Syntactically, print returns the same type as the expression. + # However, compilation in Mono throws an exception, and even in + # LSO, it throws a bounds check error when the result is a string + # or key or list and the returned value is used. + return {'nt':'PRINT', 't':expr['t'], 'ch':[expr]} if tok0 != 'IDENT': if tok0 == 'EOF':