Documentation ¶
Overview ¶
Example (Control) ¶
== Warnings
../_test/control.go:44:2: 'default' clause above 'case' clause in switch statement
Compile(DIR_TEST + "control.go")
Output:
Example (Decl) ¶
== Errors
os: import from core library ../_test/error_decl.go:13:10: complex128 type ../_test/error_decl.go:14:10: complex128 type ../_test/error_decl.go:15:10: complex128 type ../_test/error_decl.go:16:10: complex128 type ../_test/error_decl.go:18:6: built-in function complex() ../_test/error_decl.go:23:17: complex64 type ../_test/error_decl.go:24:13: complex64 type ../_test/error_decl.go:25:11: complex64 type ../_test/error_decl.go:30:14: complex128 type ../_test/error_decl.go:31:9: complex128 type ../_test/error_decl.go:32:12: complex128 type ../_test/error_decl.go:37:16: complex64 type ../_test/error_decl.go:38:23: complex64 type ../_test/error_decl.go:39:11: complex64 type ../_test/error_decl.go:48:12: channel type ../_test/error_decl.go:49:12: channel type ../_test/error_decl.go:50:7: channel operator ../_test/error_decl.go:60:2: function type in struct ../_test/error_decl.go:64:4: int64 type ../_test/error_decl.go:65:2: anonymous field in struct ../_test/error_decl.go:66:4: complex128 type
Compile(DIR_TEST + "error_decl.go")
Output:
Example (Stmt) ¶
== Errors
../_test/error_stmt.go:6:13: channel type ../_test/error_stmt.go:8:2: goroutine ../_test/error_stmt.go:9:2: defer directive ../_test/error_stmt.go:12:2: built-in function recover() ../_test/error_stmt.go:18:1: use of label ../_test/error_stmt.go:23:3: goto directive
Compile(DIR_TEST + "error_stmt.go")
Output:
Index ¶
Examples ¶
Constants ¶
const ( HEADER = "/* Generated by GoScript <github.com/kless/GoScript> */" BLANK = "_" // blank identifier EMPTY = `""` // empty string )
const ( // To be able to minimize code NL = "<<NL>>" // new line SP = "<<SP>>" // space TAB = "<<TAB>>" ADDR = "<<&>>" // to mark assignments to addresses IOTA = "<<iota>>" NIL = "<<nil>>" )
const VERB = "<<V>>"
Variables ¶
var ( Bootstrap bool // is transforming the gojs's package? MaxMessage = 10 // maximum number of errors and warnings to show. )
var Constant = map[string]string{
"math.E": "Math.E",
"math.Ln2": "Math.LN2",
"math.Log2E": "Math.LOG2E",
"math.Ln10": "Math.LN10",
"math.Log10E": "Math.LOG10E",
"math.Pi": "Math.PI",
"math.Sqrt2": "Math.SQRT2",
}
Constants to transform.
var Function = map[string]string{
"fmt.Print": "document.write",
"fmt.Println": "document.write",
"fmt.Printf": "document.write",
"fmt.Sprint": "",
"fmt.Sprintf": "",
"math.Abs": "Math.abs",
"math.Acos": "Math.acos",
"math.Asin": "Math.asin",
"math.Atan": "Math.atan",
"math.Atan2": "Math.atan2",
"math.Ceil": "Math.ceil",
"math.Cos": "Math.cos",
"math.Exp": "Math.exp",
"math.Floor": "Math.floor",
"math.Log": "Math.log",
"math.Max": "Math.max",
"math.Min": "Math.min",
"math.Pow": "Math.pow",
"math.Sin": "Math.sin",
"math.Sqrt": "Math.sqrt",
"math.Tan": "Math.tan",
"rand.Float32": "Math.random",
"rand.Float64": "Math.random",
}
Functions that can be transformed since JavaScript has an equivalent one.
Functions ¶
Types ¶
This section is empty.