Commit graph

25 commits

Author SHA1 Message Date
Erik Ernst
d2911decfb Adjust rules recordLiteralNoConst and recordType to include ()
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>
2022-10-06 15:10:57 +00:00
Erik Ernst
263be7413b Update spec_parser to handle new features (super, anywhere, records)
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>
2022-09-27 14:10:53 +00:00
Erik Ernst
1c2c6ea1cd Adjust spec parser to use exit code 0 when parsing no files
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>
2022-08-01 23:29:44 +00:00
Devon Carew
c4dc032f6c [repo] improve the analysis of the tools/ directory
Change-Id: I4185e3bdc1f0f6f8464ebc2a043254200e3df486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233502
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-02-17 19:09:52 +00:00
Erik Ernst
1c13f49159 Add enhanced enums support to Dart.g
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>
2021-10-11 14:08:55 +00:00
Erik Ernst
58d917e757 Correct uri rule in Dart.g
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>
2021-08-05 08:32:38 +00:00
Erik Ernst
284695f193 Fix instance variable declaration to allow covariant late final
Change Dart.g to be in sync with the language specification after
https://github.com/dart-lang/language/pull/1728.

Change-Id: I7587da87ec6a0300810949a34e90af5560cbeac0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/206261
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-07-12 07:33:09 +00:00
Erik Ernst
6facd6dfda Adjust Dart.g to allow constructor tearoffs
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>
2021-07-08 13:10:45 +00:00
Erik Ernst
f65c20124e Change <partHeader> to allow part of <uri>.
Cf. https://github.com/dart-lang/language/pull/1615.

Resolves https://github.com/dart-lang/sdk/issues/45916.

Change-Id: Id01cdd7496ea40183a15eed9d3561ab3c21819c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198400
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-05-05 18:40:15 +00:00
Erik Ernst
bb5cb79a2f Update Dart.g
Update Dart.g to handle symbolLiterals, define builtInIdentifier
non-terminal, enable non-function type aliases, delete obsolete
comments. Add `metadata` to n{ormal,amed}ParameterType; add
`extension` to identifierNotFunction.

Change-Id: I130be575265732dcd9ad7708460b2a4326e765c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195501
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-04-15 22:12:17 +00:00
Erik Ernst
b27735d404 Add missing change log entries for 8 changes.
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>
2021-01-05 16:32:14 +00:00
Erik Ernst
82403371ac Adjust qualifiedName, constructorDesignation, metadata
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>
2020-12-02 10:03:47 +00:00
Erik Ernst
67c703063d Update Dart.g to match language specification
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>
2020-10-19 16:01:17 +00:00
Erik Ernst
8ccdb9ae79 Adjust Dart.g to include constructorInvocation in primary
Cf. https://github.com/dart-lang/language/issues/1199.

Change-Id: Idb0422aacfe1ef08dbf1c90eb9c01b91de75cfaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161708
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-09-03 18:06:25 +00:00
Erik Ernst
f4d7951a88 For external/abstract fields: add tests and update Dart.g
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>
2020-07-02 13:39:39 +00:00
Erik Ernst
a9ea9365ad Change null-aware operator [], operator []=, and function call to not have a period.
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>
2020-01-22 10:18:26 +00:00
Erik Ernst
6826faf583 Update spec_parser.
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>
2019-10-25 08:57:44 +00:00
Erik Ernst
a58052974e Adjusted Dart.g to contain the grammar updates of language repo PR 293
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>
2019-08-14 08:17:54 +00:00
Erik Ernst
56793b3d47 Dart.g fixes, not including nnbd updates.
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>
2019-06-06 12:07:40 +00:00
Erik Ernst
69790e7eb4 Updated Dart.g, tests & status files to support ui-as-code collections
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>
2019-03-29 13:33:52 +00:00
Erik Ernst
e830338919 Updated spec_parser such that it runs with ANTLR v4
Change-Id: Ib0711ebc125f4fadb5a526c3538d5c3a35f11234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97320
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-03-19 14:06:26 +00:00
Erik Ernst
40b6741778 Adds support for syntax error in tests to test.py.
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>
2017-11-06 08:56:09 +00:00
Erik Ernst
63de49ccde test.py will now run the spec parser.
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>
2017-10-12 09:22:28 +00:00
Erik Ernst
b61f1047d5 Add a tools/spec_parse.py script.
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>
2017-10-10 16:03:36 +00:00
Erik Ernst
c49cbae7f0 Rietveld 2688903004 (spec_parser) migrated to Gerrit.
Change-Id: Iddd1e8a795bfaed0092a30bb9d83070fe62d4a60
Reviewed-on: https://dart-review.googlesource.com/7261
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-21 09:36:10 +00:00