MCPcopy Create free account
hub / github.com/dengsgo/math-engine / parseNumber

Method parseNumber

engine/ast.go:108–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106}
107
108func (a *AST) parseNumber() NumberExprAST {
109 f64, err := strconv.ParseFloat(a.currTok.Tok, 64)
110 if err != nil {
111 a.Err = errors.New(
112 fmt.Sprintf("%v\nwant '(' or '0-9' but get '%s'\n%s",
113 err.Error(),
114 a.currTok.Tok,
115 ErrPos(a.source, a.currTok.Offset)))
116 return NumberExprAST{}
117 }
118 n := NumberExprAST{
119 Val: f64,
120 Str: a.currTok.Tok,
121 }
122 a.getNextToken()
123 return n
124}
125
126func (a *AST) parseFunCallerOrConst() ExprAST {
127 name := a.currTok.Tok

Callers 1

parsePrimaryMethod · 0.95

Calls 2

getNextTokenMethod · 0.95
ErrPosFunction · 0.85

Tested by

no test coverage detected