| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
| |
Also add preconditions check.
RELNOTES: None.
PiperOrigin-RevId: 203731929
|
|
|
|
|
|
|
|
|
|
|
|
| |
The high level summary of the changes:
- use `Identifier` instead of `name` in `Keyword` and `Parameter`.
- construct `Identifier` through a factory method in case future interning is desired.
These changes are in preparation for using `Identifier` instead of `name` for environment lookups.
Closes #5304.
PiperOrigin-RevId: 199869171
|
|
|
|
|
|
|
|
|
|
|
|
| |
A bug in the lexer ignored indentation on the first line of a file. This now
causes an error.
Also, remove the COMMENT token from the lexer. Comments are now accessed separately. This will allow further optimizations in the lexer. It also aligns the code a bit more with the Go implementation.
RELNOTES[INC]:
Indentation on the first line of a file was previously ignored. This is now fixed.
PiperOrigin-RevId: 197889775
|
|
|
|
|
|
|
|
|
| |
Remove all references to `Token` (except one) in the parser. In particular,
remove the mechanism to push tokens back. This change will make possible for
the lexer to reuse tokens instead of allocating new objects each time.
RELNOTES: None.
PiperOrigin-RevId: 197585185
|
|
|
|
|
|
|
|
| |
With this change, the parser explicitly asks the lexer to give the next token.
To avoid changing the lexer too much, the tokenize() method populates a queue (it may add multiple tokens at the same time). While this reduces the peak memory usage, further work is needed to actually improve the performance.
RELNOTES: None.
PiperOrigin-RevId: 197576326
|
|
|
|
|
| |
RELNOTES: None
PiperOrigin-RevId: 186693205
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 185353994
|
|
|
|
|
|
|
|
| |
Blaze had its own class to avoid GC from varargs array creation for the precondition happy path. Guava now (mostly) implements these, making it unnecessary to maintain our own.
This change was almost entirely automated by search-and-replace. A few BUILD files needed fixing up since I removed an export of preconditions from lib:util, which was all done by add_deps. There was one incorrect usage of Preconditions that was caught by error prone (which checks Guava's version of Preconditions) that I had to change manually.
PiperOrigin-RevId: 175033526
|
|
|
|
|
|
|
| |
This used to be annoying for Skylint.
RELNOTES: none
PiperOrigin-RevId: 173249428
|
|
|
|
|
| |
RELNOTES: none
PiperOrigin-RevId: 173125138
|
|
|
|
|
|
|
| |
Previously, the closing parenthesis was not included in the location.
RELNOTES: none
PiperOrigin-RevId: 171527078
|
|
|
|
|
|
|
|
| |
Micro-optimize a few hot code paths which have a habit of iterating over short O(1)-access
lists.
RELNOTES: None
PiperOrigin-RevId: 171347524
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL doesn't fix all of the problems. The end location of blocks
after an if, elif, else and for is still wrong. (I added TODOs for them)
The latter is not easy to fix: One might think that one could just
set the end location of a block to the end location of the last
statement. However, if the last statement is a "pass" statement,
this is not preserved in the AST, in particular, there's no location
for it. In the future, we probably want to preserve "pass" statements.
RELNOTES: none
PiperOrigin-RevId: 170028466
|
|
|
|
|
|
|
| |
Mutiple other cleanups in the parser, update code documentation.
RELNOTES: None.
PiperOrigin-RevId: 167501136
|
|
|
|
|
|
|
|
| |
Let's use the same parser. Dialect differences are checked in a separate
validation pass.
RELNOTES: None.
PiperOrigin-RevId: 167280201
|
|
|
|
|
|
|
|
| |
This is an internal refactoring necessary for the Skylark linter.
It does not change any behavior.
RELNOTES: None
PiperOrigin-RevId: 166199367
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 166058718
|
|
|
|
|
|
|
|
| |
This allows more complex expressions to be called, not just identifiers.
For example, "x[0]()" is not a syntax error anymore.
RELNOTES: None
PiperOrigin-RevId: 165157981
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 164981071
|
|
|
|
|
|
|
| |
No need for the intermediate collection/objects when we can go direct to ImmutableList,
which has a good chance of doing something more efficient anyway...
PiperOrigin-RevId: 164294883
|
|
|
|
|
|
|
|
|
| |
- changed field names and a couple accessors to consistently use full words ("statement" instead of "stmt")
- applied several local analyzers (from IntelliJ) to remove redundant modifiers, unnecessary explicit types (yay Java 8), etc.
RELNOTES: None
PiperOrigin-RevId: 161551096
|
|
|
|
|
|
|
|
| |
This is an incompatible change, but it's an obvious bug.
RELNOTES[INC]: Fixed a bug whereby multiple load() statements could appear on the same line
PiperOrigin-RevId: 161070399
|
|
|
|
|
|
|
| |
RELNOTES[INC]:
`load` is now a language keyword, it cannot be used as an identifier
PiperOrigin-RevId: 160944121
|
|
|
|
|
|
|
| |
With a few manual fixes for readability.
RELNOTES: None.
PiperOrigin-RevId: 160582556
|
|
|
|
|
| |
RELNOTES: None.
PiperOrigin-RevId: 160516183
|
|
|
|
|
|
|
| |
This simplifies parsing a lone statement or expression in unit tests.
RELNOTES: None
PiperOrigin-RevId: 160276410
|
|
|
|
|
|
|
| |
This unifies unary minus with NotExpression, and moves the minus logic from a fake builtin function into the interpreter proper.
RELNOTES: None
PiperOrigin-RevId: 160266266
|
|
|
|
|
|
|
|
|
|
|
|
| |
I'm not using a --incompatible-change flag because it's not available in the
parser. We could pass it, but I think this is trivial to fix and unlikely to
happen in real code (if it does, there was most likely a bug).
RELNOTES[INC]:
Operators for equality, comparison, 'in' and 'not in' are no longer associative,
e.g. x < y < z is now a syntax error. Before, it was parsed as: (x < y) < z.
PiperOrigin-RevId: 159422042
|
|
|
|
|
|
|
|
|
|
|
| |
This affects only the tuple that appears after 'if' inside a list
comprehension. Since a truth value is expected, it's very unlikely to break
existing code. It's technically a breaking change, but it's not worth
introducing a flag for this.
RELNOTES:
Parentheses around the tuple are now mandatory in [a for b in c if 1, 2]
PiperOrigin-RevId: 159218397
|
|
|
|
|
|
|
| |
Added public visibility to some constructors/accessors, and made child LValue nodes explicitly constructed by the caller rather than hidden inside constructors. This makes it easier to treat nodes as uniform dumb values. Also added some helpers.
RELNOTES: None
PiperOrigin-RevId: 158761415
|
|
|
|
|
|
|
|
| |
In both Python 2 and Python 3, the operator // is used for int division.
With Python 3, operator / is for float division.
RELNOTES: None.
PiperOrigin-RevId: 156582262
|
|
|
|
|
|
|
|
|
|
| |
* Cleanup ForClause and IfClause to be static classes
* Add missing/non-visible accessors and constructors
* Make use of final modifiers more consistent
* Make LValue an ASTNode.
RELNOTES: None
PiperOrigin-RevId: 156050683
|
|
|
|
|
|
|
|
|
|
| |
We currently have no need to discern between strings quoted with ' or ". While it could be
nice for something one day (and may have been in the past), it's yagni now. Removing the
distinction simplifies string concatenation.
--
PiperOrigin-RevId: 148273400
MOS_MIGRATED_REVID=148273400
|
|
|
|
|
|
|
|
|
|
| |
RELNOTES[INC]:
Tuples that end with a trailing comma must now be inside parens,
e.g. (1,) instead of 1,
--
PiperOrigin-RevId: 144690953
MOS_MIGRATED_REVID=144690953
|
|
|
|
|
|
| |
--
PiperOrigin-RevId: 142438943
MOS_MIGRATED_REVID=142438943
|
|
|
|
|
|
|
|
|
|
| |
- Move break/continue check from ValidationEnvironment to the Parser
- Remove some differences between BUILD / Skylark parsing mode
- Fix location off-by-one error in the break/continue tokens
- Remove duplicated error message ('for loops are not allowed on top-level')
--
MOS_MIGRATED_REVID=137259929
|
|
|
|
|
|
|
|
|
|
| |
Use StringLiteral instead of String+Location. This improves consistency.
getRawImports() now returns StringLiterals, which makes possible to show
location in error messages.
--
MOS_MIGRATED_REVID=136019586
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=135816105
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=135784854
|
|
|
|
|
|
|
| |
It was unused in Bazel.
--
MOS_MIGRATED_REVID=135483937
|
|
|
|
|
|
|
| |
function calls.
--
MOS_MIGRATED_REVID=133259901
|
|
|
|
|
|
|
| |
This allow us to skip the import validation in non-build usages.
--
MOS_MIGRATED_REVID=130936612
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=129313959
|
|
|
|
|
|
|
|
| |
The goal is to remove parse and eval functions from Environment, as well as
isSkylark boolean.
--
MOS_MIGRATED_REVID=129202204
|
|
|
|
|
| |
--
MOS_MIGRATED_REVID=128699330
|
|
|
|
|
|
|
|
|
| |
based on my limited understanding of python syntax, the only things we don't support is //= and **=, but it looks like skylark doesn't support the corresponding infix operators.
RELNOTES[NEW]: add support for the '-=', '*=', '/=', and'%=' operators to skylark. Notably, we do not support '|=' because the semantics of skylark sets are sufficiently different from python sets.
--
MOS_MIGRATED_REVID=123889776
|
|
|
|
|
|
|
| |
single else statement.
--
MOS_MIGRATED_REVID=119260729
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
e.g. a['key'] = value
is handled through a proper lvalue, instead of using syntactic sugar.
Benefits include:
- better error messages (reference to the '+' operator was cryptic)
- more robust, e.g. it is compatible with the += operator
- can be used in a tuple, e.g. a[1], a[2] = 3, 4
- it is a step towards mutable dict
--
MOS_MIGRATED_REVID=111597545
|
|
|
|
|
|
|
| |
for use in tools.
--
MOS_MIGRATED_REVID=111142252
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
files in external repositories.
In addition:
- Cleaned up and refactored some tests to reflect the new loading behavior.
Deferred to future CLs:
- Updating Bazel Skylark documentation to reflect the new load form.
- Enabling command-line loading of Aspects via labels.
RELNOTES: Skylark load statements may now reference .bzl files via build labels, in addition to paths. In particular, such labels can be used to reference Skylark files in external repositories; e.g., load("@my_external_repo//some_pkg:some_file.bzl", ...). Path-based loads are now deprecated and may be disabled in the future. Caveats: Skylark files currently do not respect package visibility; i.e., all Skylark files are effectively public. Also, loads may not reference the special //external package.
--
MOS_MIGRATED_REVID=110786452
|