bexpr : PEEK LP numbertype COMMA expr RP
5458
def p_expr_peektype_(p):
    
    p[0] = make_builtin(p.lineno(1), 'PEEK',
                        make_typecast(TYPE.uinteger, p[5], p.lineno(4)),
                        type_=p[3])
228358
def _get_seqtype_from_ext(handle):
    ''''''
    if isinstance(handle, basestring):
        name = handle
    elif hasattr(handle, 'filename'):
        name = handle.filename
    elif hasattr(handle, 'name'):
        name = handle.name
    else:
        raise ValueError("Unknown datatype for handle!")

    modifier = ''
    dummy, ext = path.splitext(name.lower())
    if ext == ".gz":
        modifier = 'gz-'
        dummy, ext = path.splitext(dummy)

    if not ext:
        ext = "." + dummy

    if ext in (".gbk", ".gb", ".genbank", ".gbff"):
        return modifier + "genbank"
    elif ext in (".embl", ".emb"):
        return modifier + "embl"
    elif ext in (".fa", ".fasta", ".fna", ".faa", ".fas"):
        return modifier + "fasta"
    else:
        raise ValueError("Unknown file format '%s'." % ext)
313587
function numericEndPos( $tpl, &$text, $start_pos, $len,
                            &$float )
    {
        $pos = $start_pos;
        $has_comma = false;
        $numberPos = $pos;
        if ( $pos < $len )
        {
            if ( $text[$pos] == '-' )
            {
                ++$pos;
                $numberPos = $pos;
            }
        }
        while ( $pos < $len )
        {
            if ( $text[$pos] == "." and $float )
            {
                if ( $has_comma )
                {
                    if ( !$has_comma and
                         $float )
                        $float = false;
                    return $pos;
                }
                $has_comma = $pos;
            }
            else if ( $text[$pos] < '0' or $text[$pos] > '9' )
            {
                if ( !$has_comma and
                     $float )
                    $float = false;
                if ( $pos < $len and
                     $has_comma and
                     $pos == $has_comma + 1 )
                {
                    return $start_pos;
                }
                if ( $pos == $numberPos )
                {
                    return $start_pos;
                }
                return $pos;
            }
            ++$pos;
        }
        if ( !$has_comma and
             $float )
            $float = false;
        if ( $has_comma and
             $start_pos + 1 == $pos )
        {
            return $start_pos;
        }
        return $pos;
    }
740332
def p_call_expr(self, p):
        
        if len(p) == 3:
            p[0] = self.asttypes.FunctionCall(p[1], p[2])
            p[0].setpos(p)  # require yacc_tracking
        elif len(p) == 4:
            p[0] = self.asttypes.DotAccessor(p[1], p[3])
            p[0].setpos(p, 2)
        else:
            p[0] = self.asttypes.BracketAccessor(p[1], p[3])
            p[0].setpos(p, 2)
829097
def p_expr_usr(p):
    
    if p[2].type_ == TYPE.string:
        p[0] = make_builtin(p.lineno(1), 'USR_STR', p[2], type_=TYPE.uinteger)
    else:
        p[0] = make_builtin(p.lineno(1), 'USR',
                            make_typecast(TYPE.uinteger, p[2], p.lineno(1)),
                            type_=TYPE.uinteger)
988674
private boolean peekStatementStandard() {
    switch (peekType()) {
    case OPEN_CURLY:
    case VAR:
    case CONST:
    case SEMI_COLON:
    case IF:
    case DO:
    case WHILE:
    case FOR:
    case CONTINUE:
    case BREAK:
    case RETURN:
    case WITH:
    case SWITCH:
    case THROW:
    case TRY:
    case DEBUGGER:
    case YIELD:
    case IDENTIFIER:
    case TYPE:
    case DECLARE:
    case MODULE:
    case NAMESPACE:
    case THIS:
    case CLASS:
    case SUPER:
    case NUMBER:
    case STRING:
    case NO_SUBSTITUTION_TEMPLATE:
    case TEMPLATE_HEAD:
    case NULL:
    case TRUE:
    case SLASH: // regular expression literal
    case SLASH_EQUAL: // regular expression literal
    case FALSE:
    case OPEN_SQUARE:
    case OPEN_PAREN:
    case NEW:
    case DELETE:
    case VOID:
    case TYPEOF:
    case PLUS_PLUS:
    case MINUS_MINUS:
    case PLUS:
    case MINUS:
    case TILDE:
    case BANG:
      return true;
    default:
      return false;
    }
  }
1156713
function postProp(prop) {
    var expr = prop.expr;

    if (expr.type === ExprType.TEXT) {
        switch (expr.segs.length) {
            case 0:
                prop.expr = {
                    type: ExprType.BOOL,
                    value: true
                };
                break;

            case 1:
                expr = prop.expr = expr.segs[0];
                if (expr.type === ExprType.INTERP && expr.filters.length === 0) {
                    prop.expr = expr.expr;
                }
        }
    }
}
1280675
private ExprCfg parseCmpExpr(ExprToken code, ExprCfg left, ExprCfg right)
  {
    while (true) {
      ExprToken token = scanToken();
      
      switch (token) {
      case EQ: case NE:
      case GT: case LT:
      case LE: case GE:
      case MATCHES:
        left = new ExprCfgCmp(left, right);

        code = token;
        right = parseTerm();
        break;

        /*
      case Expr.ADD: case Expr.SUB:
        right = parseAddExpr(token, right, parseTerm());
        break;

      case Expr.MUL: case Expr.DIV: case Expr.MOD:
        right = parseMulExpr(token, right, parseTerm());
        break;
        */

      default:
        unreadToken();
        return new ExprCfgCmp(left, right);
      }
    }
  }
1167528
def p_exprgt(p):
    
    a = int(p[1]) if p[1].isdigit() else 0
    b = int(p[3]) if p[3].isdigit() else 0

    p[0] = '1' if a > b else '0'
1371222
def parse_expr(e):
    
    m = relation_re.match(e)
    if m is None:
        raise ValueError("error parsing expression '{}'".format(e))
    field, op, val = m.groups()
    # Try different types
    try:
        # Integer
        val_int = int(val)
        val = val_int
    except ValueError:
        try:
            # Float
            val_float = float(val)
            val = val_float
        except ValueError:
            try:
                # Boolean
                val = {'true': True, 'false': False}[val.lower()]
            except KeyError:
                # String
                if re.match(r'".*"|\'.*\'', val):
                    # strip quotes from strings
                    val = val[1:-1]
    return field, op, val
404169
def peek(self, length):
        
        return self.string[self.pos:self.pos + length]
974287
function peek(p) {
    var i = p || 0, j = 0, t;

    while (j <= i) {
      t = lookahead[j];
      if (!t) {
        t = lookahead[j] = lex.token();
      }
      j += 1;
    }
    return t;
  }
552729
def p_expr_ternary_op(p):
    ''
    p[0] = ast.TernaryOp(p[1], p[3], p[5], lineno=p.lineno(2))
432832
private void parseInstanceOfExpr() throws TTXPathException {

        parseTreatExpr();

        if (is("instance", true)) {
            consume("of", true);

            mPipeBuilder.addInstanceOfExpr(getTransaction(), parseSequenceType());
        }
    }
325353
def _getLPA( self ):
        "  "
        return str( self.line ) + ":" + \
               str( self.pos ) + ":" + \
               str( self.absPosition )
65952
private ExprKraken parseMulExpr()
  {
    ExprKraken left = parseSimpleTerm();

    while (true) {
      Token token = scanToken();

      switch (token) {
      case STAR:
        left = new BinaryExpr(BinaryOp.MUL, left, parseSimpleTerm());
        break;
      case DIV:
        left = new BinaryExpr(BinaryOp.DIV, left, parseSimpleTerm());
        break;
      case MOD:
        left = new BinaryExpr(BinaryOp.MOD, left, parseSimpleTerm());
        break;

      default:
        _token = token;
        return left;
      }
    }
  }
133036
def _startswith(expr, pat):
    

    return _string_op(expr, Startswith, output_type=types.boolean, _pat=pat)