Ejemplo n.º 1
0
        public static TokenType ToTokenType(this HSPTokenType tokentype)
        {
            switch (tokentype)
            {
            case HSPTokenType.Char:
            case HSPTokenType.String:
                return(TokenType.String);

            case HSPTokenType.Comment:
                return(TokenType.Comment);

            case HSPTokenType.Flag:
            case HSPTokenType.Numeric:
                return(TokenType.Literal);    // Literal?

            case HSPTokenType.Idenfitier:
                return(TokenType.Identifier);

            case HSPTokenType.Keyword:
            case HSPTokenType.Macro:
            case HSPTokenType.Preprocessor:
                return(TokenType.Keyword);

            case HSPTokenType.Operator:
                return(TokenType.Operator);

            case HSPTokenType.Sepatator:
                return(TokenType.Delimiter);

            default:
                return(TokenType.Unknown);
            }
        }
Ejemplo n.º 2
0
 public Token(string text, int startIndex, HSPTokenType type)
 {
     Text       = text;
     StartIndex = startIndex;
     Length     = Text.Length;
     Type       = type;
 }
Ejemplo n.º 3
0
        public static TokenColor ToColor(this HSPTokenType tokentype)
        {
            switch (tokentype)
            {
            case HSPTokenType.Char:
            case HSPTokenType.String:
                return(TokenColor.String);

            case HSPTokenType.Comment:
                return(TokenColor.Comment);

            case HSPTokenType.Numeric:
            case HSPTokenType.Macro:
            case HSPTokenType.Flag:
                return(TokenColor.Number);    // Literal?

            case HSPTokenType.Idenfitier:
                return(TokenColor.Identifier);

            case HSPTokenType.Keyword:
            case HSPTokenType.Preprocessor:
                return(TokenColor.Keyword);

            default:
                return(TokenColor.Text);
            }
        }