/// <summary> /// Skip over an error character. Always returns null. /// REVIEW: Should we skip over multiple? /// </summary> private Token LexError() { _sb.Length = 0; do { _sb.AppendFormat("{0}({1})", ChCur, LexCharUtils.GetUniEscape(ChCur)); } while (LexCharUtils.StartKind(ChNext()) == LexStartKind.None && !Eof); return(new ErrorToken(GetSpan(), ErrId.BadChar, _sb.ToString())); }
private NormStr LexIdentCore(ref bool fVerbatim) { Contracts.Assert(LexCharUtils.IsIdentStart(ChCur)); _sb.Length = 0; for (; ;) { char ch; if (ChCur == '\\') { uint u; int ichErr = _cursor.IchCur; if (!FLexEscChar(true, out u)) { break; } if (u > 0xFFFF || !LexCharUtils.IsIdent(ch = (char)u)) { ReportError(ichErr, _cursor.IchCur, ErrId.BadChar, LexCharUtils.GetUniEscape(u)); break; } fVerbatim = true; } else { if (!LexCharUtils.IsIdent(ChCur)) { break; } ch = ChCur; ChNext(); } Contracts.Assert(LexCharUtils.IsIdent(ch)); if (!LexCharUtils.IsFormat(ch)) { _sb.Append(ch); } } if (_sb.Length == 0) { return(null); } return(_lex._pool.Add(_sb)); }