Microsoft.Zing.Scanner.ScanTokenAndProvideInfoAboutIt C# (CSharp) Méthode

ScanTokenAndProvideInfoAboutIt() public méthode

public ScanTokenAndProvideInfoAboutIt ( System.Compiler.TokenInfo tokenInfo, int &state ) : bool
tokenInfo System.Compiler.TokenInfo
state int
Résultat bool
        public override bool ScanTokenAndProvideInfoAboutIt(TokenInfo tokenInfo, ref int state)
        {
            tokenInfo.trigger = TokenTrigger.None;
            Token tok;
            if (state == 1)
            {
                //Already inside a multi-line comment
                if (this.endPos >= this.maxPos) return false;
                this.SkipMultiLineComment(true);
                if (this.stillInsideMultiLineToken)
                    this.stillInsideMultiLineToken = false;
                else
                    state = 0;
                tok = Token.MultiLineComment;
            }
            else
                tok = this.GetNextToken(false);
            switch (tok)
            {
                case Token.Colon:
                case Token.DotDot:
                case Token.Plus:
                case Token.BitwiseAnd:
                case Token.LogicalAnd:
                case Token.Assign:
                case Token.BitwiseOr:
                case Token.LogicalOr:
                case Token.BitwiseXor:
                case Token.LogicalNot:
                case Token.BitwiseNot:
                case Token.Divide:
                case Token.Equal:
                case Token.GreaterThan:
                case Token.GreaterThanOrEqual:
                case Token.LeftShift:
                case Token.LessThan:
                case Token.LessThanOrEqual:
                case Token.Remainder:
                case Token.Multiply:
                case Token.NotEqual:
                case Token.Arrow:
                case Token.RightShift:
                case Token.Subtract:
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Operator;
                    break;

                case Token.Semicolon:
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;

                case Token.Activate:
                case Token.Array:
                case Token.Bool:
                case Token.Byte:
                case Token.Chan:
                case Token.Decimal:
                case Token.Double:
                case Token.False:
                case Token.First:
                case Token.Float:
                case Token.Goto:
                case Token.In:
                case Token.Int:
                case Token.Long:
                case Token.New:
                case Token.Null:
                case Token.Object:
                case Token.Out:
                case Token.Range:
                case Token.Raise:
                case Token.Return:
                case Token.SByte:
                case Token.Set:
                case Token.Short:
                case Token.Static:
                case Token.String:
                case Token.This:
                case Token.Timeout:
                case Token.UInt:
                case Token.ULong:
                case Token.UShort:
                case Token.True:
                case Token.Visible:
                case Token.Void:
                    tokenInfo.color = TokenColor.Keyword;
                    tokenInfo.type = TokenType.Keyword;
                    break;

                case Token.Accept:
                case Token.Assert:
                case Token.Assume:
                case Token.Async:
                case Token.Atomic:
                case Token.Choose:
                case Token.Class:
                case Token.Else:
                case Token.End:
                case Token.Enum:
                case Token.Event:
                case Token.Foreach:
                case Token.If:
                case Token.Interface:
                case Token.Receive:
                case Token.Select:
                case Token.Send:
                case Token.Sizeof:
                case Token.Struct:
                case Token.Try:
                case Token.Typeof:
                case Token.Wait:
                case Token.While:
                case Token.With:
                    tokenInfo.trigger = TokenTrigger.MatchBraces;
                    tokenInfo.color = TokenColor.Keyword;
                    tokenInfo.type = TokenType.Keyword;
                    break;

                case Token.Comma:
                    tokenInfo.trigger = TokenTrigger.ParamNext;
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;

                case Token.HexLiteral:
                case Token.IntegerLiteral:
                case Token.RealLiteral:
                    tokenInfo.color = TokenColor.Number;
                    tokenInfo.type = TokenType.Literal;
                    break;

                case Token.Identifier:
                    tokenInfo.color = TokenColor.Identifier;
                    tokenInfo.type = TokenType.Identifier;
                    break;

                case Token.LeftBracket:
                case Token.LeftParenthesis:
                case Token.LeftBrace:
                    tokenInfo.trigger = TokenTrigger.ParamStart | TokenTrigger.MatchBraces;
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;

                case Token.Dot:
                    tokenInfo.trigger = TokenTrigger.MemberSelect;
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;

                case Token.MultiLineComment:
                    tokenInfo.color = TokenColor.Comment;
                    tokenInfo.type = TokenType.Comment;
                    if (this.stillInsideMultiLineToken)
                    {
                        this.stillInsideMultiLineToken = false;
                        state = 1;
                    }
                    break;

                case Token.RightBracket:
                case Token.RightParenthesis:
                case Token.RightBrace:
                    tokenInfo.trigger = TokenTrigger.ParamEnd | TokenTrigger.MatchBraces;
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;

                case Token.SingleLineComment:
                    tokenInfo.color = TokenColor.Comment;
                    tokenInfo.type = TokenType.LineComment;
                    break;

                case Token.StringLiteral:
                    tokenInfo.color = TokenColor.String;
                    tokenInfo.type = TokenType.String;
                    break;

                case Token.EndOfFile:
                    return false;

                default:
                    tokenInfo.color = TokenColor.Text;
                    tokenInfo.type = TokenType.Delimiter;
                    break;
            }
            tokenInfo.startIndex = this.startPos;
            tokenInfo.endIndex = this.endPos - 1;
            return true;
        }