Age | Commit message (Collapse) | Author |
|
|
|
This finesses the question of what the element type of a string is,
allowing us to add a similarly named method to the Java implementation
that returns UTF-16 codes.
|
|
|
|
|
|
This reverts commit 345cac49c6fe34e03558fbc9c7413401ede9252:
This operator is deprecated but still widely used by Bazel.
|
|
But return the original error if there was no default.
This is analogous to what #69 did for hasattr.
|
|
This is the case for Bazel's depset
(although it really ought to be iterable).
Added regression test using hasfields, which is noniterable but
defines list+hasfields rather arbitraily.
Also: improve UnpackArgs failure when argument is a pointer.
|
|
Details:
- hasattr: an error result from Attr does not reliably indicate that
an attribute was missing. Fall back to checking AttrNames in that case.
- to_{json,proto}: propagate errors correctly.
- Include the constructor value (if nondefault) in the
no-such-attribute error message. It is crucial for debugging.
- to_json: quote strings correctly.
- Added very basic tests of skylarkstruct, in Skylark.
|
|
|
|
* testdata/int: add testcase
* Update int.sky
|
|
|
|
This is a no-op for the interpreter, but it adds more information to the
AST.
|
|
* Attach comments to AST nodes.
This feature is off by default. More testing will be needed before
exposing it to the ParseFile function.
Logic is copied from Buildifier (https://github.com/bazelbuild/buildtools/tree/master/build).
bug #63
* Fix tests by saving the state of 'blank' in the scanner.
* - Rename flattenAST
- Add new argument to the Parser and the Scanner
- Update tests
* Remove global constant keepComments
* Update more tests (new argument to the parser)
* Add CommentsRef to allow allocating comments
Address a few other issues
* Remove the COMMENT tokens
Parser won't see COMMENT tokens anymore. The list is kept by the
scanner. This simplifies the code and reverts some of my previous
changes.
* Address review comments
* - Removed the .Suffix boolean
- Renamed CommentsRef to commentsRef
- Simplified assignComments function (reversing was not useful)
* assignComments leaves early if there is no comments
+ address other review comments
* Address review comments (for -> if, removed useless code about suffix comments)
|
|
* Update spec
Octal numbers syntax + fix bugs in grammar
* Update grammar.txt
|
|
* Syntax: support multiprecision integer literals
* Using INT token type for both cases
the parser is handling int64 and *big.Int values as a token of the type INT
* Tests for bigInt
* Testing large integer literals
* Deleting some comments
* Fixing a space
|
|
* parser: fix precedence of nested 'if' clauses in list comprehensions
Before, the parser would consume an arbitrary expression after the
'if' even though it should reduce after x in
[a for b in c if x if y else z]
Now it consumes only a precedence zero ("or"-level) expression.
The parser similarly reduces after x when parsing
[a for b in c if lambda: x if y else z]
* fix three comment typos
|
|
|
|
* Support binary integers: 0b1101 literals and int("0b1101", 0)
* Specification and tests for binary integers
Adding documentation for bnary integers in spec.md.
Adding tests for syntax/scan_test.go (for the scanner) and testdata/int.sky for the int(x) function.
* Correct some test cases in syntax/scan_test.go
* Correct a test case in testdata/int.sky
|
|
|
|
|
|
...so that users can build REPLs for their dialects.
Also, add support for interrupting the REPL with Control-C.
|
|
|
|
Fixes #18
|
|
Parameters: required before optional
Arguments: positional before named
|
|
|
|
|
|
It's still useful for testing though, so we move it to assert.sky.
|
|
|
|
Change-Id: Id97fe5a8b23417ce2d9d2f61e296a8668b3227b1
|
|
The current skylark repl doesnt have readline capability that is familiar when
using other repl such as python. This leverages github.com/chzyer/readline to
support that
|
|
The cases for sep=None and explicit separators should use different
algorithms, as Python does. Make this explicit, and add tests and
documentation. The code is actually simpler for it.
This also fixes a test breakage introduced by d6768aa.
|
|
|
|
|
|
Change-Id: I0f2e4a1e82ace67a91a56e1a091acad757e4583c
|
|
* syntax: make 'load' a reserved word
|
|
* builtin: rename type to "builtin_function_or_method"
Also:
- remove all uses of "builtin" as a noun.
Now it's always "built-in function" (or method).
Change-Id: I2c81bb19800c40ed0f781b77449baa63333cb5e7
* set: in x|y, require that y is a set if x is a set (#29)
The old functionality can still be accessed using x.union(y).
* type: clarify difference from Java
Change-Id: If36d4c5e97bb48c088356a7b538d4db0c165054c
* builtin: rename type to "builtin_function_or_method"
Also:
- remove all uses of "builtin" as a noun.
Now it's always "built-in function" (or method).
|
|
The old functionality can still be accessed using x.union(y).
|
|
|
|
- remove Python-2 sorted(cmp=....) parameter
- add Python-3 sorted(key=...) parameter
- remove 'cmp' builtin, following Python-3
- use a stable sort
|
|
* skylark: range(...) no longer materializes the sequence as a list
Skylark now follows the Python3, not Python2, semantics for range.
Also: fix an off-by-one error.
* range: allow membership tests 'x in range(n)'
Change-Id: I0dffe70510f723c00da4153bcc0a17478cceb986
* range: allow floating point numbers for x in 'x in range(y)'
- use ConvertToInt to convert x to an integer.
- change ConvertToInt not to accept a bool. This affects string interpolation.
e.g. "%d" % True now (correctly) results in an error.
- rename ConvertToInt to NumberToInt
Change-Id: Ie9e9d40d993c227b834bb720e5dbe3714032836a
* range: doc tweaks
Change-Id: I3f242d38a5969fa228167b72be6cb78aa4677eb6
|
|
|
|
|
|
Change-Id: Ia29620117cacd3d2b444a1bd9bc1694f6780b1db
|
|
|
|
|
|
We use reflection to assign the actual value to the parameter variable.
It is a fatal error if the parameter variable is not a skylark.Value.
Fixes issue google/skylark#8
|
|
|
|
* resolve: clarify is{PredeclaredGlobal,Builtin} parameters
- document these parameters
- rename isBuiltin to isUniversal to avoid overloading 'builtin' (as in functions)
- export StringDict.Has method, and simplify.
Change-Id: I3b9396b879be960c08c3200fe1f6a2ac683d66e0
* resolve: fix typo
Change-Id: Id5b88f5dcf55ed4733b74990419ef7cfcacfae2c
|
|
Change-Id: I1e3a3eb05cddf13d7684fa546acf60ebbb2b8786
|
|
Change-Id: I81a57e5cf74001bd39a79aa4cde811329e1c6ef0
|