From 8b19de17b6371d4cb2afa647c39dca69209b24eb Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 16 Jun 2012 13:21:01 +0200 Subject: [PATCH] Iisue #181: enable member variable access from expressions in console --- components/compiler/lineparser.cpp | 17 ++++++++++++++++- components/compiler/lineparser.hpp | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index 834cd27b4..db21cce9b 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -18,7 +18,10 @@ namespace Compiler if (!mExplicit.empty()) { mExprParser.parseName (mExplicit, loc, scanner); - mExprParser.parseSpecial (Scanner::S_ref, loc, scanner); + if (mState==MemberState) + mExprParser.parseSpecial (Scanner::S_member, loc, scanner); + else + mExprParser.parseSpecial (Scanner::S_ref, loc, scanner); } scanner.scan (mExprParser); @@ -256,6 +259,7 @@ namespace Compiler { scanner.putbackKeyword (keyword, loc); parseExpression (scanner, loc); + mState = EndState; return true; } @@ -269,6 +273,7 @@ namespace Compiler { scanner.putbackKeyword (keyword, loc); parseExpression (scanner, loc); + mState = EndState; return true; } } @@ -342,6 +347,7 @@ namespace Compiler { scanner.putbackKeyword (keyword, loc); parseExpression (scanner, loc); + mState = EndState; return true; } } @@ -366,6 +372,14 @@ namespace Compiler return true; } + if (code==Scanner::S_member && mState==PotentialExplicitState) + { + mState = MemberState; + parseExpression (scanner, loc); + mState = EndState; + return true; + } + if (code==Scanner::S_newline && mState==MessageButtonState) { Generator::message (mCode, mLiterals, mName, mButtons); @@ -383,6 +397,7 @@ namespace Compiler { scanner.putbackSpecial (code, loc); parseExpression (scanner, loc); + mState = EndState; return true; } diff --git a/components/compiler/lineparser.hpp b/components/compiler/lineparser.hpp index 531b7762f..6f331b7bf 100644 --- a/components/compiler/lineparser.hpp +++ b/components/compiler/lineparser.hpp @@ -24,7 +24,7 @@ namespace Compiler SetState, SetLocalVarState, SetGlobalVarState, MessageState, MessageCommaState, MessageButtonState, MessageButtonCommaState, EndState, - PotentialExplicitState, ExplicitState + PotentialExplicitState, ExplicitState, MemberState }; Locals& mLocals;