/// <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;
}