Split the for loop in different states to produce a complete For loop node in the...
[mono.git] / mcs / mcs / cs-tokenizer.cs
index 22e0722f1f487eb4b2327bdb691b22306792726b..e61ea864c3b4eaa04419dac0cc704c4f1eeb131f 100644 (file)
@@ -139,6 +139,11 @@ namespace Mono.CSharp
                                pos = 0;
                        }
 
+                       public override string ToString ()
+                       {
+                               return string.Format ("Token '{0}' at {1},{2}", Value, row, column);
+                       }
+                       
                        public Location Location {
                                get { return new Location (row, column); }
                        }
@@ -973,6 +978,7 @@ namespace Mono.CSharp
                                                case Token.UNCHECKED:
                                                case Token.UNSAFE:
                                                case Token.DEFAULT:
+                                               case Token.AWAIT:
 
                                                //
                                                // These can be part of a member access
@@ -1264,10 +1270,24 @@ namespace Mono.CSharp
                                        int ntoken;
                                        int interrs = 1;
                                        int colons = 0;
+                                       int braces = 0;
                                        //
                                        // All shorcuts failed, do it hard way
                                        //
                                        while ((ntoken = xtoken ()) != Token.EOF) {
+                                               if (ntoken == Token.OPEN_BRACE) {
+                                                       ++braces;
+                                                       continue;
+                                               }
+
+                                               if (ntoken == Token.CLOSE_BRACE) {
+                                                       --braces;
+                                                       continue;
+                                               }
+
+                                               if (braces != 0)
+                                                       continue;
+
                                                if (ntoken == Token.SEMICOLON)
                                                        break;