|
|
@ -113,12 +113,13 @@ namespace Compiler
|
|
|
|
if (mState==SetState)
|
|
|
|
if (mState==SetState)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string name2 = toLower (name);
|
|
|
|
std::string name2 = toLower (name);
|
|
|
|
|
|
|
|
mName = name2;
|
|
|
|
|
|
|
|
|
|
|
|
// local variable?
|
|
|
|
// local variable?
|
|
|
|
char type = mLocals.getType (name2);
|
|
|
|
char type = mLocals.getType (name2);
|
|
|
|
if (type!=' ')
|
|
|
|
if (type!=' ')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mName = name2;
|
|
|
|
mType = type;
|
|
|
|
mState = SetLocalVarState;
|
|
|
|
mState = SetLocalVarState;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -126,12 +127,27 @@ namespace Compiler
|
|
|
|
type = getContext().getGlobalType (name2);
|
|
|
|
type = getContext().getGlobalType (name2);
|
|
|
|
if (type!=' ')
|
|
|
|
if (type!=' ')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mName = name2;
|
|
|
|
|
|
|
|
mType = type;
|
|
|
|
mType = type;
|
|
|
|
mState = SetGlobalVarState;
|
|
|
|
mState = SetGlobalVarState;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mState = SetPotentialMemberVarState;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mState==SetMemberVarState)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mMemberName = toLower (name);
|
|
|
|
|
|
|
|
char type = getContext().getMemberType (mMemberName, mName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type!=' ')
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mState = SetMemberVarState2;
|
|
|
|
|
|
|
|
mType = type;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getErrorHandler().error ("unknown variable", loc);
|
|
|
|
getErrorHandler().error ("unknown variable", loc);
|
|
|
|
SkipParser skip (getErrorHandler(), getContext());
|
|
|
|
SkipParser skip (getErrorHandler(), getContext());
|
|
|
|
scanner.scan (skip);
|
|
|
|
scanner.scan (skip);
|
|
|
@ -338,6 +354,19 @@ namespace Compiler
|
|
|
|
mState = EndState;
|
|
|
|
mState = EndState;
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (mState==SetMemberVarState2 && keyword==Scanner::K_to)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mExprParser.reset();
|
|
|
|
|
|
|
|
scanner.scan (mExprParser);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<Interpreter::Type_Code> code;
|
|
|
|
|
|
|
|
char type = mExprParser.append (code);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Generator::assignToMember (mCode, mLiterals, mType, mMemberName, mName, code, type);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mState = EndState;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mAllowExpression)
|
|
|
|
if (mAllowExpression)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -392,6 +421,12 @@ namespace Compiler
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (code==Scanner::S_member && mState==SetPotentialMemberVarState)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mState = SetMemberVarState;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mAllowExpression && mState==BeginState &&
|
|
|
|
if (mAllowExpression && mState==BeginState &&
|
|
|
|
(code==Scanner::S_open || code==Scanner::S_minus))
|
|
|
|
(code==Scanner::S_open || code==Scanner::S_minus))
|
|
|
|
{
|
|
|
|
{
|
|
|
|