Age | Commit message (Collapse) | Author |
|
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
|
|
Also drops testing against go 1.12.x
|
|
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
|
|
Also, add test to ensure that new dependencies (such as golang.org/x/sys/unix)
are not added casually.
Fixes #320
|
|
Instead, the name of the built-in function is append to the
error message ("Error in foo: ...").
|
|
This is for consistency with the java.starlark.net implementation
and proposed spec.
This is a (minor) incompatible behavior change.
|
|
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.
|
|
Updates https://github.com/bazelbuild/starlark/issues/20
|
|
See spec change https://github.com/bazelbuild/starlark/issues/116
|
|
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.
|
|
|
|
|
|
We had a test, but the test was wrong.
Fixes issue #307
|
|
|
|
|
|
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
|
|
- 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
|
|
Fixes #296
|
|
|
|
See https://github.com/bazelbuild/starlark/issues/93
|
|
Also, enable the optimization on other POSIX platforms.
|
|
Fixes #285
|
|
Fixes #290
|
|
|
|
Fixes #111
|
|
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.
|
|
* 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.
|
|
This saves 22% of CPU cycles on one call-intensive benchmark.
|
|
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
Fixes https://github.com/google/starlark-go/issues/267
|
|
This issue got fixed a while back with the addition of ParseCompoundStatement.
|
|
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"
```
|
|
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
|
|
|
|
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
|
|
* clarify discussion of nil
* fix typo
|
|
Reduce cognitive burden to find documentation link
|
|
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.
|
|
* `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
|
|
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.
|
|
|
|
|
|
* .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.
|
|
|
|
Change-Id: I0d547e0cdc908b89250115805925f83fa2d87714
|
|
Change-Id: If04ab510bf0746191e05a55f4fa2911b36e845c9
|