This change is needed as a consequence of
https://github.com/dart-lang/language/pull/2422
where `()` was introduced as the syntax for the empty record as well
as the empty record type.
Change-Id: Ia8b3f590361343ca14355043c5898e7bd084c04e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261645
Reviewed-by: William Hesse <whesse@google.com>
Auto-Submit: Erik Ernst <eernst@google.com>
Commit-Queue: William Hesse <whesse@google.com>
This CL updates Dart.g and hence the spec parser to handle new features
added to Dart in 2.17.
Change-Id: I42d6534d933df9a30453f12643dcc90e4d86fa80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260821
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Invocations of the spec parser used to exit with an error code (245)
in the case where no files were specified. This was considered to be a
useless type of invocation, and the spec parser would print out a help
message.
However, it is perfectly possible for a Gerrit CL to give rise to
invocations like that, e.g., when the CL deletes some files and does
nothing else. Also, it causes no known issues to report a success exit
code (0) in the case where no files are specified, and hence this CL
changes the spec parser accordingly.
Change-Id: I9bd75839f1a8052b3daa62fa5440451e46fb59e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253280
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Change-Id: Ie9b93497491dd44576f6e0e8c58499f98e7a74df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216021
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
The spec parser previously assumed that an import or export directive
would use a single-line string. However, multi-line strings like
"""lib.dart""" and raw strings like r'''lib.dart''' are allowed as well,
and also mixed forms like "lib" r'''.dart'''.
This CL changes Dart.g such that those forms are supported.
Change-Id: I40abe1a2f095907803371fc4224bd10bbca38c9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208880
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL updates the grammar Dart.g such that it
supports constructor tearoffs, as well as explicit
instantiations of generic functions and methods,
and parameterized types as type literals.
Change-Id: I2e30d0eb185b84fc2103c21ba962f4cbff40905a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197161
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Dart.g has a 'CHANGES' section, but it hasn't been updated for a while.
This CL adds the missing entries.
Change-Id: Ib99f480b872d176344f5ad4a5af15a869c1550a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177601
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Cf. language issue #1341: The grammar rule in Dart.g for <metadata> is
wrong, it does not allow `@x` where `x` is the name of a variable
which is not a `<typeIdentifier>` (in particular, a variable can have
a name like `required` even though it's a built-in identifier).
This CL changes `qualifiedName` such that it only includes the cases
with a '.', and then the remaining case is added where `qualifiedName`
is used. We add `identifier` in `metadata` such that it allows
`@required` and such, and we add `typeIdentifier` in
`constructorDesignation`, because that's required to be an import
prefix or a class name, which are both `typeIdentifier`s.
Change-Id: Ia22d9d9842b995c4ebaa8e18e1c2ccbce1c30e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174540
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This CL updates the spec_parser grammar Dart.g such that it corresponds
more precisely to the grammar in the language specification.
Main corrections:
fieldFormalParameter now allows `?` on the parameter type.
cascade was reorganized in the spec, Dart.g now reorganized similarly.
`?` removed from argumentPart (we did not add null-aware invocation)
Other changes were mainly renamings and simplifications of rules, to
make them more similar to the version in the specification.
Change-Id: I1a9bc0097fe6b260dfa6657c947840f2deb437b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167805
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL adds tests in language/external_abstract_fields, testing the
support for abstract instance variables, and for external top-level,
class, and instance variables. It is tested that the syntax of
supported declarations is accepted, and a number of non-supported
forms are rejected, and abstract fields are tested at run time as well.
The implementation of external fields is provided by an implementation
specific mechanism, and no tests are added for any such mechanisms
(that is, with external fields we only test errors).
This CL also updates the spec grammar Dart.g to include grammar
rules for the new kinds of declarations, and it has been verified that
the new tests are passing, respectively cause syntax errors, as
indicated in the test files.
The tests are a further development of the ones in
https://dart-review.googlesource.com/c/sdk/+/145862.
Change-Id: I13be746a05d5acf0117d8cb22151bd9863a71a78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148324
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Change-Id: I8b9c83e216dd713afeef8a1c1cf93c36c8de3792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132840
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Update spec_parser to enable configurableUri in deferred imports,
make cascade syntax compositional, include `extension` declarations,
add `late` as a built-in identifier, and reorder the lexical rules for
single words such that they are grouped into reserved words, built-in
identifiers, and "other words known by the grammar".
Cf. language issue #615, #627, #628, #638.
Change-Id: If60b2ba2ca0e7d4bbc9b4e886857f657fb14c809
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121991
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL makes several adjustments to the spec_parser grammar Dart.g,
such that the spec_parser can parse the proposed NNBD constructs,
cf. language PR #293.
Change-Id: Ieec00259d73b6037d6a87d5c97cfac40186baef0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101500
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Change-Id: Ibbc6f5f811ed0cc042340254dce10616c0600fea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105220
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
Change-Id: I9ba3aa4e3ebaedee3a2cd20ccdcc533af96b9bda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98018
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
This CL modifies the Dart source used from test.py such that it takes
`syntax error` into account as an expected outcome in test files (so
that we can have `//# 01: syntax error` with a similar meaning as
`//# 01: compile-time error`).
For all tools except the spec_parser, `syntax error` is the same
outcome as `compile-time error`; that is, nobody else will see the
difference.
For the spec_parser, `syntax error` is the outcome where parsing has
failed; `compile-time error` is taken to mean some other compile-time
error, i.e., the spec_parser is expected to _succeed_ when the
expected outcome is `compile-time error`.
Test files in language and language_2 have been adjusted to use the
outcome `syntax error` where appropriate.
The status files in language and language_2 for the spec_parser have
been adjusted such that they fit all the new `syntax error` outcomes
in test files.
Other status files have been adjusted in a few cases where tests were
corrected (because a compile-time error which was clearly not intended
to be a syntax error turned out to be caused by a typo, which means
that the actual compile-time error has never been tested).
The spec grammar Dart.g was adjusted in a few cases, when some bugs
were discovered. In particular, the treatment of Function has been
changed: It is now known by the parser that Function does not take
any type arguments. This makes no difference for developers, because
they cannot declare a type named Function anyway, but it means that
a number of tricky parsing issues were resolved.
Dart.g was also adjusted to allow `qualified` to contain three
identifiers, which is an old bug (preventing things like metadata on
the form `@p.C.myConst`).
Change-Id: Ie420887d45c882ef97c84143365219f8aa0d2933
Reviewed-on: https://dart-review.googlesource.com/18262
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This CL modifies tools/test.py such that it can run the spec parser
(after doing `make parser` in tools/spec_parser, and assuming that the
ANTLR 3 library is available at /usr/share/java/antlr3-runtime.jar)
with a command line like
`tools/test.py -c spec_parser -r none language/callable_test`
It also changes status files to have a name which follows the expected
patterns (e.g., `language/language_spec_parser.status`). Finally, it
adds/changes many entries in status files, such that parsing of the
directories `language` and `language_2` run successfully.
Change-Id: I82a22e32ac4fecd23ac0d4434bcac08f75dd8ffe
Reviewed-on: https://dart-review.googlesource.com/12680
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This makes it possible to run the spec parser in a way which is a bit
more like the other tools that we have (e.g., tools/test.py):
> tools/spec_parse.py tests/language/callable_test.dart
It still requires the developer to run `make parser` in
tools/spec_parser and hence does not run on a buildbot, but it's one
step forward.
Change-Id: I68ad6cea55bc02dddac21558acec33fc4bfc1981
Reviewed-on: https://dart-review.googlesource.com/9620
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>