Unverified Commit a4054938 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

unnecessary multiline strings (#50806)

parent 419a2853
...@@ -259,7 +259,7 @@ class TestFile { ...@@ -259,7 +259,7 @@ class TestFile {
const TestFile._(this.contacts, this.fetch, this.update, this.tests); const TestFile._(this.contacts, this.fetch, this.update, this.tests);
// (e-mail regexp from HTML standard) // (e-mail regexp from HTML standard)
static final RegExp _email = RegExp(r'''^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$'''); static final RegExp _email = RegExp(r"^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$");
static final RegExp _fetch1 = RegExp(r'^git(?: -c core.longPaths=true)? clone https://github.com/[-a-zA-Z0-9]+/[-_a-zA-Z0-9]+.git tests$'); static final RegExp _fetch1 = RegExp(r'^git(?: -c core.longPaths=true)? clone https://github.com/[-a-zA-Z0-9]+/[-_a-zA-Z0-9]+.git tests$');
static final RegExp _fetch2 = RegExp(r'^git(?: -c core.longPaths=true)? -C tests checkout [0-9a-f]+$'); static final RegExp _fetch2 = RegExp(r'^git(?: -c core.longPaths=true)? -C tests checkout [0-9a-f]+$');
......
...@@ -21,7 +21,7 @@ void main(List<String> args) { ...@@ -21,7 +21,7 @@ void main(List<String> args) {
// Since I didn't want to add the XML package as a dependency just for this, // Since I didn't want to add the XML package as a dependency just for this,
// I just used a regular expression to make this simple change. // I just used a regular expression to make this simple change.
final RegExp findRe = RegExp(r'''(\s*<key>DocSetPlatformFamily</key>\s*<string>)[^<]+(</string>)''', multiLine: true); final RegExp findRe = RegExp(r'(\s*<key>DocSetPlatformFamily</key>\s*<string>)[^<]+(</string>)', multiLine: true);
contents = contents.replaceAllMapped(findRe, (Match match) { contents = contents.replaceAllMapped(findRe, (Match match) {
return '${match.group(1)}dartlang${match.group(2)}'; return '${match.group(1)}dartlang${match.group(2)}';
}); });
......
...@@ -146,7 +146,7 @@ class KeyData { ...@@ -146,7 +146,7 @@ class KeyData {
/// Also, note that some keys (notably MEDIA_EJECT) can be mapped to more than /// Also, note that some keys (notably MEDIA_EJECT) can be mapped to more than
/// one scan code, so the mapping can't just be 1:1, it has to be 1:many. /// one scan code, so the mapping can't just be 1:1, it has to be 1:many.
Map<String, List<int>> _readAndroidScanCodes(String keyboardLayout) { Map<String, List<int>> _readAndroidScanCodes(String keyboardLayout) {
final RegExp keyEntry = RegExp(r'''#?\s*key\s+([0-9]+)\s*"?(?:KEY_)?([0-9A-Z_]+|\(undefined\))"?\s*(FUNCTION)?'''); final RegExp keyEntry = RegExp(r'#?\s*key\s+([0-9]+)\s*"?(?:KEY_)?([0-9A-Z_]+|\(undefined\))"?\s*(FUNCTION)?');
final Map<String, List<int>> result = <String, List<int>>{}; final Map<String, List<int>> result = <String, List<int>>{};
keyboardLayout.replaceAllMapped(keyEntry, (Match match) { keyboardLayout.replaceAllMapped(keyEntry, (Match match) {
if (match.group(3) == 'FUNCTION') { if (match.group(3) == 'FUNCTION') {
...@@ -176,7 +176,7 @@ class KeyData { ...@@ -176,7 +176,7 @@ class KeyData {
final RegExp enumBlock = RegExp(r'enum\s*\{(.*)\};', multiLine: true); final RegExp enumBlock = RegExp(r'enum\s*\{(.*)\};', multiLine: true);
// Eliminate everything outside of the enum block. // Eliminate everything outside of the enum block.
headerFile = headerFile.replaceAllMapped(enumBlock, (Match match) => match.group(1)); headerFile = headerFile.replaceAllMapped(enumBlock, (Match match) => match.group(1));
final RegExp enumEntry = RegExp(r'''AKEYCODE_([A-Z0-9_]+)\s*=\s*([0-9]+),?'''); final RegExp enumEntry = RegExp(r'AKEYCODE_([A-Z0-9_]+)\s*=\s*([0-9]+),?');
final Map<String, int> result = <String, int>{}; final Map<String, int> result = <String, int>{};
for (final Match match in enumEntry.allMatches(headerFile)) { for (final Match match in enumEntry.allMatches(headerFile)) {
result[match.group(1)] = int.parse(match.group(2)); result[match.group(1)] = int.parse(match.group(2));
...@@ -191,7 +191,7 @@ class KeyData { ...@@ -191,7 +191,7 @@ class KeyData {
/// #define GLFW_KEY_SPACE 32, /// #define GLFW_KEY_SPACE 32,
Map<String, int> _readGlfwKeyCodes(String headerFile) { Map<String, int> _readGlfwKeyCodes(String headerFile) {
// Only get the KEY definitions, ignore the rest (mouse, joystick, etc). // Only get the KEY definitions, ignore the rest (mouse, joystick, etc).
final RegExp enumEntry = RegExp(r'''define GLFW_KEY_([A-Z0-9_]+)\s*([A-Z0-9_]+),?'''); final RegExp enumEntry = RegExp(r'define GLFW_KEY_([A-Z0-9_]+)\s*([A-Z0-9_]+),?');
final Map<String, dynamic> replaced = <String, dynamic>{}; final Map<String, dynamic> replaced = <String, dynamic>{};
for (final Match match in enumEntry.allMatches(headerFile)) { for (final Match match in enumEntry.allMatches(headerFile)) {
replaced[match.group(1)] = int.tryParse(match.group(2)) ?? match.group(2).replaceAll('GLFW_KEY_', ''); replaced[match.group(1)] = int.tryParse(match.group(2)) ?? match.group(2).replaceAll('GLFW_KEY_', '');
...@@ -216,8 +216,8 @@ class KeyData { ...@@ -216,8 +216,8 @@ class KeyData {
List<Key> _readHidEntries(String input) { List<Key> _readHidEntries(String input) {
final List<Key> entries = <Key>[]; final List<Key> entries = <Key>[];
final RegExp usbMapRegExp = RegExp( final RegExp usbMapRegExp = RegExp(
r'''USB_KEYMAP\s*\(\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),''' r'USB_KEYMAP\s*\(\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),'
r'''\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),\s*"?([^\s]+?)"?,\s*([^\s]+?)\s*\)''', r'\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),\s*0x([a-fA-F0-9]+),\s*"?([^\s]+?)"?,\s*([^\s]+?)\s*\)',
multiLine: true); multiLine: true);
final RegExp commentRegExp = RegExp(r'//.*$', multiLine: true); final RegExp commentRegExp = RegExp(r'//.*$', multiLine: true);
input = input.replaceAll(commentRegExp, ''); input = input.replaceAll(commentRegExp, '');
...@@ -418,9 +418,9 @@ class Key { ...@@ -418,9 +418,9 @@ class Key {
@override @override
String toString() { String toString() {
return """'$constantName': (name: "$name", usbHidCode: ${toHex(usbHidCode)}, """ return """'$constantName': (name: "$name", usbHidCode: ${toHex(usbHidCode)}, """
'''linuxScanCode: ${toHex(linuxScanCode)}, xKbScanCode: ${toHex(xKbScanCode)}, ''' 'linuxScanCode: ${toHex(linuxScanCode)}, xKbScanCode: ${toHex(xKbScanCode)}, '
'''windowsKeyCode: ${toHex(windowsScanCode)}, macOsScanCode: ${toHex(macOsScanCode)}, ''' 'windowsKeyCode: ${toHex(windowsScanCode)}, macOsScanCode: ${toHex(macOsScanCode)}, '
'''chromiumSymbolName: $chromiumName'''; 'chromiumSymbolName: $chromiumName';
} }
/// Returns the static map of printable representations. /// Returns the static map of printable representations.
......
...@@ -641,8 +641,8 @@ ${globals.terminal.bolden('Consuming the Module')} ...@@ -641,8 +641,8 @@ ${globals.terminal.bolden('Consuming the Module')}
dependencies {'''); dependencies {''');
for (final String buildMode in buildModes) { for (final String buildMode in buildModes) {
globals.printStatus(''' globals.printStatus("""
${buildMode}Implementation '$androidPackage:flutter_$buildMode:$buildNumber\''''); ${buildMode}Implementation '$androidPackage:flutter_$buildMode:$buildNumber'""");
} }
globals.printStatus(''' globals.printStatus('''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment