示例#1
0
            private Token FetchToken()
            {
                Contracts.Assert(!Eof);
                StartTok();

                LexStartKind kind = LexCharUtils.StartKind(ChCur);

                if (kind != LexStartKind.Space && kind != LexStartKind.PreProc)
                {
                    _fLineStart = false;
                }

                switch (kind)
                {
                case LexStartKind.Punc:
                    return(LexPunc());

                case LexStartKind.NumLit:
                    return(LexNumLit());

                case LexStartKind.StrLit:
                    return(LexStrLit());

                case LexStartKind.Verbatim:
                    if (ChPeek(1) == '"')
                    {
                        return(LexStrLit());
                    }
                    if (LexCharUtils.StartKind(ChPeek(1)) == LexStartKind.Ident)
                    {
                        return(LexIdent());
                    }
                    ChNext();
                    ReportError(ErrId.VerbatimLiteralExpected);
                    return(null);

                case LexStartKind.Ident:
                    return(LexIdent());

                case LexStartKind.Comment:
                    return(LexComment());

                case LexStartKind.Space:
                    return(LexSpace());

                case LexStartKind.LineTerm:
                    LexLineTerm();
                    return(null);

                case LexStartKind.PreProc:
                    return(LexPreProc());

                default:
                    return(LexError());
                }
            }
 public LexCharInfo(LexStartKind sk, LexCharKind ck)
 {
     StartKind = sk;
     CharKind  = ck;
 }