Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Commit

Permalink
Problem: example is not visible in docs.
Browse files Browse the repository at this point in the history
Solution: copy example into documentation.
  • Loading branch information
AlekSi committed Dec 11, 2018
1 parent 9c3a8d4 commit 428a036
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,33 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

// Package gosh implements gosh command.
//
// To embed Gosh into your Go program use subpackages:
// * https://godoc.org/gosh-lang.org/gosh/tokens
// * https://godoc.org/gosh-lang.org/gosh/scanner
// * https://godoc.org/gosh-lang.org/gosh/ast
// * https://godoc.org/gosh-lang.org/gosh/parser
// * https://godoc.org/gosh-lang.org/gosh/objects
// * https://godoc.org/gosh-lang.org/gosh/interpreter
//
// Small example:
// code := `println("Hello, world!")`
//
// s, err := scanner.New(code, nil)
// if err != nil {
// log.Fatal(err)
// }
//
// p := parser.New(s, nil)
// program := p.ParseProgram()
// if p.Errors() != nil {
// log.Fatal(p.Errors())
// }
//
// scope := objects.NewScope(objects.Builtin(os.Stdout))
// i := interpreter.New(nil)
// res := i.Eval(context.Background(), program, scope)
// fmt.Println("Eval result:", res)
package main // import "gosh-lang.org/gosh"

import (
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func Example() {
log.Fatal(p.Errors())
}

i := interpreter.New(nil)
scope := objects.NewScope(objects.Builtin(os.Stdout))
i := interpreter.New(nil)
res := i.Eval(context.Background(), program, scope)
fmt.Println("Eval result:", res)
// Output:
Expand Down

0 comments on commit 428a036

Please sign in to comment.