MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / parse_number

Function parse_number

graphlite/src/ast/parser.rs:5082–5098  ·  view source on GitHub ↗

Parse number (float)

(tokens: &[Token])

Source from the content-addressed store, hash-verified

5080
5081/// Parse number (float)
5082fn parse_number(tokens: &[Token]) -> IResult<&[Token], f64> {
5083 if let Some((token, rest)) = tokens.split_first() {
5084 match token {
5085 Token::Integer(n) => Ok((rest, *n as f64)),
5086 Token::Float(f) => Ok((rest, *f)),
5087 _ => Err(nom::Err::Error(nom::error::Error::new(
5088 tokens,
5089 nom::error::ErrorKind::Tag,
5090 ))),
5091 }
5092 } else {
5093 Err(nom::Err::Error(nom::error::Error::new(
5094 tokens,
5095 nom::error::ErrorKind::Tag,
5096 )))
5097 }
5098}
5099
5100/// Parse integer
5101fn parse_integer(tokens: &[Token]) -> IResult<&[Token], i64> {

Callers

nothing calls this directly

Calls 1

ErrorEnum · 0.85

Tested by

no test coverage detected