Relax syntax for gen-l10n#130736
Conversation
HansMuller
left a comment
There was a problem hiding this comment.
This looks good! Some presubmit tests are failing though.
| tokens.add(Node.brace(startIndex, match.group(0)!)); | ||
| isString = false; | ||
| startIndex = match.end; | ||
| depth++; |
There was a problem hiding this comment.
depth += 1 is preferred because no one remembers PDP-11s anymore :-).
| ); | ||
| argParser.addFlag( | ||
| 'relax-syntax', | ||
| help: 'When specified, some instances of "{" and "}" will be treated as strings ' |
There was a problem hiding this comment.
It would be better to explain this more precisely.
| help: 'When specified, all warnings will be suppressed.\n' | ||
| ); | ||
| argParser.addFlag( | ||
| 'relax-syntax', |
| /// Whether or not to suppress warnings. | ||
| final bool suppressWarnings; | ||
|
|
||
| /// The `relax-syntax` argument. |
There was a problem hiding this comment.
You should incorporate the text from the help message here.
It would also be worth explaining here and in the help message that relax-syntax was added for backwards compatibility with an a earlier version of the parser and that we don't advising using it because it can mask errors.
|
auto label is removed for flutter/flutter, pr: 130736, due to - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Roll Flutter from 6f09064 to d07e8ae (60 revisions) flutter/flutter@6f09064...d07e8ae 2023-07-19 [email protected] Roll Flutter Engine from 09389b16d684 to eb2285205f25 (3 revisions) (flutter/flutter#130879) 2023-07-19 [email protected] Roll Flutter Engine from 0293a7cb7887 to 09389b16d684 (5 revisions) (flutter/flutter#130867) 2023-07-19 [email protected] Move TapAndDragGestureRecognizer code under gestures (flutter/flutter#119508) 2023-07-19 [email protected] Roll Flutter Engine from 29de67c7d009 to 0293a7cb7887 (1 revision) (flutter/flutter#130858) 2023-07-19 [email protected] Roll Flutter Engine from 39d60be72ffb to 29de67c7d009 (4 revisions) (flutter/flutter#130855) 2023-07-19 [email protected] Roll Flutter Engine from b3bfc744bb61 to 39d60be72ffb (1 revision) (flutter/flutter#130847) 2023-07-19 [email protected] Roll Flutter Engine from adf6142f6738 to b3bfc744bb61 (7 revisions) (flutter/flutter#130843) 2023-07-18 [email protected] Update app_builder_test.dart for M3 (flutter/flutter#130794) 2023-07-18 [email protected] Catch errors in loadStructuredData (flutter/flutter#130748) 2023-07-18 [email protected] Fix super tiny space formatting (hope we have auto formatter in the future) (flutter/flutter#127479) 2023-07-18 [email protected] Roll Flutter Engine from 71bbecee3010 to adf6142f6738 (2 revisions) (flutter/flutter#130831) 2023-07-18 [email protected] Update SnackBar tests for M2/M3 (flutter/flutter#130717) 2023-07-18 [email protected] Roll pub packages (flutter/flutter#130821) 2023-07-18 [email protected] Relax syntax for gen-l10n (flutter/flutter#130736) 2023-07-18 [email protected] Roll Flutter Engine from 45851af55bd6 to 71bbecee3010 (7 revisions) (flutter/flutter#130820) 2023-07-18 [email protected] Roll pub packages (flutter/flutter#130608) 2023-07-18 [email protected] Roll Flutter Engine from 831da7e9dc3b to 45851af55bd6 (2 revisions) (flutter/flutter#130814) 2023-07-18 [email protected] [Android] Deletes deprecated splash screen meta-data element (flutter/flutter#130744) 2023-07-18 [email protected] Updated `ThemeData.useMaterial3` API doc, default is `true` (flutter/flutter#130764) 2023-07-18 [email protected] [labeler] Mark sync-labels as empty (flutter/flutter#130642) 2023-07-18 [email protected] Roll Flutter Engine from c27658cc5ade to 831da7e9dc3b (2 revisions) (flutter/flutter#130810) 2023-07-18 [email protected] Roll Packages from 6889cca to 3e8b813 (9 revisions) (flutter/flutter#130802) 2023-07-18 [email protected] Update `AppBar` and `AppBarTheme` tests for M2/M3 (flutter/flutter#130790) 2023-07-18 [email protected] Update app tests for M3 (flutter/flutter#130792) 2023-07-18 [email protected] Add lint check to make sure samples are linked and have tests (flutter/flutter#130523) 2023-07-18 [email protected] Roll Flutter Engine from aaec42812a1f to c27658cc5ade (2 revisions) (flutter/flutter#130799) 2023-07-18 [email protected] Extract common functionality of iOS platformviews into superclasses (flutter/flutter#128716) 2023-07-18 [email protected] Roll Flutter Engine from 88be39be7b07 to aaec42812a1f (1 revision) (flutter/flutter#130787) 2023-07-18 [email protected] Roll Flutter Engine from b46a8baf8ed9 to 88be39be7b07 (1 revision) (flutter/flutter#130784) 2023-07-18 [email protected] Roll Flutter Engine from 777fe158f4e7 to b46a8baf8ed9 (1 revision) (flutter/flutter#130782) 2023-07-18 [email protected] Fix `iconTheme` in `AppBar` doesn't apply custom `Colors.white` in the dark mode for M3 (flutter/flutter#130574) 2023-07-18 [email protected] Roll Flutter Engine from c6e23288db8d to 777fe158f4e7 (2 revisions) (flutter/flutter#130779) 2023-07-18 [email protected] Roll Flutter Engine from 116eedf769be to c6e23288db8d (3 revisions) (flutter/flutter#130778) 2023-07-18 [email protected] Roll Flutter Engine from 9d018f00d687 to 116eedf769be (2 revisions) (flutter/flutter#130774) 2023-07-18 [email protected] Roll Flutter Engine from 77ec92371846 to 9d018f00d687 (1 revision) (flutter/flutter#130772) 2023-07-18 [email protected] Document stack's clipping behaviour better (flutter/flutter#130749) 2023-07-18 [email protected] Roll Flutter Engine from f2958f9229a4 to 77ec92371846 (1 revision) (flutter/flutter#130769) 2023-07-18 [email protected] Roll Flutter Engine from 3cceb705007e to f2958f9229a4 (1 revision) (flutter/flutter#130767) 2023-07-18 [email protected] Roll Flutter Engine from 09689d37e1d6 to 3cceb705007e (2 revisions) (flutter/flutter#130763) 2023-07-18 [email protected] Stabilize hybrid_android_views_integration_test rendering tree (flutter/flutter#130751) 2023-07-17 [email protected] update link to good first issues (flutter/flutter#130759) 2023-07-17 [email protected] Prevent `InputDecorator` from supplying its descendants with non-normalized constraints (flutter/flutter#130460) 2023-07-17 [email protected] Roll Flutter Engine from 15c15fd75743 to 09689d37e1d6 (3 revisions) (flutter/flutter#130758) 2023-07-17 [email protected] [tools/ios_build_ipa] fallback to CFBundleName if CFBundleDisplayName is absent (flutter/flutter#130752) 2023-07-17 [email protected] Resolve TODOs in channels integration test (flutter/flutter#130745) 2023-07-17 [email protected] Roll Flutter Engine from ddbe23b374d8 to 15c15fd75743 (2 revisions) (flutter/flutter#130746) ...
To preserve backward compatibility with the old parser which would
ignore syntax errors, this PR introduces a way to treat the special
characters `{` and `}` in the following way:
1. If we encounter a `{` which searching for a string token and this `{`
is not followed by a valid placeholder, then we treat the `{` as a
string and continue lexing for strings.
2. If we encounter a `}` while not within some expression (i.e.
placeholders, arguments, plurals, or selects), then we treat the `}` as
a string and continue lexing for strings.
This makes it so that
```
"helloWorld": "{ } { placeholder }",
"@@helloworld": {
"placeholders": {
"placeholder" {}
}
}
```
treats the `{ }` as a string while `{ placeholder } ` is treated as a
placeholder.
Fixes flutter#122404.
|
backwards compatibility for non major version changes should be the default behaviour |
To preserve backward compatibility with the old parser which would ignore syntax errors, this PR introduces a way to treat the special characters
{and}in the following way:{which searching for a string token and this{is not followed by a valid placeholder, then we treat the{as a string and continue lexing for strings.}while not within some expression (i.e. placeholders, arguments, plurals, or selects), then we treat the}as a string and continue lexing for strings.This makes it so that
treats the
{ }as a string while{ placeholder }is treated as a placeholder.Fixes #122404.