/// <summary> /// recognize bracketed identifiers. /// Special case: we are using '\' character to escape '[' and ']' only, so '\' by itself is not an escape /// </summary> private void ScanName(char chEnd, char esc, string charsToEscape) { char[] text = _text; Debug.Assert(chEnd != '\0', "Invalid bracket value"); Debug.Assert(esc != '\0', "Invalid escape value"); do { if (text[_pos] == esc) { if (_pos + 1 < text.Length && charsToEscape.IndexOf(text[_pos + 1]) >= 0) { _pos++; } } _pos++; } while (_pos < text.Length && text[_pos] != chEnd); if (_pos >= text.Length) { throw ExprException.InvalidNameBracketing(new string(text, _start, (_pos - 1) - _start)); } Debug.Assert(text[_pos] == chEnd, "Invalid bracket value"); _pos++; _token = Tokens.Name; }
private void ScanName(char chEnd, char esc, string charsToEscape) { char[] text = this.text; do { if (((text[this.pos] == esc) && ((this.pos + 1) < text.Length)) && (charsToEscape.IndexOf(text[this.pos + 1]) >= 0)) { this.pos++; } this.pos++; }while ((this.pos < text.Length) && (text[this.pos] != chEnd)); if (this.pos >= text.Length) { throw ExprException.InvalidNameBracketing(new string(text, this.start, (this.pos - 1) - this.start)); } this.pos++; this.token = Tokens.Name; }