Exemple #1
0
        internal static bool NeedsLeft(this XSharpToken token)
        {
            if (token == null)
            {
                return(false);
            }
            switch (token.Type)
            {
            case XSharpLexer.ASSIGN_ADD:
            case XSharpLexer.ASSIGN_BITAND:
            case XSharpLexer.ASSIGN_BITOR:
            case XSharpLexer.ASSIGN_DIV:
            case XSharpLexer.ASSIGN_EXP:
            case XSharpLexer.ASSIGN_LSHIFT:
            case XSharpLexer.ASSIGN_MOD:
            case XSharpLexer.ASSIGN_MUL:
            case XSharpLexer.ASSIGN_OP:
            case XSharpLexer.ASSIGN_RSHIFT:
            case XSharpLexer.ASSIGN_SUB:
            case XSharpLexer.ASSIGN_XOR:
                return(true);

            case XSharpLexer.COLON:
            case XSharpLexer.DOT:
                return(true);
            }
            if (token.IsPrefix())
            {
                return(false);
            }
            return(token.IsBinary());
        }
Exemple #2
0
        internal static bool CanJoin(this XSharpToken token, XSharpToken nextToken)
        {
            if (token == null)
            {
                return(nextToken.IsName() || nextToken.IsLiteral() || nextToken.IsPrefix());
            }
            if (token.IsPrefix() || token.IsBinary())          // we allow .and. .not. and even .not. .not.
            {
                return(nextToken.IsPrimaryOrPrefix());
            }
            if (nextToken.IsBinary() || nextToken.NeedsLeft() || nextToken.IsPostFix())
            {
                return(token.IsPrimary() || token.IsClose());
            }

            return(false);
        }
Exemple #3
0
 internal static bool NeedsRight(this XSharpToken token)
 {
     return(token.IsBinary() || token.IsPrefix());
 }