From 3951f8c09b3f49253cf0d354df708069223d0316 Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sun, 23 Jul 2023 12:24:32 -0230 Subject: constant and function parsing skeleton --- const.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 const.go (limited to 'const.go') diff --git a/const.go b/const.go new file mode 100644 index 0000000..60bae20 --- /dev/null +++ b/const.go @@ -0,0 +1,14 @@ +package main + +import "math" + +// parseConstant returns nil if s is not a valid constant. +func parseConstant(s string) *float64 { + switch s { + case "pi": + // Assign to variable because can't take address of constant. + var pi float64 = math.Pi + return &pi + } + return nil +} -- cgit v1.2.3