aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/syntax/Parser.java
Commit message (Collapse)AuthorAge
* Rollback of commit 4e5037520e3067f9d8784e1c59f9545b96111cd4.Gravatar Lukacs Berki2015-09-17
| | | | | | | | | | | | | | | | | *** Reason for rollback *** Broke tests, I mistakenly assumed it was flakiness. *** Original change description *** Remove support for the deprecated include() statement. This is part of the crusade to eliminate as every dependency in Skylark on the rest of the code so that it can be moved deeper in the dependency graph. RELNOTES: The include() statement in BUILD files is not supported anymore. -- MOS_MIGRATED_REVID=103284257
* Remove support for the deprecated include() statement.Gravatar Lukacs Berki2015-09-17
| | | | | | | | | This is part of the crusade to eliminate as every dependency in Skylark on the rest of the code so that it can be moved deeper in the dependency graph. RELNOTES: The include() statement in BUILD files is not supported anymore. -- MOS_MIGRATED_REVID=103279943
* Parse the label syntax "@//a:b" so that eventually we can make that the ↵Gravatar Lukacs Berki2015-09-15
| | | | | | | | | syntax that means "refer to the main repository". There isn't an overarching plan for what we are going to do with the cmdline package, which seems to be separated from the .syntax one in all sorts of awkward ways. -- MOS_MIGRATED_REVID=103088960
* Remove dead code, set private visibilityGravatar Laurent Le Brun2015-09-14
| | | | | -- MOS_MIGRATED_REVID=102986851
* Allow tuples inside square brackets (for list/dict indexing).Gravatar Laurent Le Brun2015-09-11
| | | | | -- MOS_MIGRATED_REVID=102841541
* LoadStatement: Keep the location of the path argument.Gravatar Laurent Le Brun2015-09-11
| | | | | -- MOS_MIGRATED_REVID=102743954
* Fix bug in the parser when a block was silently skipped.Gravatar Laurent Le Brun2015-09-11
| | | | | | | Some cosmetic changes with EnumSets. -- MOS_MIGRATED_REVID=102742596
* Keep function parameters in the AST.Gravatar Laurent Le Brun2015-09-04
| | | | | -- MOS_MIGRATED_REVID=102330569
* Fix a bug in SyntaxTreeVisitor to handle return statements.Gravatar Laurent Le Brun2015-09-03
| | | | | -- MOS_MIGRATED_REVID=102237430
* Add profiling for Skylark lexer, parser, user- and built-in functions.Gravatar Googler2015-08-28
| | | | | -- MOS_MIGRATED_REVID=101769963
* Introduce '|' operator for set union.Gravatar Laurent Le Brun2015-08-25
| | | | | -- MOS_MIGRATED_REVID=101363350
* Allow return without expression, AST-equivalent to return None.Gravatar Googler2015-08-11
| | | | | -- MOS_MIGRATED_REVID=100268427
* Skylark: load() allows the loading of symbols via an alias.Gravatar Florian Weikert2015-07-27
| | | | | | | E.g. load("/foo/bla", my_rule = "old_name") will introduce the symbol "my_rule" as an alias for "old_name". -- MOS_MIGRATED_REVID=98933635
* Renamed Ident to Identifier, added some helper methods and refactored two ↵Gravatar Florian Weikert2015-07-23
| | | | | | | methods. -- MOS_MIGRATED_REVID=98922811
* Invalid double slashes in load statements are now also discovered in BUILD modeGravatar Florian Weikert2015-07-10
| | | | | -- MOS_MIGRATED_REVID=97951248
* Make globs work in remote repositories.Gravatar Lukacs Berki2015-07-08
| | | | | | | | | | | This involved quite a few changes, mainly changing a bunch of places where we refer to packages by a PathFragment to PackageIdentifier. The only wart is the code in PathPackageLocator: ideally, it would just call into PackageLookupFunction. Unfortunately, it is (through globbing and Parser.include) called from within a Skyframe function, and we don't want to have two eval() calls going on at the same time, so we cannot use that. There is a potential correctness issue there: PathPackageLocator now assumes where external repositories are put and assumes that they are there when it gets control, but my understanding is that the associated RepositoryValue is always evaluated before, so it works out okay. -- MOS_MIGRATED_REVID=97751539
* Rollback of accidentally submitted change.Gravatar Lukacs Berki2015-07-07
| | | | | -- MOS_MIGRATED_REVID=97648982
* Make globs work in remote repositories.Gravatar Lukacs Berki2015-07-07
| | | | | | | | | | | This involved quite a few changes, mainly changing a bunch of places where we refer to packages by a PathFragment to PackageIdentifier. The only wart is the code in PathPackageLocator: ideally, it would just call into PackageLookupFunction. Unfortunately, it is (through globbing and Parser.include) called from within a Skyframe function, and we don't want to have two eval() calls going on at the same time, so we cannot use that. There is a potential correctness issue there: PathPackageLocator now assumes where external repositories are put and assumes that they are there when it gets control, but my understanding is that the associated RepositoryValue is always evaluated before, so it works out okay. -- MOS_MIGRATED_REVID=97647787
* Update parser error message.Gravatar Laurent Le Brun2015-06-30
| | | | | -- MOS_MIGRATED_REVID=97224936
* Fix NullPointerException in parser.Gravatar Laurent Le Brun2015-06-16
| | | | | | | Location was not set. -- MOS_MIGRATED_REVID=96096088
* Skylark: Forbid break/continue in BUILD files.Gravatar Laurent Le Brun2015-06-16
| | | | | -- MOS_MIGRATED_REVID=96095253
* Skylark: First argument of load() may no longer start with two slashes ("//")Gravatar Florian Weikert2015-06-15
| | | | | -- MOS_MIGRATED_REVID=95833265
* Remove Path from Location, ParserInputSource and bunch of other low-level ↵Gravatar Lukacs Berki2015-06-12
| | | | | | | | | | | | | | | | | classes. This makes the code cleaner because a lot of places never read the file and thus never needed a Path in the first place. I got to this change in a bit convoluted way: - I wanted the default tools in Android rules to point to //external: - I wanted to make sure that that doesn't cause an error is no Android rules are built, thus I had to add some binding for them in the default WORKSPACE file - I wanted the Android rules not to depend on Bazel core with an eye towards eventually moving them to a separate jar / Skylark code - The default WORKSPACE file is currently composed from files extracted by the Bazel launcher which would make the Android rules depend on a very core mechanism - I couldn't simply pass in jdk.WORKSPACE as a String because Location, ParserInputSource and a bunch of other things needed a Path, which a simple string doesn't have. Thus, this change. -- MOS_MIGRATED_REVID=95828839
* Skylark: implemented 'break' and 'continue'Gravatar Florian Weikert2015-06-10
| | | | | | | | Fixes #233. https://github.com/google/bazel/issues/233 -- MOS_MIGRATED_REVID=95632067
* Parser cleanup: Introduce an enum instead of the booleansGravatar Laurent Le Brun2015-05-28
| | | | | -- MOS_MIGRATED_REVID=94649435
* Forbid **kwargs and *args in BUILD files.Gravatar Laurent Le Brun2015-05-27
| | | | | | | | | Rationale: it makes BUILD files less declarative and makes harder to do automated changes on BUILD files. It is however still allowed in .bzl files. -- MOS_MIGRATED_REVID=94577442
* Allow if filtering in list comprehensionsGravatar Laurent Le Brun2015-05-18
| | | | | -- MOS_MIGRATED_REVID=93881507
* Skylark: Functions don't need to be declared in order.Gravatar Laurent Le Brun2015-05-15
| | | | | -- MOS_MIGRATED_REVID=93515487
* Build language: Support 'not in' operator.Gravatar Laurent Le Brun2015-05-08
| | | | | -- MOS_MIGRATED_REVID=93129861
* Parser: Update code to prepare for list filtering.Gravatar Laurent Le Brun2015-04-22
| | | | | -- MOS_MIGRATED_REVID=91714318
* Build language: Implement integer divisionGravatar Laurent Le Brun2015-04-15
| | | | | -- MOS_MIGRATED_REVID=91192716
* Allow evaluation from StringGravatar Francois-Rene Rideau2015-04-13
| | | | | | | | | | | | | | | | | | | Lift the Evaluation code from the test files AbstractParserTestCase and AbstractEvaluationTestCase into new files EvaluationContext. Remove this code's dependency on FsApparatus (and thus to InMemoryFS), by making the Lexer accept null as filename. Also remove dependency on EventCollectionApparatus; parameterized by an EventHandler. Have the SkylarkSignatureProcessor use this Evaluation for defaultValue-s. While refactoring evaluation, have SkylarkShell use it, which fixes its ValidationEnvironment issues. TODO: refactor the tests to use this new infrastructure. -- MOS_MIGRATED_REVID=90824736
* Skylark: Remove superfluous error message.Gravatar Laurent Le Brun2015-04-03
| | | | | -- MOS_MIGRATED_REVID=90157406
* Parser: Make error recovery more conservative.Gravatar Laurent Le Brun2015-04-02
| | | | | | | | Reduce the number of error message after a parse error. Recover only when we have confidence we are in good state. -- MOS_MIGRATED_REVID=90147322
* Parser: Useful error messages when a Python keyword is used.Gravatar Laurent Le Brun2015-03-24
| | | | | -- MOS_MIGRATED_REVID=89307831
* Parser: Improve error messages (mention what was expected)Gravatar Laurent Le Brun2015-03-24
| | | | | -- MOS_MIGRATED_REVID=89296523
* Parser: Allow more complex expressions as for loop variables.Gravatar Laurent Le Brun2015-03-23
| | | | | | | Also, use LValue in ForStatement. -- MOS_MIGRATED_REVID=89122760
* Parser: Support tuples without parens.Gravatar Laurent Le Brun2015-03-20
| | | | | | | | | | | | | | | In Python, tuples normally don't need parens, e.g. a, b = c, d for i, j in e: pass However, they are sometimes required to avoid ambiguity: fct((x, y)) [(1, 2), (3, 4)] This distinction is handled with parseExpression vs parseNonTupleExpression. -- MOS_MIGRATED_REVID=89118478
* New class hierarchy for Skylark functionsGravatar Francois-Rene Rideau2015-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | * New hierarchy BaseFunction > UserModeFunction, BuiltinFunction. The old hierarchy still exists for now, to be deleted after migration: Function > AbstractFunction > MixedModeFunction > (UserModeFunction, SkylarkFunction > SimpleSkylarkFunction) (UserModeFunction is already migrated, and BaseFunction implements Function, for now.) * Function supports *args and **kwargs when calling functions, and mandatory named-only parameters in the style of Python 3. Notable difference with Python: *args binds the variable to a tuple, because a Skylark list would have to be monomorphic. * A better, simpler, safer FFI using reflection with BuiltinFunction. Handles typechecking, passes parameters in a more Java style. (Not used for now, will be used later.) * A new annotation @SkylarkSignature, intended to replace @SkylarkBuiltin, supports the full function call protocol, including default arguments. * Support for annotating function Factory-s rather than functions. -- MOS_MIGRATED_REVID=88958581
* Parser: Add the 'pass' keywordGravatar Laurent Le Brun2015-03-18
| | | | | -- MOS_MIGRATED_REVID=88857682
* Parser: allow multiple statements on the same line as the colonGravatar Laurent Le Brun2015-03-18
| | | | | | | | | e.g. def foo(x, y): print(x); print(y) Bug found when adding the pass statement. -- MOS_MIGRATED_REVID=88852710
* Skylark: Fix an infinite loop in the parserGravatar Laurent Le Brun2015-03-18
| | | | | -- MOS_MIGRATED_REVID=88830705
* Parser: Update error message when using 'def' in a BUILD file.Gravatar Laurent Le Brun2015-03-18
| | | | | -- MOS_MIGRATED_REVID=88813915
* Skylark: Allow list slicesGravatar Laurent Le Brun2015-03-16
| | | | | -- MOS_MIGRATED_REVID=88727892
* Skylark: Allow traling comma in load statementsGravatar Laurent Le Brun2015-03-16
| | | | | -- MOS_MIGRATED_REVID=88726457
* Implement ConditionalExpressionGravatar Francois-Rene Rideau2015-03-13
| | | | | | | Also add tests. -- MOS_MIGRATED_REVID=88474801
* Minor cleanups in SkylarkGravatar Francois-Rene Rideau2015-03-05
| | | | | -- MOS_MIGRATED_REVID=87535290
* Publish a static ASTNode setLocationGravatar Francois-Rene Rideau2015-03-05
| | | | | -- MOS_MIGRATED_REVID=87519507
* Introduce first class function signatures; make the parser use them.Gravatar Francois-Rene Rideau2015-02-19
| | | | | | | | | | | | | | | | | | | This is the first meaty cl in a series to refactor the Skylark function call protocol. 1- We introduce a first-class notion of FunctionSignature, that supports positional and named-only arguments, mandatory and optional, default values, type-checking, *stararg and **kwarg; 2- To keep things clean, we distinguish two different kinds of Argument's: Argument.Passed that appears in function calls, and Parameter, that appears in function definitions. 3- We refactor the Parser so it uses this infrastructure, and make minimal changes to MixedModeFunction so that it works with it (but don't actually implement *starparam and **kwparam yet). 4- As we modify FuncallExpression, we ensure that the args and kwargs arguments it passes to the underlying function are immutable, as a prerequisite to upcoming implementation of *starparam and **kwparam as being provided directly from a skylark list or dict. Further changes under review will take advantage of this FunctionSignature to redo all our function call protocol, to be used uniformly for both UserDefinedFunction's and builtin function. The result will be a simpler inheritance model, with better type-checking, builtin functions that are both simpler and better documented, and many redundant competing functionality-limited codepaths being merged and replaced by something better. NB: The changes to MixedModeFunction, SkylarkFunction and MethodLibrary are temporary hacks to be done away with in an upcoming CL. The rest is the actual changes. -- MOS_MIGRATED_REVID=86704072
* Cosmetic changes moved out of []Gravatar Francois-Rene Rideau2015-02-11
| | | | | | | | These shouldn't affect the semantic of the program in any significant way, but will hush the linter and other such metaprograms. -- MOS_MIGRATED_REVID=86089271