expr : INC variable
            | DEC variable
187393
def p_expr_pre_incdec(p):
    ''''''
    p[0] = ast.PreIncDecOp(p[1], p[2], lineno=p.lineno(1))
1110285
function decInt(str, base = 10) {
  if (!isNumStr(str, base)) throw new Error('in decInt, str is not an integer in the given base');
  let minus = String.fromCharCode(consts.minus);

  let rec = rectify(str);

  // If the rectified value is negative, call increment on the absolute value.
  if (rec[0] == minus) {
    let inc = incInt(rec.slice(1), base);
    return (minus + inc);
  }

  // Find the first character from the right that is not zero.
  // This is the character to decrement.
  let decIndex = -1;
  for (let i = rec.length - 1; i >= 0; i--) {
    if (rec[i] != consts.alphabet[0]) {
      decIndex = i;
      break;
    }
  }

  // If all characters are found to be zero, the decremented value is -1.
  if (decIndex < 0) return minus + consts.alphabet[1];

  // Decrement the appropriate character.
  let decrementedChar = decChar(rec[decIndex], base);
  let dec = rec.slice(0, decIndex) + decrementedChar;

  // Reset all lesser character places to the maximal character for the given base.
  let maximalChar = consts.alphabet[base - 1];
  dec = dec.padEnd(rec.length, maximalChar);

  // Rectify in case the decremented character left a leading zero.
  dec = rectify(dec);

  return dec;
}
633349
function makeSimpleExpr(expr) {
    var a, b, c;
    if (expr.charAt(0) === '$') {
        return new VariableExpr(expr.substr(1));
    } else if (expr.charAt(0) === '@') {
        a = new NodeTestName(expr.substr(1));
        b = new StepExpr('attribute', a);
        c = new LocationExpr();
        c.appendStep(b);
        return c;
    } else if (expr.match(/^[0-9]+$/)) {
        return new NumberExpr(expr);
    } else {
        a = new NodeTestName(expr);
        b = new StepExpr('child', a);
        c = new LocationExpr();
        c.appendStep(b);
        return c;
    }
}
1339958
def decint(n, signed=False):  # pylint: disable=invalid-name,too-many-branches
    

    if isinstance(n, str):
        n = utils.to_string(n)

    if n is True:
        return 1

    if n is False:
        return 0

    if n is None:
        return 0

    if is_numeric(n):
        if signed:
            if not -TT255 <= n <= TT255 - 1:
                raise EncodingError('Number out of range: %r' % n)
        else:
            if not 0 <= n <= TT256 - 1:
                raise EncodingError('Number out of range: %r' % n)

        return n

    if is_string(n):
        if len(n) > 32:
            raise EncodingError('String too long: %r' % n)

        if len(n) == 40:
            int_bigendian = decode_hex(n)
        else:
            int_bigendian = n  # pylint: disable=redefined-variable-type

        result = big_endian_to_int(int_bigendian)
        if signed:
            if result >= TT255:
                result -= TT256

            if not -TT255 <= result <= TT255 - 1:
                raise EncodingError('Number out of range: %r' % n)
        else:
            if not 0 <= result <= TT256 - 1:
                raise EncodingError('Number out of range: %r' % n)

        return result

    raise EncodingError('Cannot decode integer: %r' % n)
1292898
def assignrepr(self, prefix: str = '') -> str:
        """"""
        lines = ['%sNode("%s", variable="%s",'
                 % (prefix, self.name, self.variable)]
        if self.keywords:
            subprefix = '%skeywords=' % (' '*(len(prefix)+5))
            with objecttools.repr_.preserve_strings(True):
                with objecttools.assignrepr_tuple.always_bracketed(False):
                    line = objecttools.assignrepr_list(
                        sorted(self.keywords), subprefix, width=70)
            lines.append(line + ',')
        lines[-1] = lines[-1][:-1]+')'
        return '\n'.join(lines)
323792
function(dec) {

      let g;
      let N = this["n"];
      let D = this["d"];

      dec = dec || 15; // 15 = decimal places when no repitation

      let cycLen = cycleLen(N, D); // Cycle length
      let cycOff = cycleStart(N, D, cycLen); // Cycle start

      let str = this['s'] < C_ZERO ? "-" : "";

      // Append integer part
      str += N / D | C_ZERO;

      N %= D;
      N *= C_TEN;

      if (N)
        str += ".";

      if (cycLen) {

        for (let i = cycOff; i--; ) {
          str += N / D | C_ZERO;
          N %= D;
          N *= C_TEN;
        }
        str += "(";
        for (let i = cycLen; i--; ) {
          str += N / D | C_ZERO;
          N %= D;
          N *= C_TEN;
        }
        str += ")";
      } else {
        for (let i = dec; N && i--; ) {
          str += N / D | C_ZERO;
          N %= D;
          N *= C_TEN;
        }
      }
      return str;
    }
813054
function(dec) {
         var r = parseInt(dec,10).toString(16);
         if (r.length == 1) r = "0"+r;
         return r;
      }
577632
def p_expr(self, p):
        
        if len(p) == 2:
            p[0] = p[1]
        else:
            p[0] = ast.Comma(left=p[1], right=p[3])
935584
def _VAR_DECL_value(self, cursor, _type):
        """"""
        # always expect list [(k,v)] as init value.from list(cursor.get_children())
        # get the init_value and special cases
        init_value = self._get_var_decl_init_value(cursor.type,
                                                   list(cursor.get_children()))
        _ctype = cursor.type.get_canonical()
        if self.is_unexposed_type(_ctype):
            # string are not exposed
            init_value = '%s # UNEXPOSED TYPE. PATCH NEEDED.' % (init_value)
        elif (self.is_pointer_type(_ctype) and
                      _ctype.get_pointee().kind == TypeKind.FUNCTIONPROTO):
            # Function pointers argument are handled at type creation time
            # but we need to put a CFUNCTYPE as a value of the name variable
            init_value = _type
        elif self.is_array_type(_ctype):
            # an integer litteral will be the size
            # an string litteral will be the value
            # any list member will be children of a init_list_expr
            # FIXME Move that code into typedesc
            def countof(k, l):
                return [item[0] for item in l].count(k)

            if (countof(CursorKind.INIT_LIST_EXPR, init_value) == 1):
                init_value = dict(init_value)[CursorKind.INIT_LIST_EXPR]
            elif (countof(CursorKind.STRING_LITERAL, init_value) == 1):
                # we have a initialised c_array
                init_value = dict(init_value)[CursorKind.STRING_LITERAL]
            else:
                # ignore size alone
                init_value = []
            # check the array size versus elements.
            if _type.size < len(init_value):
                _type.size = len(init_value)
        elif init_value == []:
            # catch case.
            init_value = None
        else:
            log.debug('VAR_DECL: default init_value: %s', init_value)
            if len(init_value) > 0:
                init_value = init_value[0][1]
        return init_value
591016
def unary_set_expr(self, ctx, oper, postoper=False):
        
        if self.readonly:
            raise MuvError(
                "Cannot increment or decrement constant '%s'." % self.varname,
                position=self.position
            )
        varname = ctx.lookup_variable(self.varname)
        if varname is None:
            raise MuvError(
                "Undeclared identifier '%s'." % self.varname,
                position=self.position
            )
        if len(self.indexing) == 0:
            if postoper:
                fmt = "{var} @ {var} {oper}"
            else:
                fmt = "{var} dup {oper} @"
            return fmt.format(var=varname, oper=oper)
        if len(self.indexing) == 1:
            if ctx.target in ['fb7']:
                if postoper:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] "
                        "dup -4 rotate {oper} "
                        "swap rot ->[] pop"
                    )
                else:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] {oper} "
                        "dup -4 rotate "
                        "swap rot ->[] pop"
                    )
            else:
                if postoper:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] "
                        "dup -4 rotate {oper} "
                        "swap rot ->[] {var} !"
                    )
                else:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] {oper} "
                        "dup -4 rotate "
                        "swap rot ->[] {var} !"
                    )
            return fmt.format(
                var=varname,
                oper=oper,
                idx=self.indexing[0].generate_code(ctx),
            )
        if ctx.target in ['fb7']:
            if postoper:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get "
                    "dup -4 rotate {oper} "
                    "swap rot array_nested_set pop"
                )
            else:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get {oper} "
                    "dup -4 rotate "
                    "swap rot array_nested_set pop"
                )
        else:
            if postoper:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get "
                    "dup -4 rotate {oper} "
                    "swap rot array_nested_set {var} !"
                )
            else:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get {oper} "
                    "dup -4 rotate "
                    "swap rot array_nested_set {var} !"
                )
        return fmt.format(
            var=varname,
            oper=oper,
            idx=" ".join(
                x.generate_code(ctx)
                for x in self.indexing
            )
        )
309636
def p_if_expr_header(p):
    
    global ENABLED

    IFDEFS.append((ENABLED, p.lineno(1)))
    ENABLED = bool(int(p[2])) if p[2].isdigit() else ID_TABLE.defined(p[2])
1216489
def p_var_decl_at(p):
    
    p[0] = None

    if len(p[2]) != 1:
        syntax_error(p.lineno(1),
                     'Only one variable at a time can be declared this way')
        return

    idlist = p[2][0]

    entry = SYMBOL_TABLE.declare_variable(idlist[0], idlist[1], p[3])
    if entry is None:
        return

    if p[5].token == 'CONST':
        tmp = p[5].expr
        if tmp.token == 'UNARY' and tmp.operator == 'ADDRESS':  # Must be an ID
            if tmp.operand.token == 'VAR':
                entry.make_alias(tmp.operand)
            elif tmp.operand.token == 'ARRAYACCESS':
                if tmp.operand.offset is None:
                    syntax_error(p.lineno(4), 'Address is not constant. Only constant subscripts are allowed')
                    return

                entry.make_alias(tmp.operand)
                entry.offset = tmp.operand.offset
            else:
                syntax_error(p.lineno(4), 'Only address of identifiers are allowed')
                return

    elif not is_number(p[5]):
        syntax_error(p.lineno(4), 'Address must be a numeric constant expression')
        return
    else:
        entry.addr = str(make_typecast(_TYPE(gl.STR_INDEX_TYPE), p[5], p.lineno(4)).value)
        entry.accessed = True
        if entry.scope == SCOPE.local:
            SYMBOL_TABLE.make_static(entry.name)
325973
def cat(expr, others=None, sep=None, na_rep=None):
    

    if others is not None:
        from .strings import _cat as cat_str

        return cat_str(expr, others, sep=sep, na_rep=na_rep)

    return _cat(expr, sep=sep, na_rep=na_rep)
1181970
def _expr2bddnode(expr):
    """"""
    if expr.is_zero():
        return BDDNODEZERO
    elif expr.is_one():
        return BDDNODEONE
    else:
        top = expr.top

        # Register this variable
        _ = bddvar(top.names, top.indices)

        root = top.uniqid
        lo = _expr2bddnode(expr.restrict({top: 0}))
        hi = _expr2bddnode(expr.restrict({top: 1}))
        return _bddnode(root, lo, hi)
669285
def solve_var(expr, vars):
    """"""
    try:
        return Result(structured.resolve(vars, expr.value), ())
    except (KeyError, AttributeError) as e:
        # Raise a better exception for accessing a non-existent member.
        raise errors.EfilterKeyError(root=expr, key=expr.value, message=e,
                                     query=expr.source)
    except (TypeError, ValueError) as e:
        # Raise a better exception for what is probably a null pointer error.
        if vars.locals is None:
            raise errors.EfilterNoneError(
                root=expr, query=expr.source,
                message="Trying to access member %r of a null." % expr.value)
        else:
            raise errors.EfilterTypeError(
                root=expr, query=expr.source,
                message="%r (vars: %r)" % (e, vars))
    except NotImplementedError as e:
        raise errors.EfilterError(
            root=expr, query=expr.source,
            message="Trying to access member %r of an instance of %r." %
            (expr.value, type(vars)))
917500
def _bracket_exact_var(self, symbol):
        """"""
        if isinstance(self.element, Executable):
            if symbol in self.element.parameters:
                return self.element.parameters[symbol]            
            if symbol in self.element.members:
                return self.element.members[symbol]

        if symbol in self.element.module.members:
            return self.element.module.members[symbol]

        return None
565053
def del_expr(self, ctx):
        
        if self.readonly:
            raise MuvError(
                "Cannot assign value to constant '%s'." % self.varname,
                position=self.position
            )
        varname = ctx.lookup_variable(self.varname)
        if varname is None:
            raise MuvError(
                "Undeclared identifier '%s'." % self.varname,
                position=self.position
            )
        if len(self.indexing) == 0:
            return "0 {var} !".format(var=varname)
        if len(self.indexing) == 1:
            if ctx.target in ['fb7']:
                return "{var} @ {idx} array_delitem".format(
                    var=varname,
                    idx=self.indexing[0].generate_code(ctx),
                )
            else:
                return "{var} @ {idx} array_delitem dup {var} !".format(
                    var=varname,
                    idx=self.indexing[0].generate_code(ctx),
                )
        if ctx.target in ['fb7']:
            return "{var} @ {{ {idx} }}list array_nested_del".format(
                var=varname,
                idx=" ".join(x.generate_code(ctx) for x in self.indexing),
            )
        else:
            return "{var} @ {{ {idx} }}list array_nested_del dup {var} !".format(
                var=varname,
                idx=" ".join(x.generate_code(ctx) for x in self.indexing),
            )