Skip to content

Commit c9f7058

Browse files
committed
Fix missing + in hex number regexp in chapter 9
1 parent 784a371 commit c9f7058

3 files changed

Lines changed: 510 additions & 448 deletions

File tree

09_regexp.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,13 @@ of the string and decides that there really is no match.
549549
(((regular expression,backtracking)))(((binary number)))(((decimal
550550
number)))(((hexadecimal number)))(((flow
551551
diagram)))(((matching,algorithm)))(((backtracking)))The regular
552-
expression `/\b([01]+b|\d+|[\da-f]h)\b/` matches either a binary
552+
expression `/\b([01]+b|\d+|[\da-f]+h)\b/` matches either a binary
553553
number followed by a _b_, a regular decimal number with no suffix
554554
character, or a hexadecimal number (that is, base 16, with the letters
555555
_a_ to _f_ standing for the digits 10 to 15) followed by an _h_. This
556556
is the corresponding diagram:
557557

558-
image::img/re_number.svg[alt="Visualization of /\\b([01]+b|\\d+|[\\da-f]h)\\b/"]
558+
image::img/re_number.svg[alt="Visualization of /\\b([01]+b|\\d+|[\\da-f]+h)\\b/"]
559559

560560
(((branching)))When matching this expression, it will often happen
561561
that the top (binary) branch is entered even though the input does not

html/errata.html

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,52 @@
1212

1313
<h1>Errata<div style="font-size: 70%"><a class="subtlelink" href="index.html">Eloquent JavaScript</a></div></h2>
1414

15-
<p>These are the known mistakes in the <strong>second edition</strong> of the book. For
16-
errata in the first edition,
15+
<p>These are the known mistakes in the <strong>second edition</strong>
16+
of the book. For errata in the first edition,
1717
see <a href="http://eloquentjavascript.net/1st_edition/errata.html">this
18-
page</a>.</p>
18+
page</a>. To report a problem that is not listed
19+
here, <a href="mailto:marijnh@gmail.com">send me an email</a>.</p>
20+
21+
<p>Issues whose section title is followed by a superscript ¹ were
22+
fixed after the first print of the book, and will not be present in
23+
later prints.</p>
1924

2025
<h2>Introduction</h2>
2126

22-
<p><strong>Page 4</strong>: The sentence “You can probably imagine
23-
how how tedious…” duplicates the word <em>how</em>.</p>
27+
<p><strong>Page 4</strong> (Why Language Matters¹): The sentence “You
28+
can probably imagine how how tedious…” duplicates the
29+
word <em>how</em>.</p>
2430

2531
<h2>Chapter 9</h2>
2632

27-
<p><strong>Page 159</strong> (The Date Type):
33+
<p><strong>Page 159</strong> (The Date Type¹):
2834
The <code>findDate</code> function produces the wrong months. The
2935
second argument given to <code>new Date</code> should
3036
be <code>Number(match[2]) - 1</code>, subtracting one to compensate
3137
for the fact that months start at zero in this interface.</p>
3238

39+
<p><strong>Page 162</strong> (Backtracking): The regular expression
40+
should have another <code>+</code> sign after the <code>[\da-f]</code>
41+
group to match what it is described as matching. The diagram for the
42+
expression is similarly missing an arrow looping back around the
43+
corresponding box.</p>
44+
3345
<h2>Chapter 10</h2>
3446

35-
<p><strong>Page 185</strong> (Slow-Loading Modules): In the code
47+
<p><strong>Page 185</strong> (Slow-Loading Modules¹): In the code
3648
snippet for <code>define</code>, the second use of
3749
the <code>every</code> method is incorrect. The call should be
3850
to <code>myMod.onLoad.forEach</code> instead.</p>
3951

4052
<h2>Chapter 11</h2>
4153

42-
<p><strong>Page 192</strong> (Parsing): The example Egg program has
54+
<p><strong>Page 192</strong> (Parsing¹): The example Egg program has
4355
its parentheses distributed incorrectly. One closing parentheses from
4456
the second line should be moved to the end of the last line.</p>
4557

4658
<h2>Chapter 14</h2>
4759

48-
<p><strong>Page 242</strong> (Mouse Motion): The example
60+
<p><strong>Page 242</strong> (Mouse Motion¹): The example
4961
uses <code>event.which</code> to detect mouse button release. This
5062
only works in Chrome and Safari. See
5163
the <a href="14_event.html#c_xBQPHox4ts">updated code</a>
@@ -54,23 +66,23 @@ <h2>Chapter 14</h2>
5466

5567
<h2>Chapter 16</h2>
5668

57-
<p><strong>Page 281</strong> (Curves): The text refers to
69+
<p><strong>Page 281</strong> (Curves¹): The text refers to
5870
the <code>bezierCurve</code> method. This method is actually
5971
called <code>bezierCurveTo</code> (as in the example code).</p>
6072

61-
<p><strong>Page 282</strong> (Curves): Where it says the picture shows
73+
<p><strong>Page 282</strong> (Curves¹): Where it says the picture shows
6274
a line from the left of the circle to the left of the quarter circle,
6375
it should definitely say <em>right</em> in both instances.</p>
6476

6577
<h2>Chapter 17</h2>
6678

67-
<p><strong>Page 312</strong> (Summary): The code example uses
79+
<p><strong>Page 312</strong> (Summary¹): The code example uses
6880
the <code>statusCode</code> property. This does not exist, since the
6981
property is actually called <code>status</code>.</p>
7082

7183
<h2>Chapter 18</h2>
7284

73-
<p><strong>Page 327</strong> (Summary): “When the user has selected
85+
<p><strong>Page 327</strong> (Summary¹): “When the user has selected
7486
a <em>field</em>” should be “When the user has selected
7587
a <em>file</em>”.
7688

0 commit comments

Comments
 (0)