public override SyntaxKind GetKnownTokenType(KnownTokenType type)
        {
            switch (type)
            {
            case KnownTokenType.Identifier:
                return(SyntaxKind.Identifier);

            case KnownTokenType.Keyword:
                return(SyntaxKind.Keyword);

            case KnownTokenType.NewLine:
                return(SyntaxKind.NewLine);

            case KnownTokenType.Whitespace:
                return(SyntaxKind.Whitespace);

            case KnownTokenType.Transition:
                return(SyntaxKind.Transition);

            case KnownTokenType.CommentStart:
                return(SyntaxKind.RazorCommentTransition);

            case KnownTokenType.CommentStar:
                return(SyntaxKind.RazorCommentStar);

            case KnownTokenType.CommentBody:
                return(SyntaxKind.RazorCommentLiteral);

            default:
                return(SyntaxKind.Marker);
            }
        }
예제 #2
0
        public override CSharpTokenType GetKnownTokenType(KnownTokenType type)
        {
            switch (type)
            {
            case KnownTokenType.Identifier:
                return(CSharpTokenType.Identifier);

            case KnownTokenType.Keyword:
                return(CSharpTokenType.Keyword);

            case KnownTokenType.NewLine:
                return(CSharpTokenType.NewLine);

            case KnownTokenType.WhiteSpace:
                return(CSharpTokenType.WhiteSpace);

            case KnownTokenType.Transition:
                return(CSharpTokenType.Transition);

            case KnownTokenType.CommentStart:
                return(CSharpTokenType.RazorCommentTransition);

            case KnownTokenType.CommentStar:
                return(CSharpTokenType.RazorCommentStar);

            case KnownTokenType.CommentBody:
                return(CSharpTokenType.RazorComment);

            default:
                return(CSharpTokenType.Unknown);
            }
        }
 protected internal bool Optional(KnownTokenType type)
 {
     return(Optional(Language.GetKnownTokenType(type)));
 }
 protected internal void Expected(KnownTokenType type)
 {
     Expected(Language.GetKnownTokenType(type));
 }
예제 #5
0
 public abstract SyntaxKind GetKnownTokenType(KnownTokenType type);
예제 #6
0
 public virtual bool IsKnownTokenType(SyntaxToken token, KnownTokenType type)
 {
     return(token != null && Equals(token.Kind, GetKnownTokenType(type)));
 }
예제 #7
0
 public virtual bool KnowsTokenType(KnownTokenType type)
 {
     return(type == KnownTokenType.Unknown || !Equals(GetKnownTokenType(type), GetKnownTokenType(KnownTokenType.Unknown)));
 }
예제 #8
0
 public virtual bool IsKnownTokenType(TToken token, KnownTokenType type)
 {
     return(token != null && Equals(token.Type, GetKnownTokenType(type)));
 }
예제 #9
0
 public abstract TTokenType GetKnownTokenType(KnownTokenType type);