fn number(&mut self) -> Result<(Span, BigUint)> {
    let start = self.idx;
    let mut val: BigUint = 0_u8.into();
    if self.cur() == b'0' {
      self.idx += 1;
      match self.cur_opt() {
        Some(b'x') | Some(b'X') => {
          self.idx += 1;
          while self.idx < self.source.len() {
            let c = self.cur();
            if (b'0'..=b'9').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - b'0');
            } else if (b'A'..=b'F').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - (b'A' - 10));
            } else if (b'a'..=b'f').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - (b'a' - 10));
            } else {
              break
            }
          }
          if self.idx == start + 2 {
            return self.err_str("expected a number")
          }
        }
        _ => val = self.decimal(val),
      }
    } else {
      val = self.decimal(val);
      if self.idx == start {
        return self.err_str("expected a number")
      }
    }
    (Ok(((start..self.idx).into(), val)), self.ws()).0
  }
/// Parser for number literals, which can be either decimal (`12345`) or hexadecimal (`0xd00d`).
/// Hexadecimal digits and the `0x` prefix are case insensitive.
/// This is used for lisp number literals, while MM0 number literals are decimal only and parsed
/// by [`decimal`](Self::decimal). Does not advance the parser index on failure.
Parser for number literals, which can be either decimal (`12345`) or hexadecimal (`0xd00d`).
Hexadecimal digits and the `0x` prefix are case insensitive.
This is used for lisp number literals, while MM0 number literals are decimal only and parsed
by [`decimal`](Self::decimal). Does not advance the parser index on failure.
Parser for number literals which can be either decimal ( ` 12345 ` ) or hexadecimal ( ` 0xd00d ` ) . Hexadecimal digits and the ` 0x ` prefix are case insensitive . This is used for lisp number literals while MM0 number literals are decimal only and parsed by [ ` decimal ` ] ( Self :: decimal ) . Does not advance the parser index on failure .
fn number(&mut self) -> Result<(Span, BigUint)> {
    let start = self.idx;
    let mut val: BigUint = 0_u8.into();
    if self.cur() == b'0' {
      self.idx += 1;
      match self.cur_opt() {
        Some(b'x') | Some(b'X') => {
          self.idx += 1;
          while self.idx < self.source.len() {
            let c = self.cur();
            if (b'0'..=b'9').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - b'0');
            } else if (b'A'..=b'F').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - (b'A' - 10));
            } else if (b'a'..=b'f').contains(&c) {
              self.idx += 1;
              val = 16_u8 * val + (c - (b'a' - 10));
            } else {
              break
            }
          }
          if self.idx == start + 2 {
            return self.err_str("expected a number")
          }
        }
        _ => val = self.decimal(val),
      }
    } else {
      val = self.decimal(val);
      if self.idx == start {
        return self.err_str("expected a number")
      }
    }
    (Ok(((start..self.idx).into(), val)), self.ws()).0
  }
fn number ( & mut self ) -> Result < ( Span , BigUint ) > { let start = self . idx ; let mut val : BigUint = 0_u8 . into ( ) ; if self . cur ( ) == b'0' { self . idx += 1 ; match self . cur_opt ( ) { Some ( b'x' ) | Some ( b'X' ) => { self . idx += 1 ; while self . idx < self . source . len ( ) { let c = self . cur ( ) ; if ( b'0' ..= b'9' ) . contains ( & c ) { self . idx += 1 ; val = 16_u8 * val + ( c - b'0' ) ; } else if ( b'A' ..= b'F' ) . contains ( & c ) { self . idx += 1 ; val = 16_u8 * val + ( c - ( b'A' - 10 ) ) ; } else if ( b'a' ..= b'f' ) . contains ( & c ) { self . idx += 1 ; val = 16_u8 * val + ( c - ( b'a' - 10 ) ) ; } else { break } } if self . idx == start + 2 { return self . err_str ( " " ) } } _ => val = self . decimal ( val ) , } } else { val = self . decimal ( val ) ; if self . idx == start { return self . err_str ( " " ) } } ( Ok ( ( ( start .. self . idx ) . into ( ) , val ) ) , self . ws ( ) ) . 0 }
Parser for number literals, which can be either decimal (`12345`) or hexadecimal (`0xd00d`).
Parser for number literals which can be either decimal ( ` 12345 ` ) or hexadecimal ( ` 0xd00d ` ) .
&mut self
&mut self