code
stringlengths
10
1.34M
language
stringclasses
1 value
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package interp import "syscall" func ext۰syscall۰Close(fr *frame, args []value) value { panic("syscall.Close not yet implemented") } func ext۰syscall۰Fstat(...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build darwin package interp import "syscall" func init() { externals["syscall.Sysctl"] = ext۰syscall۰Sysctl } func ext۰syscall۰Sysctl(fr *frame, args ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package interp // Custom hashtable atop map. // For use when the key's equivalence relation is not consistent with ==. // The Go specification doesn't address...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package interp // Emulated "reflect" package. // // We completely replace the built-in "reflect" package. // The only thing clients can depend upon are that re...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package interp // Values // // All interpreter values are "boxed" in the empty interface, value. // The range of possible dynamic types within value are: // //...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package ssa/interp defines an interpreter for the SSA // representation of Go programs. // // This interpreter is provided as an adjunct for testing the SSA ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package interp import ( "bytes" "fmt" "go/token" "strings" "sync" "unsafe" "golang.org/x/tools/go/exact" "golang.org/x/tools/go/ssa" "golang.org/x/to...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package ssa defines a representation of the elements of Go programs // (packages, types, functions, variables and constants) using a // static single-assignm...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements typechecking of call and selector expressions. package types import ( "go/ast" "go/token" ) func (check *Checker) call(x *operand, ...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements the Check function, which drives type-checking. package types import ( "go/ast" "go/token" "golang.org/x/tools/go/exact" ) // deb...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements Selections. package types import ( "bytes" "fmt" ) // SelectionKind describes the kind of a selector expression x.f // (excluding q...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "go/ast" "go/token" ) // labels checks correct label use in body. func (check *Checker) labels(body *ast.BlockStmt) { // set of all...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package typeutil defines various utilities for types, such as Map, // a mapping from types.Type to interface{} values. package typeutil import ( "bytes" "...
Go
package typeutil import "golang.org/x/tools/go/types" // Dependencies returns all dependencies of the specified packages. // // Dependent packages appear in topological order: if package P imports // package Q, Q appears earlier than P in the result. // The algorithm follows import statements in the order they // app...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package typeutil // This file defines utilities for user interfaces that display types. import "golang.org/x/tools/go/types" // IntuitiveMethodSet returns th...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "container/heap" "fmt" ) // initOrder computes the Info.InitOrder for package variables. func (check *Checker) initOrder() { // An I...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements various field and method lookup functions. package types // LookupFieldOrMethod looks up a field or method with given package and name...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements typechecking of conversions. package types import "golang.org/x/tools/go/exact" // Conversion type-checks the conversion T(x). // The...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements printing of types. package types import ( "bytes" "fmt" ) // If GcCompatibilityMode is set, printing of types is modified // to mat...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "bytes" "fmt" "go/ast" "go/token" "golang.org/x/tools/go/exact" ) // TODO(gri) Document factory, accessor methods, and fields. Ge...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements commonly used type predicates. package types import "sort" func isNamed(typ Type) bool { if _, ok := typ.(*Basic); ok { return ok ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "errors" "fmt" "go/ast" "go/token" pathLib "path" "strconv" "strings" "unicode" "golang.org/x/tools/go/exact" ) // A declInfo...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements the universe and unsafe package scopes. package types import ( "go/token" "strings" "golang.org/x/tools/go/exact" ) var ( Univer...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements objsets. // // An objset is similar to a Scope but objset elements // are identified by their unique id, instead of their // object name...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements type-checking of identifiers and type expressions. package types import ( "go/ast" "go/token" "sort" "strconv" "golang.org/x/too...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements various error reporters. package types import ( "fmt" "go/ast" "go/token" "strings" ) func assert(p bool) { if !p { panic("ass...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import ( "go/ast" "go/token" "golang.org/x/tools/go/exact" ) func (check *Checker) reportAltDecl(obj Object) { if pos := obj.Pos(); pos.IsV...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements isTerminating. package types import ( "go/ast" "go/token" ) // isTerminating reports if s is a terminating statement. // If s is la...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements a cache of method sets. package types import "sync" // A MethodSetCache records the method set of each type T for which // MethodSet(...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package types declares the data types and implements // the algorithms for type-checking of Go packages. // Use Check and Config.Check to invoke the type-che...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements typechecking of expressions. package types import ( "fmt" "go/ast" "go/token" "math" "golang.org/x/tools/go/exact" ) /* Basic a...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements method sets. package types import ( "bytes" "fmt" "sort" ) // A MethodSet is an ordered set of concrete or abstract (interface) me...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements Scopes. package types import ( "bytes" "fmt" "io" "sort" "strings" ) // TODO(gri) Provide scopes with a name or other mechanism ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements typechecking of statements. package types import ( "fmt" "go/ast" "go/token" "golang.org/x/tools/go/exact" ) func (check *Checke...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import "sort" // TODO(gri) Revisit factory functions - make sure they have all relevant parameters. // A Type represents a type of Go. // All t...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements initialization and assignment checks. package types import ( "go/ast" "go/token" ) // assignment reports whether x can be assigned ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package types import "fmt" // A Package describes a Go package. type Package struct { path string name string scope *Scope complete bool impor...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build go1.2 package types import "go/ast" func slice3(x *ast.SliceExpr) bool { return x.Slice3 } func sliceMax(x *ast.SliceExpr) ast.Expr { return x....
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !go1.2 package types import "go/ast" func slice3(x *ast.SliceExpr) bool { return false } func sliceMax(x *ast.SliceExpr) ast.Expr { return nil ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements Sizes. package types // Sizes defines the sizing functions for package unsafe. type Sizes interface { // Alignof returns the alignmen...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements resolveOrder. package types import ( "go/ast" "sort" ) // resolveOrder computes the order in which package-level objects // must be...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file defines operands and associated operations. package types import ( "bytes" "go/ast" "go/token" "golang.org/x/tools/go/exact" ) // An operan...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements New, Eval and EvalNode. package types import ( "fmt" "go/ast" "go/parser" "go/token" "golang.org/x/tools/go/exact" ) // New is ...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements typechecking of builtin function calls. package types import ( "go/ast" "go/token" "golang.org/x/tools/go/exact" ) // builtin typ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This file implements printing of expressions. package types import ( "bytes" "go/ast" ) // ExprString returns the (possibly simplified) string represent...
Go
package loader // This file handles cgo preprocessing of files containing `import "C"`. // // DESIGN // // The approach taken is to run the cgo processor on the package's // CgoFiles and parse the output, faking the filenames of the // resulting ASTs so that the synthetic file containing the C types is // called "C" (...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package loader import ( "go/ast" "go/build" "go/parser" "go/token" "io" "os" "path/filepath" "sync" ) // parseFiles parses the Go source files within ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package loader loads, parses and type-checks packages of Go code // plus their transitive closure, and retains both the ASTs and the // derived facts. // // ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This implementation is loosely based on the algorithm described // in: "On the linearization of graphs and writing symbol files", // by R. Griesemer, Technic...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package importer import "golang.org/x/tools/go/types" const ( magic = "\n$$ exports $$\n" version = "v0" ) // Tags. Must be < 0. const ( // Packages pa...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package importer import ( "bytes" "encoding/binary" "fmt" "go/ast" "strings" "golang.org/x/tools/go/exact" "golang.org/x/tools/go/types" ) // debuggin...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package vcs import ( "fmt" "io" "io/ioutil" "log" "net/http" "net/url" ) // httpClient is the default HTTP client, but a variable so it can be // chang...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package vcs import ( "bytes" "encoding/json" "errors" "fmt" "log" "os" "os/exec" "path/filepath" "regexp" "strconv" "strings" ) // Verbose enables...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package vcs import ( "encoding/xml" "fmt" "io" "strings" ) // charsetReader returns a reader for the given charset. Currently // it only supports UTF-8 a...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package vcs import ( "os" "strings" ) // envForDir returns a copy of the environment // suitable for running in the given directory. // The environment is ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This file defines a naive Andersen-style solver for the inclusion // constraint system. import ( "fmt" "golang.org/x/tools/go/types" ) ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer import ( "fmt" "go/token" "strings" "golang.org/x/tools/go/ssa" "golang.org/x/tools/go/types" ) // A Label is an entity that may be poin...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer import "fmt" func (c *addrConstraint) String() string { return fmt.Sprintf("addr n%d <- {&n%d}", c.dst, c.src) } func (c *copyConstraint) St...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer import ( "bytes" "fmt" "log" "os" "os/exec" "runtime" "time" "golang.org/x/tools/container/intsets" "golang.org/x/tools/go/types" ) ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This file defines the constraint generation phase. // TODO(adonovan): move the constraint definitions and the store() etc // functions whic...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer import ( "golang.org/x/tools/go/types" ) type constraint interface { // For a complex constraint, returns the nodeid of the pointer // to w...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This file defines the main datatypes and Analyze function of the pointer analysis. import ( "fmt" "go/token" "io" "os" "reflect" "run...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This package defines the treatment of intrinsics, i.e. library // functions requiring special analytical treatment. // // Most of these are ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer import ( "bytes" "fmt" "go/token" "io" "golang.org/x/tools/container/intsets" "golang.org/x/tools/go/callgraph" "golang.org/x/tools/go/...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This file implements renumbering, a pre-solver optimization to // improve the efficiency of the solver's points-to set representation. // //...
Go
package pointer // This file implements the generation and resolution rules for // constraints arising from the use of reflection in the target // program. See doc.go for explanation of the representation. // // For consistency, the names of all parameters match those of the // actual functions in the "reflect" packa...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package pointer // This file defines the internal (context-sensitive) call graph. import ( "fmt" "go/token" "golang.org/x/tools/go/ssa" ) type cgnode str...
Go
package pointer // This file implements Hash-Value Numbering (HVN), a pre-solver // constraint optimization described in Hardekopf & Lin, SAS'07 (see // doc.go) that analyses the graph topology to determine which sets of // variables are "pointer equivalent" (PE), i.e. must have identical // points-to sets in the solu...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* Package pointer implements Andersen's analysis, an inclusion-based pointer analysis algorithm first described in (Andersen, 1994). A pointer analysis relat...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package buildutil import ( "fmt" "go/ast" "go/build" "go/parser" "go/token" "io" "io/ioutil" "os" "path" "path/filepath" "strings" ) // ParseFile b...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package buildutil provides utilities related to the go/build // package in the standard library. // // All I/O is done via the build.Context file system inte...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gccgoimporter import ( "bufio" "os" "os/exec" "path/filepath" "strings" "golang.org/x/tools/go/types" ) // Information about a specific install...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package gccgoimporter implements Import for gccgo-generated object files. package gccgoimporter import ( "bytes" "debug/elf" "fmt" "io" "io/ioutil" "o...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package gccgoimporter import ( "bytes" "errors" "fmt" "go/token" "io" "strconv" "strings" "text/scanner" "golang.org/x/tools/go/exact" "golang.org/x...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rename // This file defines the safety checks for each kind of renaming. import ( "fmt" "go/ast" "go/token" "golang.org/x/tools/go/loader" "gola...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package rename contains the implementation of the 'gorename' command // whose main function is in golang.org/x/tools/refactor/rename. // See that package for...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rename import ( "go/ast" "os" "path/filepath" "reflect" "runtime" "strings" "unicode" "golang.org/x/tools/go/types" ) func objectKind(obj typ...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package rename // This file contains logic related to specifying a renaming: parsing of // the flags as a form of query, and finding the object(s) it denotes. ...
Go
// Package lexical computes the structure of the lexical environment, // including the definition of and references to all universal, // package-level, file-level and function-local entities. It does not // record qualified identifiers, labels, struct fields, or methods. // // It is intended for renaming and refactori...
Go
package eg import ( "fmt" "go/ast" "go/token" "log" "os" "reflect" "golang.org/x/tools/go/exact" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/types" ) // matchExpr reports whether pattern x matches y. // // If tr.allowWildcards, Idents in x that refer to parameters are // treated as wildcards, and ...
Go
package eg // This file defines the AST rewriting pass. // Most of it was plundered directly from // $GOROOT/src/cmd/gofmt/rewrite.go (after convergent evolution). import ( "fmt" "go/ast" "go/token" "os" "reflect" "sort" "strconv" "strings" "golang.org/x/tools/astutil" "golang.org/x/tools/go/types" ) // T...
Go
// Package eg implements the example-based refactoring tool whose // command-line is defined in golang.org/x/tools/cmd/eg. package eg import ( "bytes" "fmt" "go/ast" "go/printer" "go/token" "os" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/types" ) const Help = ` This tool implements example-based r...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package satisfy inspects the type-checked ASTs of Go packages and // reports the set of discovered type constraints of the form (lhs, rhs // Type) where lhs ...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package importgraph computes the forward and reverse import // dependency graphs for all packages in a Go workspace. package importgraph import ( "go/build...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "errors" "regexp" "strconv" "unicode/utf8" ) // This file is stolen from go/src/cmd/godoc/codewalk.go. // It's an evaluator for t...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "log" "net/url" "strings" ) func init() { Register("link", parseLink) } type Link struct { URL *url.URL Label string ...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "strings" ) func init() { Register("iframe", parseIframe) } type Iframe struct { URL string Width int Height int } ...
Go
package present import ( "errors" "html/template" "path/filepath" "strings" ) func init() { Register("html", parseHTML) } func parseHTML(ctx *Context, fileName string, lineno int, text string) (Elem, error) { p := strings.Fields(text) if len(p) != 2 { return nil, errors.New("invalid .html args") } name :=...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "fmt" "strings" ) func init() { Register("image", parseImage) } type Image struct { URL string Width int Height int } fun...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bufio" "bytes" "fmt" "html/template" "path/filepath" "regexp" "strconv" "strings" ) // Is the playground available? var Play...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bytes" "html" "html/template" "strings" "unicode" "unicode/utf8" ) /* Fonts are demarcated by an initial and final char brack...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import ( "bufio" "bytes" "errors" "fmt" "html/template" "io" "io/ioutil" "log" "net/url" "regexp" "strings" "time" "unicode" "uni...
Go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package present import "strings" func init() { Register("caption", parseCaption) } type Caption struct { Text string } func (c Caption) TemplateName() str...
Go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* The present file format Present files have the following format. The first non-blank non-comment line is the title, so the header looks like Title of doc...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package astutil // This file defines utilities for working with source positions. import ( "fmt" "go/ast" "go/token" "sort" ) // PathEnclosingInterval re...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package astutil contains common utilities for working with the Go AST. package astutil import ( "bufio" "bytes" "fmt" "go/ast" "go/format" "go/parser"...
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package intsets var a [1 << 8]byte func init() { for i := range a { var n byte for x := i; x != 0; x >>= 1 { if x&1 != 0 { n++ } } a[i] = n...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package intsets provides Sparse, a compact and fast representation // for sparse sets of int values. // // The time complexity of the operations Len, Insert,...
Go
// Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package satisfy inspects the type-checked ASTs of Go packages and // reports the set of discovered type constraints of the form (lhs, rhs // Type) where lhs ...
Go
// Package eg implements the example-based refactoring tool whose // command-line is defined in golang.org/x/tools/cmd/eg. package eg import ( "bytes" "fmt" "go/ast" "go/printer" "go/token" "os" "golang.org/x/tools/go/loader" "golang.org/x/tools/go/types" ) const Help = ` This tool implements example-based r...
Go