public bool parsing_catch_when;
int parsing_string_interpolation;
+ int string_interpolation_section;
Stack<bool> parsing_string_interpolation_quoted;
public bool parsing_interpolation_format;
public int current_token;
public object val;
public int parsing_string_interpolation;
+ public int string_interpolation_section;
public Stack<bool> parsing_string_interpolation_quoted;
public Position (Tokenizer t)
ifstack = new Stack<int> (clone);
}
parsing_generic_less_than = t.parsing_generic_less_than;
+ string_interpolation_section = t.string_interpolation_section;
current_token = t.current_token;
val = t.val;
parsing_string_interpolation = t.parsing_string_interpolation;
+ string_interpolation_section = t.string_interpolation_section;
if (t.parsing_string_interpolation_quoted != null && t.parsing_string_interpolation_quoted.Count != 0) {
var clone = t.parsing_string_interpolation_quoted.ToArray ();
Array.Reverse (clone);
if (parsing_block == 0)
res = -1;
+ break;
+ case Token.THROW:
+ switch (current_token) {
+ case Token.ARROW:
+ case Token.OP_COALESCING:
+ case Token.INTERR:
+ res = Token.THROW_EXPR;
+ break;
+ }
+
break;
}
case Token.DECIMAL:
case Token.BOOL:
case Token.STRING:
+ case Token.SBYTE:
return Token.OPEN_PARENS_CAST;
}
}
else if (the_token == Token.INTERR_NULLABLE || the_token == Token.STAR)
goto again;
else if (the_token == Token.OP_GENERICS_LT) {
- if (!parse_less_than (ref genericDimension))
+ int unused = 0;
+ if (!parse_less_than (ref unused))
return false;
goto again;
} else if (the_token == Token.OPEN_BRACKET) {
}
if (d == '.') {
- return Token.INTERR_OPERATOR;
+ d = reader.Peek ();
+ return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR;
}
if (d != ' ') {
case Token.THIS:
case Token.NEW:
case Token.INTERPOLATED_STRING:
+ case Token.THROW:
next_token = Token.INTERR;
break;
case '\"':
++str_quote;
break;
+ case '\\':
+ // Skip escaped " character
+ c = reader.Read ();
+ if (c == -1)
+ res = false;
+ break;
case -1:
res = false;
break;
int TokenizePragmaWarningIdentifier (ref int c, ref bool identifier)
{
-
if ((c >= '0' && c <= '9') || is_identifier_start_character (c)) {
int number;
id_builder [pos] = (char)c;
if (c >= '0' && c <= '9') {
- if (pos == 6 && id_builder [0] == 'C' && id_builder [1] == 'S') {
+ if (pos == 5 && id_builder [0] == 'C' && id_builder [1] == 'S') {
// Recognize CSXXXX as C# XXXX warning
number = 0;
int pow = 1000;
pow /= 10;
}
}
+ } else if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
+ advance_line ();
+ break;
} else if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && c != '_') {
break;
}
case '{':
val = ltb.Create (current_source, ref_line, col);
+
+ if (parsing_string_interpolation > 0)
+ ++string_interpolation_section;
+
return Token.OPEN_BRACE;
case '}':
if (parsing_string_interpolation > 0) {
- --parsing_string_interpolation;
- bool quoted;
- if (parsing_string_interpolation_quoted != null && parsing_string_interpolation_quoted.Count > 0) {
- quoted = parsing_string_interpolation_quoted.Pop ();
- } else {
- quoted = false;
+ if (string_interpolation_section == 0) {
+ --parsing_string_interpolation;
+ bool quoted;
+ if (parsing_string_interpolation_quoted != null && parsing_string_interpolation_quoted.Count > 0) {
+ quoted = parsing_string_interpolation_quoted.Pop ();
+ } else {
+ quoted = false;
+ }
+
+ return TokenizeInterpolatedString (quoted);
}
- return TokenizeInterpolatedString (quoted);
+ --string_interpolation_section;
}
val = ltb.Create (current_source, ref_line, col);
--braces;
break;
case '\\':
+ if (parsing_string_interpolation_quoted != null && parsing_string_interpolation_quoted.Peek ())
+ break;
+
++col;
int surrogate;
ch = escape (ch, out surrogate);
private void handle_one_line_xml_comment ()
{
int c;
- while ((c = peek_char ()) == ' ')
- get_char (); // skip heading whitespaces.
while ((c = peek_char ()) != -1 && c != '\n' && c != '\r') {
xml_comment_buffer.Append ((char) get_char ());
}