much stdlib docs
This commit is contained in:
parent
b941df68e1
commit
ee39de01fd
9 changed files with 228 additions and 74 deletions
|
|
@ -29,7 +29,13 @@ import (
|
|||
// perhaps we simply write out arithmetic routines that operate on the strings
|
||||
// then we need not worry about storage length.
|
||||
|
||||
func num_cast(in *ast.Token, a ast.VarTable, f ast.FuncTable) *ast.Token {
|
||||
/* Takes 1 argument (must be a string)
|
||||
* will attempt to cast it to a number.
|
||||
* will return nil if cast fails
|
||||
*
|
||||
* Example: (number "3.4")
|
||||
*/
|
||||
func NumCast(in *ast.Token, a ast.VarTable, f ast.FuncTable) *ast.Token {
|
||||
in = in.Eval(f, a, false)
|
||||
if in.Tag != ast.STRING {
|
||||
log.Log(log.ERR,
|
||||
|
|
@ -50,7 +56,7 @@ func num_cast(in *ast.Token, a ast.VarTable, f ast.FuncTable) *ast.Token {
|
|||
return out
|
||||
}
|
||||
|
||||
func add(in *ast.Token, a ast.VarTable, f ast.FuncTable) *ast.Token {
|
||||
func Add(in *ast.Token, a ast.VarTable, f ast.FuncTable) *ast.Token {
|
||||
var res float64
|
||||
|
||||
in = in.Eval(f, a, false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue