Browse Source

Initial fix to a false sysntax error detected by the compiler.

mingodad 13 years ago
parent
commit
b5a916d4d6
1 changed files with 12 additions and 2 deletions
  1. 12 2
      squirrel/sqcompiler.cpp

+ 12 - 2
squirrel/sqcompiler.cpp

@@ -167,7 +167,7 @@ public:
 	{
 		if(_token == _SC(';')) { Lex(); return; }
 		if(!IsEndOfStatement()) {
-			Error(_SC("end of statement expected (; or lf)"));
+			Error(_SC("end of statement expected (; or lf) found (%d)"), _token);
 		}
 	}
 	void MoveIfCurrentTargetIsLocal() {
@@ -1127,9 +1127,19 @@ public:
 		SQInteger jnepos = _fs->GetCurrentPos();
 		BEGIN_SCOPE();
 		
+        //there is a situation where the if statement has a statement enclosed by {}
+        //and after the closing "}" there is no newline or semicolom
+        //it's a valid construction but the compiler was complaining about it
+        //for now added "&& _token != TK_IDENTIFIER" to the check after "Statement()" call
+/*
+local color = "blue";
+if(color == "yellow"){
+	print(color);
+} print("Waht color is it ?");
+*/
 		Statement();
 		//
-		if(_token != _SC('}') && _token != TK_ELSE) OptionalSemicolon();
+		if(_token != _SC('}') && _token != TK_ELSE && _token != TK_IDENTIFIER) OptionalSemicolon();
 		
 		END_SCOPE();
 		SQInteger endifblock = _fs->GetCurrentPos();