Permalink
Browse files

First import

  • Loading branch information...
1 parent f61f0c0 commit c99e8d287bf426aa289e4ce55854e76d42846ab1 @fd committed Feb 19, 2013
Showing with 4,015 additions and 334 deletions.
  1. +29 −1 lang/ast/ast.go
  2. +2 −2 lang/ast/commentmap.go
  3. +5 −5 lang/ast/commentmap_test.go
  4. +3 −3 lang/ast/example_test.go
  5. +16 −1 lang/ast/filter.go
  6. +1 −1 lang/ast/import.go
  7. +1 −1 lang/ast/print.go
  8. +367 −0 lang/ast/replace.go
  9. +2 −2 lang/ast/resolve.go
  10. +1 −1 lang/ast/scope.go
  11. +10 −0 lang/ast/walk.go
  12. +22 −12 lang/build/build.go
  13. +2 −2 lang/build/build_test.go
  14. +1 −1 lang/build/deps_test.go
  15. +0 −23 lang/cmd/go/script
  16. 0 lang/cmd/{go → sx}/bootstrap.go
  17. +59 −38 lang/cmd/{go → sx}/build.go
  18. +2 −2 lang/cmd/{go → sx}/clean.go
  19. 0 lang/cmd/{go → sx}/discovery.go
  20. +6 −6 lang/cmd/{go → sx}/doc.go
  21. 0 lang/cmd/{go → sx}/env.go
  22. 0 lang/cmd/{go → sx}/fix.go
  23. +4 −4 lang/cmd/{go → sx}/fmt.go
  24. +14 −15 lang/cmd/{go → sx}/get.go
  25. +5 −5 lang/cmd/{go → sx}/help.go
  26. 0 lang/cmd/{go → sx}/http.go
  27. 0 lang/cmd/{go → sx}/list.go
  28. +11 −11 lang/cmd/{go → sx}/main.go
  29. 0 lang/cmd/{go → sx}/match_test.go
  30. 0 lang/cmd/{go → sx}/mkdoc.sh
  31. +12 −8 lang/cmd/{go → sx}/pkg.go
  32. +4 −4 lang/cmd/{go → sx}/run.go
  33. +23 −0 lang/cmd/sx/script
  34. 0 lang/cmd/{go → sx}/script.txt
  35. 0 lang/cmd/{go → sx}/signal.go
  36. 0 lang/cmd/{go → sx}/signal_notunix.go
  37. 0 lang/cmd/{go → sx}/signal_unix.go
  38. 0 lang/cmd/{go → sx}/tag_test.go
  39. 0 lang/cmd/{go → sx}/test.bash
  40. +22 −19 lang/cmd/{go → sx}/test.go
  41. 0 lang/cmd/{go → sx}/testdata/errmsg/x.go
  42. 0 lang/cmd/{go → sx}/testdata/errmsg/x1_test.go
  43. 0 lang/cmd/{go → sx}/testdata/errmsg/x_test.go
  44. 0 lang/cmd/{go → sx}/testdata/local/easy.go
  45. 0 lang/cmd/{go → sx}/testdata/local/easysub/easysub.go
  46. 0 lang/cmd/{go → sx}/testdata/local/easysub/main.go
  47. 0 lang/cmd/{go → sx}/testdata/local/hard.go
  48. 0 lang/cmd/{go → sx}/testdata/local/sub/sub.go
  49. 0 lang/cmd/{go → sx}/testdata/local/sub/sub/subsub.go
  50. 0 lang/cmd/{go → sx}/testdata/src/go-cmd-test/helloworld.go
  51. 0 lang/cmd/{go → sx}/testdata/testimport/p.go
  52. 0 lang/cmd/{go → sx}/testdata/testimport/p1/p1.go
  53. 0 lang/cmd/{go → sx}/testdata/testimport/p2/p2.go
  54. 0 lang/cmd/{go → sx}/testdata/testimport/p_test.go
  55. 0 lang/cmd/{go → sx}/testdata/testimport/x_test.go
  56. +2 −2 lang/cmd/{go → sx}/testflag.go
  57. +7 −7 lang/cmd/{go → sx}/tool.go
  58. 0 lang/cmd/{go → sx}/vcs.go
  59. +1 −1 lang/cmd/{go → sx}/version.go
  60. +1 −1 lang/cmd/{go → sx}/vet.go
  61. +52 −0 lang/cmd/sxc/main.go
  62. 0 lang/cmd/{godoc → sxdoc}/README.godoc-app
  63. 0 lang/cmd/{godoc → sxdoc}/appinit.go
  64. 0 lang/cmd/{godoc → sxdoc}/codewalk.go
  65. +3 −3 lang/cmd/{godoc → sxdoc}/dirtrees.go
  66. 0 lang/cmd/{godoc → sxdoc}/doc.go
  67. 0 lang/cmd/{godoc → sxdoc}/filesystem.go
  68. +2 −2 lang/cmd/{godoc → sxdoc}/format.go
  69. +6 −13 lang/cmd/{godoc → sxdoc}/godoc.go
  70. +3 −3 lang/cmd/{godoc → sxdoc}/index.go
  71. +3 −3 lang/cmd/{godoc → sxdoc}/main.go
  72. +3 −3 lang/cmd/{godoc → sxdoc}/parser.go
  73. 0 lang/cmd/{godoc → sxdoc}/play-appengine.go
  74. 0 lang/cmd/{godoc → sxdoc}/play-local.go
  75. +1 −1 lang/cmd/{godoc → sxdoc}/play.go
  76. 0 lang/cmd/{godoc → sxdoc}/setup-godoc-app.bash
  77. +2 −2 lang/cmd/{godoc → sxdoc}/snippet.go
  78. 0 lang/cmd/{godoc → sxdoc}/spec.go
  79. 0 lang/cmd/{godoc → sxdoc}/template.go
  80. 0 lang/cmd/{godoc → sxdoc}/throttle.go
  81. 0 lang/cmd/{godoc → sxdoc}/utils.go
  82. 0 lang/cmd/{godoc → sxdoc}/zip.go
  83. 0 lang/cmd/{gofmt → sxfmt}/doc.go
  84. +8 −8 lang/cmd/{gofmt → sxfmt}/gofmt.go
  85. +361 −0 lang/cmd/sxfmt/gofmt.go.gofmt
  86. 0 lang/cmd/{gofmt → sxfmt}/gofmt_test.go
  87. +132 −0 lang/cmd/sxfmt/gofmt_test.go.gofmt
  88. +3 −3 lang/cmd/{gofmt → sxfmt}/long_test.go
  89. +3 −3 lang/cmd/{gofmt → sxfmt}/rewrite.go
  90. +2 −2 lang/cmd/{gofmt → sxfmt}/simplify.go
  91. 0 lang/cmd/{gofmt → sxfmt}/testdata/.gitattributes
  92. 0 lang/cmd/{gofmt → sxfmt}/testdata/comments.golden
  93. 0 lang/cmd/{gofmt → sxfmt}/testdata/comments.input
  94. 0 lang/cmd/{gofmt → sxfmt}/testdata/composites.golden
  95. 0 lang/cmd/{gofmt → sxfmt}/testdata/composites.input
  96. 0 lang/cmd/{gofmt → sxfmt}/testdata/crlf.golden
  97. 0 lang/cmd/{gofmt → sxfmt}/testdata/crlf.input
  98. 0 lang/cmd/{gofmt → sxfmt}/testdata/import.golden
  99. 0 lang/cmd/{gofmt → sxfmt}/testdata/import.input
  100. 0 lang/cmd/{gofmt → sxfmt}/testdata/old.golden
  101. 0 lang/cmd/{gofmt → sxfmt}/testdata/old.input
  102. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite1.golden
  103. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite1.input
  104. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite2.golden
  105. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite2.input
  106. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite3.golden
  107. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite3.input
  108. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite4.golden
  109. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite4.input
  110. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite5.golden
  111. 0 lang/cmd/{gofmt → sxfmt}/testdata/rewrite5.input
  112. 0 lang/cmd/{gofmt → sxfmt}/testdata/slices1.golden
  113. 0 lang/cmd/{gofmt → sxfmt}/testdata/slices1.input
  114. 0 lang/cmd/{gofmt → sxfmt}/testdata/slices2.golden
  115. 0 lang/cmd/{gofmt → sxfmt}/testdata/slices2.input
  116. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin1.golden
  117. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin1.golden.gofmt
  118. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin1.input
  119. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin1.input.gofmt
  120. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin2.golden
  121. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin2.golden.gofmt
  122. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin2.input
  123. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin2.input.gofmt
  124. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin3.golden
  125. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin3.golden.gofmt
  126. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin3.input
  127. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin3.input.gofmt
  128. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin4.golden
  129. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin4.golden.gofmt
  130. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin4.input
  131. 0 lang/cmd/{gofmt → sxfmt}/testdata/stdin4.input.gofmt
  132. 0 lang/cmd/{gofmt → sxfmt}/testdata/typeswitch.golden
  133. 0 lang/cmd/{gofmt → sxfmt}/testdata/typeswitch.input
  134. +54 −0 lang/compiler/context.go
  135. +832 −0 lang/compiler/converter.go
  136. +60 −0 lang/compiler/hasher.go
  137. +30 −0 lang/compiler/parser.go
  138. +320 −0 lang/compiler/printer.go
  139. +108 −0 lang/compiler/type_checker.go
  140. +465 −0 lang/compiler/type_printer.go
  141. +12 −0 lang/compiler/types.go
  142. +2 −2 lang/doc/comment.go
  143. +1 −1 lang/doc/comment_test.go
  144. +2 −2 lang/doc/doc.go
  145. +3 −3 lang/doc/doc_test.go
  146. +2 −2 lang/doc/example.go
  147. +4 −4 lang/doc/example_test.go
  148. +1 −1 lang/doc/exports.go
  149. +1 −1 lang/doc/filter.go
  150. +3 −3 lang/doc/headscan.go
  151. +2 −2 lang/doc/reader.go
  152. +3 −3 lang/doc/testdata/benchmark.go
  153. +4 −4 lang/format/format.go
  154. +5 −4 lang/format/format_test.go
  155. +2 −2 lang/parser/error_test.go
  156. +4 −4 lang/parser/example_test.go
  157. +4 −2 lang/parser/interface.go
  158. +64 −3 lang/parser/parser.go
  159. +2 −2 lang/parser/parser_test.go
  160. +1 −1 lang/parser/performance_test.go
  161. +4 −4 lang/printer/example_test.go
  162. +18 −2 lang/printer/nodes.go
  163. +2 −2 lang/printer/performance_test.go
  164. +2 −2 lang/printer/printer.go
  165. +3 −3 lang/printer/printer_test.go
  166. +2 −2 lang/scanner/errors.go
  167. +2 −2 lang/scanner/example_test.go
  168. +1 −1 lang/scanner/scanner.go
  169. +11 −1 lang/scanner/scanner_test.go
  170. +10 −0 lang/token/token.go
  171. +2 −2 lang/types/api.go
  172. +11 −3 lang/types/builtins.go
  173. +2 −2 lang/types/check.go
  174. +13 −5 lang/types/check_test.go
  175. +1 −1 lang/types/const.go
  176. +1 −1 lang/types/conversions.go
  177. +18 −2 lang/types/errors.go
  178. +333 −2 lang/types/expr.go
  179. +4 −4 lang/types/gcimporter.go
  180. +3 −3 lang/types/gcimporter_test.go
  181. +2 −2 lang/types/objects.go
  182. +72 −2 lang/types/operand.go
  183. +21 −0 lang/types/predicates.go
  184. +2 −2 lang/types/resolve.go
  185. +3 −3 lang/types/resolver_test.go
  186. +3 −3 lang/types/stmt.go
  187. +27 −0 lang/types/testdata/builtins_sx.src
  188. +36 −0 lang/types/testdata/conversions_sx.src
  189. +2 −2 lang/types/testdata/exports.go
  190. +156 −0 lang/types/testdata/expr0_sx.src
  191. +28 −1 lang/types/types.go
  192. +7 −3 lang/types/types_test.go
  193. +3 −2 lang/types/universe.go
View
@@ -8,7 +8,7 @@
package ast
import (
- "go/token"
+ "simplex.sh/lang/token"
"strings"
"unicode"
"unicode/utf8"
@@ -991,3 +991,31 @@ type Package struct {
func (p *Package) Pos() token.Pos { return token.NoPos }
func (p *Package) End() token.Pos { return token.NoPos }
+
+// ----------------------------------------------------------------------------
+// Simplex Views and Tables
+
+type (
+
+ // A ViewType node represents a view type.
+ ViewType struct {
+ View token.Pos // position of "view" keyword
+ Key Expr // primary key type or nil
+ Value Expr
+ }
+
+ // A TableType node represents a table type.
+ TableType struct {
+ Table token.Pos // position of "table" keyword
+ Key Expr // primary key type
+ Value Expr
+ }
+)
+
+func (x *ViewType) Pos() token.Pos { return x.View }
+func (x *ViewType) End() token.Pos { return x.Value.End() }
+func (*ViewType) exprNode() {}
+
+func (x *TableType) Pos() token.Pos { return x.Table }
+func (x *TableType) End() token.Pos { return x.Value.End() }
+func (*TableType) exprNode() {}
View
@@ -7,7 +7,7 @@ package ast
import (
"bytes"
"fmt"
- "go/token"
+ "simplex.sh/lang/token"
"sort"
)
@@ -107,7 +107,7 @@ type nodeStack []Node
//
func (s *nodeStack) push(n Node) {
s.pop(n.Pos())
- *s = append((*s), n)
+ *s = append(*s, n)
}
// pop pops all nodes that appear lexically before pos
@@ -9,9 +9,9 @@ package ast_test
import (
"bytes"
"fmt"
- . "go/ast"
- "go/parser"
- "go/token"
+ . "simplex.sh/lang/ast"
+ "simplex.sh/lang/parser"
+ "simplex.sh/lang/token"
"sort"
"testing"
)
@@ -48,9 +48,9 @@ func f1() {
/* associated with s1 */
s1()
// also associated with s1
-
+
// associated with s2
-
+
// also associated with s2
s2() // line comment for s2
}
View
@@ -6,9 +6,9 @@ package ast_test
import (
"fmt"
- "go/ast"
- "go/parser"
- "go/token"
+ "simplex.sh/lang/ast"
+ "simplex.sh/lang/parser"
+ "simplex.sh/lang/token"
)
// This example demonstrates how to inspect the AST of a Go program.
View
@@ -5,7 +5,7 @@
package ast
import (
- "go/token"
+ "simplex.sh/lang/token"
"sort"
)
@@ -151,6 +151,21 @@ func filterType(typ Expr, f Filter, export bool) bool {
return b1 || b2
case *ChanType:
return filterType(t.Value, f, export)
+
+ //=== start Simplex
+ case *ViewType:
+ if t.Key == nil {
+ return filterType(t.Value, f, export)
+ }
+ b1 := filterType(t.Key, f, export)
+ b2 := filterType(t.Value, f, export)
+ return b1 || b2
+ case *TableType:
+ b1 := filterType(t.Key, f, export)
+ b2 := filterType(t.Value, f, export)
+ return b1 || b2
+ //=== end Simplex
+
}
return false
}
View
@@ -5,7 +5,7 @@
package ast
import (
- "go/token"
+ "simplex.sh/lang/token"
"sort"
"strconv"
)
View
@@ -8,10 +8,10 @@ package ast
import (
"fmt"
- "go/token"
"io"
"os"
"reflect"
+ "simplex.sh/lang/token"
)
// A FieldFilter may be provided to Fprint to control the output.
Oops, something went wrong.

0 comments on commit c99e8d2

Please sign in to comment.