1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00

Fix documentation

This commit is contained in:
Robert Krimen 2014-04-11 18:18:31 -07:00
parent 9d7eadf70f
commit ba4c8b0769
2 changed files with 8 additions and 5 deletions

View File

@ -108,6 +108,8 @@ Parse and return an AST
// Parse some JavaScript, yielding a *ast.Program and/or an ErrorList // Parse some JavaScript, yielding a *ast.Program and/or an ErrorList
program, err := parser.ParseFile(nil, filename, src, 0) program, err := parser.ParseFile(nil, filename, src, 0)
### otto
You can run (Go) JavaScript from the commandline with: You can run (Go) JavaScript from the commandline with:
http://github.com/robertkrimen/otto/tree/master/otto http://github.com/robertkrimen/otto/tree/master/otto
@ -117,6 +119,8 @@ Run JavaScript by entering some source on stdin or by giving otto a filename:
$ otto example.js $ otto example.js
### underscore
Optionally include the JavaScript utility-belt library, underscore, with this Optionally include the JavaScript utility-belt library, underscore, with this
import: import:
@ -360,9 +364,6 @@ allocated runtime, and return the runtime, resulting value, and error (if any).
src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST
always be in UTF-8. always be in UTF-8.
If src is a Node, then runtime behavior is undefined if the AST has been
modified.
src may also be a node, but if the AST has been modified, then runtime behavior src may also be a node, but if the AST has been modified, then runtime behavior
is undefined. is undefined.

View File

@ -103,6 +103,8 @@ Parse and return an AST
// Parse some JavaScript, yielding a *ast.Program and/or an ErrorList // Parse some JavaScript, yielding a *ast.Program and/or an ErrorList
program, err := parser.ParseFile(nil, filename, src, 0) program, err := parser.ParseFile(nil, filename, src, 0)
otto
You can run (Go) JavaScript from the commandline with: http://github.com/robertkrimen/otto/tree/master/otto You can run (Go) JavaScript from the commandline with: http://github.com/robertkrimen/otto/tree/master/otto
$ go get -v github.com/robertkrimen/otto/otto $ go get -v github.com/robertkrimen/otto/otto
@ -111,6 +113,8 @@ Run JavaScript by entering some source on stdin or by giving otto a filename:
$ otto example.js $ otto example.js
underscore
Optionally include the JavaScript utility-belt library, underscore, with this import: Optionally include the JavaScript utility-belt library, underscore, with this import:
import ( import (
@ -259,8 +263,6 @@ func (otto *Otto) clone() *Otto {
// //
// src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST always be in UTF-8. // src may be a string, a byte slice, a bytes.Buffer, or an io.Reader, but it MUST always be in UTF-8.
// //
// If src is a Node, then runtime behavior is undefined if the AST has been modified.
//
// src may also be a node, but if the AST has been modified, then runtime behavior is undefined. // src may also be a node, but if the AST has been modified, then runtime behavior is undefined.
// //
func Run(src interface{}) (*Otto, Value, error) { func Run(src interface{}) (*Otto, Value, error) {