aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-03-05eval: document that Thread.Locals are accessible to Go, not Skylark (#78)alandonovan
2018-03-05string: rename {split_,}bytes methods to {split_,}elems (#77)alandonovan
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.
2018-03-02syntax: add (*LoadStmt).ModuleName accessor method, for convenience (#76)alandonovan
2018-02-28skylarkstruct: implement to_proto (#73)alandonovan
2018-02-26Revert "eval: remove deprecated dict+dict operator (#54)" (#71)alandonovan
This reverts commit 345cac49c6fe34e03558fbc9c7413401ede9252: This operator is deprecated but still widely used by Bazel.
2018-02-26getattr: return the default value if Attr returns an error (#72)alandonovan
But return the original error if there was no default. This is analogous to what #69 did for hasattr.
2018-02-26eval: allow 'list += x' where x is not iterable but defines list+x (#70)alandonovan
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.
2018-02-26skylarkstruct: several fixes (#69)alandonovan
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.
2018-02-26eval: add comment on Thread.Load (#66)alandonovan
2018-02-26testdata/int: add testcase (#67)alandonovan
* testdata/int: add testcase * Update int.sky
2018-02-26testdata/string: add len testcase (#68)alandonovan
2018-02-26Add new node ParenExpr (#65)Laurent Le Brun
This is a no-op for the interpreter, but it adds more information to the AST.
2018-02-22Attach comments to AST nodes. (#64)Laurent Le Brun
* 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)
2018-02-09Update grammar (#61)Laurent Le Brun
* Update spec Octal numbers syntax + fix bugs in grammar * Update grammar.txt
2018-01-22Syntax: support multiprecision integer literals (#58)Mohamed Elqdusy
* 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
2018-01-16parser: fix precedence of nested 'if' clauses in list comprehensions (#55)alandonovan
* 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
2018-01-10remove extra "was" (#56)Shan Gao
2018-01-08Support binary integers: 0b1101 literals and int("0b1101", 0) (#52)Mohamed Elqdusy
* 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
2018-01-08eval: remove deprecated dict+dict operator (#54)alandonovan
2017-12-31README: -lambda flag no longer needed by examplealandonovan
2017-12-22repl: factor the REPL into a separate package (#50)alandonovan
...so that users can build REPLs for their dialects. Also, add support for interrupting the REPL with Control-C.
2017-11-29Fix typo (#47)Yusei Yamanaka
2017-11-28string.format: handle "}}" and "{-0}" correctly (#46)alandonovan
Fixes #18
2017-11-28resolve: add missing check for order of parameters and argumentsAlan Donovan
Parameters: required before optional Arguments: positional before named
2017-11-16remove executable accidentally committed (#43)Alan Donovan
2017-11-10REPL: add welcome message with doc URL (#41)alandonovan
2017-11-10universe: remove freeze(x) built-in function (#42)alandonovan
It's still useful for testing though, so we move it to assert.sky.
2017-11-10fix vet errors revealed by tip "go test" (#40)alandonovan
2017-11-10doc/spec.md: minor correctionsAlan Donovan
Change-Id: Id97fe5a8b23417ce2d9d2f61e296a8668b3227b1
2017-11-10implement readline in repl (#39)Daniel, Dao Quang Minh
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
2017-11-01string.{,r}split: make sep=None behave like Python (#35)alandonovan
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.
2017-10-31Reverse split (#23)Garrett Squire
2017-10-27syntax: fix scanner position reporting (#34)Ariel Mashraki
2017-10-20print: the application determines what happens to print's output (#32)alandonovan
Change-Id: I0f2e4a1e82ace67a91a56e1a091acad757e4583c
2017-10-20syntax: make 'load' a reserved word (#31)alandonovan
* syntax: make 'load' a reserved word
2017-10-19builtin: rename type to "builtin_function_or_method" (#30)alandonovan
* 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).
2017-10-19set: in x|y, require that y is a set if x is a set (#29)alandonovan
The old functionality can still be accessed using x.union(y).
2017-10-18skylark: zip: support iterables of unknown length (#24)kostya-sh
2017-10-18sorted, cmp: follow Python-3 (#28)alandonovan
- remove Python-2 sorted(cmp=....) parameter - add Python-3 sorted(key=...) parameter - remove 'cmp' builtin, following Python-3 - use a stable sort
2017-10-18skylark: range(...) no longer materializes the sequence as a list (#25)alandonovan
* 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
2017-10-17doc comments: refer to specification of Skylark, not Bazel or Python (#26)alandonovan
2017-10-17skylark: do not leave zip arguments frozen (#5)kostya-sh
2017-10-16doc/impl.md: minor tweaksAlan Donovan
Change-Id: Ia29620117cacd3d2b444a1bd9bc1694f6780b1db
2017-10-11Fix tiny vet error (#20)Jay Conrod
2017-10-11parser: clarify comment re: NEWLINE (#14)alandonovan
2017-10-11UnpackArgs: permit parameters of user-defined Value subtypes (#12)alandonovan
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
2017-10-11cmd/skylark: process a single-line load statement without delay (#13)alandonovan
2017-10-11resolve: clarify is{PredeclaredGlobal,Builtin} parameters (#11)alandonovan
* 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
2017-10-10Merge branch 'master' of https://github.com/google/skylarkAlan Donovan
Change-Id: I1e3a3eb05cddf13d7684fa546acf60ebbb2b8786
2017-10-10README: add Travis CI linkAlan Donovan
Change-Id: I81a57e5cf74001bd39a79aa4cde811329e1c6ef0