33 lines
568 B
Go
33 lines
568 B
Go
|
package actions
|
||
|
|
||
|
import (
|
||
|
// "fmt"
|
||
|
engine "github.com/tgckpg/mmqlengine/mmql/engine"
|
||
|
stmtd "github.com/tgckpg/mmqlengine/mmql/statements"
|
||
|
)
|
||
|
|
||
|
/*
|
||
|
EXPECT: [Number] [Units]
|
||
|
OR
|
||
|
EXPECT: [FUNCTION]( ...params )
|
||
|
*/
|
||
|
|
||
|
func AmountStatement( lexer *engine.Lexer ) ( istmt stmtd.IStatement, err error ) {
|
||
|
stmt := stmtd.AmountStatement{}
|
||
|
|
||
|
val, err := lexer.ReadDecimal()
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
stmt.Value = val
|
||
|
|
||
|
unit, err := lexer.ReadAlpha()
|
||
|
if err != nil {
|
||
|
return
|
||
|
}
|
||
|
stmt.Unit = unit
|
||
|
|
||
|
istmt = stmt
|
||
|
return
|
||
|
}
|