@@ -9,8 +9,9 @@ import type {DiagnosticWithoutFile, Range, Result} from '../error.js';
99/**
1010 * Parse a Wireit dependency specifier.
1111 *
12- * A Wireit dependency string is what appears in a `"wireit.<script>.dependencies"` array in a
13- * `package.json` file, which controls which script must run before the current one.
12+ * A Wireit dependency specifier is what appears in a
13+ * `"wireit.<script>.dependencies"` array in a `package.json` file, which
14+ * controls which script must run before the current one.
1415 *
1516 *
1617 * ### QUICK EXAMPLES
@@ -54,8 +55,9 @@ import type {DiagnosticWithoutFile, Range, Result} from '../error.js';
5455 *
5556 * ### INVERSION
5657 *
57- * A dependency specifier can be inverted by prefixing it with a `!`. This means that any matching
58- * scripts will be excluded from the preceding (but not following) matching scripts.
58+ * A dependency specifier can be inverted by prefixing it with a `!`. This means
59+ * that any matching scripts will be excluded from the preceding (but not
60+ * following) matching scripts.
5961 *
6062 * | | |
6163 * |---------------------------|-------------------------------------------------------------------|
@@ -65,7 +67,8 @@ import type {DiagnosticWithoutFile, Range, Result} from '../error.js';
6567 *
6668 * ### ESCAPING
6769 *
68- * The following characters have special meaning, and must be escaped with `\` if meant literally:
70+ * The following characters have special meaning, and must be escaped with `\`
71+ * if meant literally:
6972 *
7073 * | | |
7174 * |---------------------------|-------------------------------------------------------------------|
@@ -153,7 +156,7 @@ type Segment = StringSegment | SpecialSegment;
153156type StringSegment = {
154157 kind : 'string' ;
155158 string : string ;
156- // Note this can be range can be longe than the length of `string`, since it
159+ // Note this can be range can be longer than the length of `string`, since it
157160 // includes escapes.
158161 range : Range ;
159162} ;
@@ -486,10 +489,10 @@ class DependencyParser {
486489 #lookAheadForUnescapedHash( ) : boolean {
487490 for ( let i = this . #pos + 1 ; i < this . #str. length ; i ++ ) {
488491 const char = this . #str[ i ] ;
489- if ( char === BACKSLASH ) {
490- i += 2 ;
491- } else if ( char === HASH ) {
492+ if ( char === HASH ) {
492493 return true ;
494+ } else if ( char === BACKSLASH ) {
495+ i ++ ; // Skip an additional character (since it's escaped).
493496 }
494497 }
495498 return false ;
0 commit comments