return;\r
}\r
\r
+ char[] whitespace = { ' ', '\t' };\r
+ if (arg.IndexOfAny (whitespace) != -1){\r
+ Report.Error(1025, Location, "Single-line comment or end-of-line expected");\r
+ return;\r
+ }\r
+\r
+ foreach (char c in arg){\r
+ if (!Char.IsLetter (c) && (c != '_')){\r
+ Report.Error(1001, Location, "Identifier expected");\r
+ return;\r
+ }\r
+ }\r
+\r
if (is_define){\r
if (defines == null)\r
defines = new Hashtable ();\r
\r
get_cmd_arg (out cmd, out arg);\r
\r
+ // Eat any trailing whitespaces and single-line comments\r
+ if (arg.IndexOf ("//") != -1)\r
+ arg = arg.Substring (0, arg.IndexOf ("//"));\r
+ arg = arg.TrimEnd (' ', '\t');\r
+\r
//\r
// The first group of pre-processing instructions is always processed\r
//\r
any_token_seen |= tokens_seen;\r
tokens_seen = false;\r
if (c == -1)\r
- Report.Error (1027, Location, "#endif expected");\r
+ Report.Error (1027, Location, "#endif/#endregion expected");\r
continue;\r
}\r
\r
return Token.ERROR;\r
}\r
\r
- if (ifstack != null && ifstack.Count > 1)\r
- Report.Error (1027, Location, "#endif expected");\r
+ if (ifstack != null && ifstack.Count >= 1)\r
+ Report.Error (1027, Location, "#endif/#endregion expected");\r
+\r
return Token.EOF;\r
}\r
}\r