コード例 #1
0
 public StatPhrase(StatToken stat, ComparisonToken comparison, NumberToken number)
 {
     this.stat       = stat.value;
     this.comparison = comparison.value;
     this.number     = number.value;
 }
コード例 #2
0
ファイル: OperatorToken.cs プロジェクト: mmoenfly/GitCook2021
        protected void BindDelegates(string text, TokenId id)
        {
            switch (id)
            {
            case TokenId.AssignmentOperatorToken:
                switch (text)
                {
                case "+=":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyAdd);
                    return;

                case "-=":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMinus);
                    return;

                case "*=":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMultiply);
                    return;

                case "/=":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyDiv);
                    return;

                case "%=":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMod);
                    return;

                case null:
                    return;

                default:
                    return;
                }

            case TokenId.MultiplyOperatorToken:
                switch (text)
                {
                case "*":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMultiply);
                    return;

                case "/":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyDiv);
                    return;

                case "%":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMod);
                    return;

                case null:
                    return;

                default:
                    return;
                }

            case TokenId.ComparisonOperatorToken:
            case TokenId.CaseSensitiveComparisonOperatorToken:
            case TokenId.CaseInsensitiveComparisonOperatorToken:
                ComparisonToken comparisonToken = (ComparisonToken)this;
                if (comparisonToken != null)
                {
                    text = comparisonToken.ComparisonName;
                    if (text == null)
                    {
                        break;
                    }
                }
                switch (text)
                {
                case "-replace":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.ReplaceOperator);
                    return;

                case "-split":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.SplitOperator);
                    return;

                case "-join":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.JoinOperator);
                    return;

                case "-as":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.AsOperator);
                    return;

                case "-isnot":
                case "-is":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.IsOperator);
                    return;

                case "-like":
                case "-notlike":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.LikeOperator);
                    return;

                case "-match":
                case "-notmatch":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.MatchOperator);
                    return;

                default:
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.ComparisonOperators);
                    return;
                }

            case TokenId.LogicalOperatorToken:
                switch (text)
                {
                case "-and":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.andOperator);
                    return;

                case "-or":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.orOperator);
                    return;

                case "-xor":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.xorOperator);
                    return;

                case null:
                    return;

                default:
                    return;
                }

            case TokenId.BitwiseOperatorToken:
                switch (text)
                {
                case "-band":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.bandOperator);
                    return;

                case "-bor":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.borOperator);
                    return;

                case "-bxor":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.bxorOperator);
                    return;

                case null:
                    return;

                default:
                    return;
                }

            case TokenId.AdditionOperatorToken:
                switch (text)
                {
                case "+":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyAdd);
                    return;

                case "-":
                    this._operationDelegate = new PowerShellBinaryOperator(ParserOps.PolyMinus);
                    return;

                case null:
                    return;

                default:
                    return;
                }

            case TokenId.FormatOperatorToken:
                this._operationDelegate = new PowerShellBinaryOperator(ParserOps.formatOperator);
                break;

            case TokenId.RangeOperatorToken:
                this._operationDelegate = new PowerShellBinaryOperator(ParserOps.rangeOperator);
                break;
            }
        }