aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-08lib/proto: a Starlark package for protobuf processing (#318)alandonovan
This change defines an optional Starlark module for encoding and decoding protocol buffers (https://developers.google.com/protocol-buffers/). It adds a dependency on google.golang.org/protobuf. No promises of API stability yet: there are a number of TODOs to be resolved and questions to be answered first, but I would like to get this into the hands of the community. See discussion in https://github.com/stripe/skycfg/issues/23. Fixes #309
2020-12-04ci: Add support for go 1.15.x to .travis.yml (#325)Tim Bart
Also drops testing against go 1.12.x
2020-12-02starlark: add parameter to bench_xyz(b) benchmark functions (#323)alandonovan
The parameter is a wrapper around a testing.B, that provides the number of iterations and start/stop/reset methods. It follows the design used in java.starlark.net; see https://github.com/bazelbuild/starlark/pull/75#pullrequestreview-275604129 https://github.com/bazelbuild/bazel/commit/146cd2cecae52ebad6664046fd1430c2a23b55e1
2020-11-18starlark: use portable syscall wrapper for mmap (#321)alandonovan
Also, add test to ensure that new dependencies (such as golang.org/x/sys/unix) are not added casually. Fixes #320
2020-11-18starlark: skip last frame of stack backtrace if built-in (#319)alandonovan
Instead, the name of the built-in function is append to the error message ("Error in foo: ...").
2020-11-13starlarkjson: sort dict keys (#316)alandonovan
This is for consistency with the java.starlark.net implementation and proposed spec. This is a (minor) incompatible behavior change.
2020-11-13starlark: disallow keyword argument after *args (#317)alandonovan
f(*args, k=v) is a now an error. Use f(k=v, *args). Arguments are evaluated left-to-right, as in Python2 (but not Python3). See https://github.com/bazelbuild/starlark/issues/13 for spec change.
2020-11-11spec: remove stale implementation notes (#315)alandonovan
Updates https://github.com/bazelbuild/starlark/issues/20
2020-11-11starlark: disallow None < None comparisons (#314)alandonovan
See spec change https://github.com/bazelbuild/starlark/issues/116
2020-11-11starlark: bring floating-point into spec compliance (#313)alandonovan
This change makes go.starlark.net's floating-point implementation match the proposed spec (see https://github.com/bazelbuild/starlark/pull/119), and thus much more closely match the behavior of the Java implementation. The major changes are: - Float values are totally ordered; NaN compares greater than +Inf. - The string form of a finite float value always contains an exponent or a decimal point, so they are self-evidently not int values. - Operations that would cause a large integer to become rounded to an infinite float are now an error. The resolve.AllowFloat boolean, and the corresponding -float command-line flag, now have no effect. Floating point support is always enabled.
2020-10-26Initial empty repositoryInna Palant
2020-10-14spec: fix typo in raw string example (#311)alandonovan
2020-10-06starlark: fix float % float bug (#308)alandonovan
We had a test, but the test was wrong. Fixes issue #307
2020-09-29fix: add special case error when a parameter/index overflows int (#305)tdakkota
2020-09-01spec: clarify resolution of undefined names (#303)alandonovan
2020-08-21starlark: support thread cancellation and limits on computation (#298)alandonovan
This change adds two related features: (1) asynchronous cancellation of Starlark threads (Thread.Cancel), and (2) recording and limiting of the number of abstract computation steps. Fixes issue #252 Fixes issue #160
2020-08-04spec: clarify scope rules for comprehensions (#299)alandonovan
- first loop operand is resolved in enclosing environment - all loop vars are bound before any expression is resolved See https://github.com/bazelbuild/starlark/issues/84
2020-07-23fix: mmap failure on linux after the android fix (#297)Felix Yan
Fixes #296
2020-07-22fix: cause `mmap: bad file descriptor` on android (#295)Kr328
2020-07-21starlark: permit assigments to () and [] (#294)alandonovan
See https://github.com/bazelbuild/starlark/issues/93
2020-07-06starlark: use syscall.Mmap to avoid golang.org/x/sys dependency (#287)alandonovan
Also, enable the optimization on other POSIX platforms.
2020-07-06starlarktest: fix typo in comment (#288)alandonovan
Fixes #285
2020-07-06starlark: disable int optimization in iOS, which doesn't support mmap (#291)alandonovan
Fixes #290
2020-07-06starlark: fix typo in UnpackArgs doc commentalandonovan
2020-07-06starlark: add examples of UnpackArgs (#289)alandonovan
Fixes #111
2020-06-19starlark: fix tests for 386 (#283)alandonovan
The recent int change didn't compile on 386. Fixed. Thanks to user @anyktx for pointing this out. Also, tests of string * int and tuple * int printed a bad error message containing an integer overflow. Now fixed.
2020-06-17int: reduce allocation by representing small ints as pointers (#280)alandonovan
* int: consolidate field accessors This change defines low-level accessors for the small and big arms of the int union so that the representation can be easily changed in a follow-up. Change-Id: I7c4ae279a6d2e7b76e102ba5d01a3cd1c56fb368 * int: improve performance by avoiding allocation This change defines a new representation for Int on 64-bit machines running a POSIX operating system, by reserving a 4GB portion of the address space. Pointers to addresses in this region represent int32 values, and are disjoint from all *big.Int pointers, allowing us to represent the union in a single pointer. This means the conversion from Int to Value does not allocate. The gauss benchmark (added in this CL) shows -40% ns, -48% bytes, -63% allocs: Benchmark/bench_gauss-12 84 13648744 ns/op 3175816 B/op 105862 allocs/op (before) Benchmark/bench_gauss-12 55 24283703 ns/op 6119844 B/op 289862 allocs/op (after) On 32-bit machines, or those running a non-POSIX system, we continue to use the old representation.
2020-06-17Avoid defensive copy in CALL operator when callee is a Starlark function (#281)alandonovan
This saves 22% of CPU cycles on one call-intensive benchmark.
2020-06-15Test with Go 1.14 (#269)Alexey Palazhchenko
2020-06-15syntax: permit \" and \' escapes in both "..." and '...' literals (#279)alandonovan
Clarify spec on this issue. Fixes https://github.com/google/starlark-go/issues/278 Also, fix semantic merge conflict in testdata/json.star tests that relied on "\u" being interpreted as "\\u", causing tests to fail.
2020-06-11starlarkjson: a standard JSON module for Starlark (#179)alandonovan
This change defines a standard Starlark module for JSON encoding and decoding. See json.go for documentation. It is intended to subsume, generalize, and eventually replace Bazel's ill-conceived struct.to_json method. The json module is predeclared in the Starlark REPL environment. See related issues: https://github.com/bazelbuild/bazel/issues/7896 https://buganizer.corp.google.com/issues/23962735 https://buganizer.corp.google.com/issues/70210417 https://github.com/bazelbuild/bazel/issues/7879#issuecomment-477713954 https://github.com/bazelbuild/bazel/issues/5542 https://github.com/bazelbuild/bazel/issues/10176 https://github.com/bazelbuild/starlark/pull/83 https://github.com/bazelbuild/bazel/issues/3732
2020-06-11starlark: work around vet false positive (#277)alandonovan
The stringintconv checker added in https://go-review.googlesource.com/c/tools/+/235797 requires an explicit rune type for the operand of a string(int) conversion.
2020-06-09spec: load statements may not be nested in any other statement (#276)alandonovan
This is a potentially breaking language change, but I suspect few users care. If you are one of them, please report the issue. Fixes https://github.com/google/starlark-go/issues/275
2020-05-19Support for type-specific unpack logic (#272)Nick Santos
Fixes https://github.com/google/starlark-go/issues/267
2020-03-29repl: remove stale TODOalandonovan
This issue got fixed a while back with the addition of ParseCompoundStatement.
2020-03-26syntax: fix scanString bug affecting REPL (#266)alandonovan
Prior to this change, the REPL incorrectly scanned regular and raw string literals containing newlines because scanString falsely assumed that only triple-quoted strings can span lines. ``` >>> 'a\ ... b' <stdin>:1:2: string literal has invalid quotes >>> r'a ... b' <stdin>:1:2: string literal has invalid quotes ``` Now it does the right thing: ``` >>> 'a\ ... b' "ab" >>> r'a\ ... b' "a\\\nb" ```
2020-03-26syntax: strict string escapes (#265)alandonovan
This change causes Starlark, like Go, to reject backslashes that are not part of an escape sequence. Previously they were treated literally, so \ ( would encode a two-character string. Many programs rely on this, especially for regular expressions and shell commands, and will be broken by this change, but the fix is simple: double each errant backslash. Python does not yet enforce this behavior, but since 3.6 has emitted a deprecation warning for it. Also, document string escapes. Related issues: - Google issue b/34519173: "bazel: Forbid undefined escape sequences in strings" - bazelbuild/starlark#38: Starlark spec: String escapes - bazelbuild/buildtools#688: Bazel: Fix string escapes - bazelbuild/bazel#8380: Bazel incompatible_restrict_string_escapes: Restrict string escapes
2020-03-06starlark: built-in types map of *Builtin (#264)Edward McFarlane
2020-03-05syntax: permit trailing commas in all function defs and calls (#263)alandonovan
Following Python3 and Starlark-in-Java, this change causes the parser not to reject a trailing comma, even after *args or **kwargs, in function definitions and function calls. Fixes #256
2020-02-03clarify discussion of nil (#262)alandonovan
* clarify discussion of nil * fix typo
2020-02-03Add godoc documentation badge (#261)Paul Cody Johnston
Reduce cognitive burden to find documentation link
2020-01-25Move Travis CI badge to the top of file [skip ci] (#257)Misha Brukman
Travis CI is more of a status badge, not an aspect of documentation, and is often kept at the top of the project's README, together with other badges, such as Go Report Card, etc., which don't belong in the "documentation" section.
2020-01-25Fix ineffective assignments (#258)Misha Brukman
* `return nil, err` after assigning to `err` (rather than ignoring it) * removed initialization of a variable just before it's re-assigned Both of these issues were found in the Go Repord Card: https://goreportcard.com/report/github.com/google/starlark-go#ineffassign
2020-01-25Also run tests with Go 1.12.x and 1.13.x (#259)Misha Brukman
The current setup only runs tests with Go 1.11.x and the latest source code on the `master` branch, but is not running the more recent releases 1.12.x and 1.13.x which may be widely in use. This change includes both of those versions as well.
2019-12-27Add syntax highlighting to the readme file (#255)Artur Dryomov
2019-12-18spec: document string conversion differencesalandonovan
2019-12-02.travis.yml: test that module is tidy (#254)Jay Conrod
* .travis.yml: test that module is tidy Removed "sudo: false". It has no effect. Set GO111MODULE=on explicitly, which is needed in go1.11 but not in later versions. Added explicit test script. * 'go test -mod=readonly ./...' will report an error if go.mod or go.sum is incomplete, since no requirements may be added with -mod=readonly. * The rest of the script checks that go.mod and go.sum do not change after running 'go mod tidy'. This verifies that there are no redundant requirements or sums to remove. Changed minimum Go version to 1.11.x. This is the oldest version with support for modules. Older versions will still work in GOPATH mode, but versions lower than 1.12 are unsupported by the Go, so there's little point in adding additional test code for them.
2019-12-02go.mod: init Go module (#243)Koichi Shiraishi
2019-12-01spec: document 3-arg getattralandonovan
Change-Id: I0d547e0cdc908b89250115805925f83fa2d87714
2019-11-27doc: three minor tweaks to specalandonovan
Change-Id: If04ab510bf0746191e05a55f4fa2911b36e845c9