Merge pull request #69 from dart-lang/remove-charcode
Remove dependency on `package:charcode`.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd92971..3ea84c9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
-## 0.3.5-dev
+## 0.3.5
* Require Dart >=2.1
+* Remove dependency on `package:charcode`.
## 0.3.4
@@ -41,7 +42,7 @@
main() async {
// Prints the first line entered on stdin.
print(await sharedStdIn.nextLine());
-
+
// Prints all remaining lines.
await for (final line in sharedStdIn.lines) {
print(line);
@@ -79,7 +80,7 @@
- Added the `shellSplit()` function, which parses a list of arguments in the
same manner as [the POSIX shell][what_is_posix_shell].
-
+
[what_is_posix_shell]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
## 0.2.0
diff --git a/lib/src/charcodes.dart b/lib/src/charcodes.dart
new file mode 100644
index 0000000..d6557e8
--- /dev/null
+++ b/lib/src/charcodes.dart
@@ -0,0 +1,34 @@
+// Copyright 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Generated using:
+// pub global run charcode \$=dollar \'=single_quote \"=double_quote \
+// \' '\\\n"$`# \t'
+
+/// "Horizontal Tab" control character, common name.
+const int $tab = 0x09;
+
+/// "Line feed" control character.
+const int $lf = 0x0a;
+
+/// Space character.
+const int $space = 0x20;
+
+/// Character `"`, short name.
+const int $doubleQuote = 0x22;
+
+/// Character `#`.
+const int $hash = 0x23;
+
+/// Character `$`.
+const int $dollar = 0x24;
+
+/// Character "'".
+const int $singleQuote = 0x27;
+
+/// Character `\`.
+const int $backslash = 0x5c;
+
+/// Character `` ` ``.
+const int $backquote = 0x60;
diff --git a/lib/src/shell_words.dart b/lib/src/shell_words.dart
index 8e057d7..d293e39 100644
--- a/lib/src/shell_words.dart
+++ b/lib/src/shell_words.dart
@@ -4,9 +4,10 @@
// ignore_for_file: comment_references
-import 'package:charcode/charcode.dart';
import 'package:string_scanner/string_scanner.dart';
+import 'charcodes.dart';
+
/// Splits [command] into tokens according to [the POSIX shell
/// specification][spec].
///
@@ -48,19 +49,19 @@
token.writeCharCode(scanner.readChar());
break;
- case $single_quote:
+ case $singleQuote:
hasToken = true;
// Section 2.2.2: Enclosing characters in single-quotes ( '' ) shall
// preserve the literal value of each character within the
// single-quotes. A single-quote cannot occur within single-quotes.
final firstQuote = scanner.position - 1;
- while (!scanner.scanChar($single_quote)) {
+ while (!scanner.scanChar($singleQuote)) {
_checkUnmatchedQuote(scanner, firstQuote);
token.writeCharCode(scanner.readChar());
}
break;
- case $double_quote:
+ case $doubleQuote:
hasToken = true;
// Section 2.2.3: Enclosing characters in double-quotes ( "" ) shall
// preserve the literal value of all characters within the
@@ -71,7 +72,7 @@
// or dollar sign within double quotes, since those are dynamic
// features.)
final firstQuote = scanner.position - 1;
- while (!scanner.scanChar($double_quote)) {
+ while (!scanner.scanChar($doubleQuote)) {
_checkUnmatchedQuote(scanner, firstQuote);
if (scanner.scanChar($backslash)) {
@@ -86,7 +87,7 @@
if (next == $lf) continue;
if (next == $dollar ||
next == $backquote ||
- next == $double_quote ||
+ next == $doubleQuote ||
next == $backslash) {
token.writeCharCode(next);
} else {
diff --git a/pubspec.yaml b/pubspec.yaml
index 7bb19ba..242344c 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -2,14 +2,13 @@
description: >-
Utilities for the Dart VM Runtime including support for ANSI colors,
file copying, and standard exit code values.
-version: 0.3.5-dev
+version: 0.3.5
homepage: https://github.com/dart-lang/io
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
- charcode: ^1.0.0
meta: ^1.0.2
path: ^1.5.1
string_scanner: ">=0.1.5 <2.0.0"