public const int EvalCompilationUnitParserCharacter = 0x100001;
public const int EvalUsingDeclarationsParserCharacter = 0x100002;
public const int DocumentationXref = 0x100003;
+
+ const int UnicodeLS = 0x2028;
+ const int UnicodePS = 0x2029;
//
// XML documentation buffer. The save point is used to divide
x = '\n';
advance_line ();
- } else if (x == '\n') {
+ } else if (x == '\n' || x == UnicodeLS || x == UnicodePS) {
advance_line ();
} else {
col++;
throw new InternalErrorException (string.Format ("Secondary putback [{0}] putting back [{1}] is not allowed", (char)putback_char, (char) c), Location);
}
- if (c == '\n' || col == 0) {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS || col == 0) {
// It won't happen though.
line--;
ref_line--;
int has_identifier_argument = (int)(cmd & PreprocessorDirective.RequiresArgument);
int pos = 0;
- while (c != -1 && c != '\n') {
+ while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) {
if (c == '\\' && has_identifier_argument >= 0) {
if (has_identifier_argument != 0) {
has_identifier_argument = 1;
// Eat single-line comments
//
get_char ();
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
-
+ ReadToEndOfLine ();
break;
}
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
-
+ ReadToEndOfLine ();
return false;
}
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
-
+ ReadToEndOfLine ();
return new_line != 0;
}
c = 0;
}
- if (c != '\n' && c != '/' && c != '"') {
+ if (c != '\n' && c != '/' && c != '"' && c != UnicodeLS && c != UnicodePS) {
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
+ ReadToEndOfLine ();
Report.Error (1578, loc, "Filename, single-line comment or end-of-line expected");
return true;
}
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
+
} else if (c == '/') {
ReadSingleLineComment ();
} else {
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
+ ReadToEndOfLine ();
Error_EndLineExpected ();
return true;
string TokenizeFileName (ref int c)
{
var string_builder = new StringBuilder ();
- while (c != -1 && c != '\n') {
+ while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) {
c = get_char ();
if (c == '"') {
c = get_char ();
Report.Warning (1692, 1, Location, "Invalid number");
// Read everything till the end of the line or file
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
+ ReadToEndOfLine ();
}
}
return number;
}
+ void ReadToEndOfLine ()
+ {
+ int c;
+ do {
+ c = get_char ();
+ } while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS);
+ }
+
void ReadSingleLineComment ()
{
if (peek_char () != '/')
Report.Warning (1696, 1, Location, "Single-line comment or end-of-line expected");
// Read everything till the end of the line or file
- int c;
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
+ ReadToEndOfLine ();
}
/// <summary>
var loc = Location;
- if (c == '\n' || c == '/') {
+ if (c == '\n' || c == '/' || c == UnicodeLS || c == UnicodePS) {
if (c == '/')
ReadSingleLineComment ();
Report.RegisterWarningRegion (loc).WarningEnable (loc, code, context);
}
}
- } while (code >= 0 && c != '\n' && c != -1);
+ } while (code >= 0 && c != '\n' && c != -1 && c != UnicodeLS && c != UnicodePS);
}
return;
Report.Warning (1634, 1, Location, "Expected disable or restore");
// Eat any remaining characters on the line
- while (c != '\n' && c != -1)
- c = get_char ();
+ ReadToEndOfLine ();
return;
}
return Token.LITERAL;
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
if (!quoted) {
Report.Error (1010, Location, "Newline in constant");
case '\v':
case '\r':
case '\n':
+ case UnicodeLS:
+ case UnicodePS:
case '/':
next = peek_token ();
if (next == Token.COMMA || next == Token.CLOSE_BRACKET)
}
}
- while ((d = get_char ()) != -1 && d != '\n');
+ ReadToEndOfLine ();
any_token_seen |= tokens_seen;
tokens_seen = false;
if (docAppend)
xml_comment_buffer.Append ((char) d);
- if (d == '\n'){
+ if (d == '\n' || d == UnicodeLS || d == UnicodePS){
any_token_seen |= tokens_seen;
tokens_seen = false;
//
return is_number (c, false);
case '\n': // white space
+ case UnicodeLS:
+ case UnicodePS:
any_token_seen |= tokens_seen;
tokens_seen = false;
comments_seen = false;
continue;
}
- if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' )
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' || c == UnicodeLS || c == UnicodePS)
continue;
if (c == '#') {
return Token.LITERAL;
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
Report.Error (1010, start_location, "Newline in constant");
return Token.ERROR;
}
// Try to recover, read until newline or next "'"
while ((c = get_char ()) != -1) {
- if (c == '\n' || c == '\'')
+ if (c == '\n' || c == '\'' || c == UnicodeLS || c == UnicodePS)
break;
}
}