pub fn parse_attribute(&mut self) -> Result<Attribute> {
        let name = self.parse_string()?;
        self.skip_whitespace();

        let pos = self.pos;

        let mut s = Vec::new();
        loop {
            match self.current_char {
                b'%' | b'\n' => break,
                ch => s.push(ch),
            }
            self.advance();
        }
        let mut s = String::from_utf8(s)?;

        if s.starts_with('{') && s.ends_with('}') {
            let categories = s[1..s.len() - 1]
                .split(',')
                .map(|s| s.trim().to_owned())
                .collect();
            return Ok(Attribute {
                name,
                dtype: DType::Nominal(categories),
            });
        }

        s.make_ascii_uppercase();

        match &s[..4] {
            "NUME" | "REAL" | "INTE" => Ok(Attribute {
                name,
                dtype: DType::Numeric,
            }),
            "STRI" => Ok(Attribute {
                name,
                dtype: DType::String,
            }),
            "DATE" => Err(Error::UnsupportedColumnType(pos, s)),
            _ => Err(Error::InvalidColumnType(pos, s)),
        }
    }
/// parse name and dtype of an @ATTRIBUTE declaration
parse name and dtype of an @ATTRIBUTE declaration
parse name and dtype of an @ATTRIBUTE declaration
pub fn parse_attribute(&mut self) -> Result<Attribute> {
        let name = self.parse_string()?;
        self.skip_whitespace();
        let pos = self.pos;
        let mut s = Vec::new();
        loop {
            match self.current_char {
                b'%' | b'\n' => break,
                ch => s.push(ch),
            }
            self.advance();
        }
        let mut s = String::from_utf8(s)?;
        if s.starts_with('{') && s.ends_with('}') {
            let categories = s[1..s.len() - 1]
                .split(',')
                .map(|s| s.trim().to_owned())
                .collect();
            return Ok(Attribute {
                name,
                dtype: DType::Nominal(categories),
            });
        }
        s.make_ascii_uppercase();
        match &s[..4] {
            "NUME" | "REAL" | "INTE" => Ok(Attribute {
                name,
                dtype: DType::Numeric,
            }),
            "STRI" => Ok(Attribute {
                name,
                dtype: DType::String,
            }),
            "DATE" => Err(Error::UnsupportedColumnType(pos, s)),
            _ => Err(Error::InvalidColumnType(pos, s)),
        }
    }
pub fn parse_attribute ( & mut self ) -> Result < Attribute > { let name = self . parse_string ( ) ? ; self . skip_whitespace ( ) ; let pos = self . pos ; let mut s = Vec :: new ( ) ; loop { match self . current_char { b'%' | b'\n' => break , ch => s . push ( ch ) , } self . advance ( ) ; } let mut s = String :: from_utf8 ( s ) ? ; if s . starts_with ( '{' ) && s . ends_with ( '}' ) { let categories = s [ 1 .. s . len ( ) - 1 ] . split ( ',' ) . map ( | s | s . trim ( ) . to_owned ( ) ) . collect ( ) ; return Ok ( Attribute { name , dtype : DType :: Nominal ( categories ) , } ) ; } s . make_ascii_uppercase ( ) ; match & s [ .. 4 ] { " " | " " | " " => Ok ( Attribute { name , dtype : DType :: Numeric , } ) , " " => Ok ( Attribute { name , dtype : DType :: String , } ) , " " => Err ( Error :: UnsupportedColumnType ( pos , s ) ) , _ => Err ( Error :: InvalidColumnType ( pos , s ) ) , } }
parse name and dtype of an @ATTRIBUTE declaration
parse name and dtype of an @ATTRIBUTE declaration
&mut self
&mut self