Skip to content

add lang="en" and class="notranslate" for chrome translate #1175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add lang="en" and class="notranslate" for chrome translate
  • Loading branch information
Yunfei committed Sep 23, 2024
commit 14df5ac892084a9ef59c3f8a43cab75257240364
2 changes: 1 addition & 1 deletion site/404.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>404 Page Not Found &middot; Crafting Interpreters</title>
2 changes: 1 addition & 1 deletion site/a-bytecode-virtual-machine.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Bytecode Virtual Machine &middot; Crafting Interpreters</title>
6 changes: 3 additions & 3 deletions site/a-map-of-the-territory.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Map of the Territory &middot; Crafting Interpreters</title>
@@ -268,10 +268,10 @@ <h3><a href="#optimization" id="optimization"><small>2&#8202;.&#8202;1&#8202;.&#
<p>A simple example is <strong>constant folding</strong>: if some expression always evaluates to
the exact same value, we can do the evaluation at compile time and replace the
code for the expression with its result. If the user typed in this:</p>
<div class="codehilite"><pre><span class="i">pennyArea</span> = <span class="n">3.14159</span> * (<span class="n">0.75</span> / <span class="n">2</span>) * (<span class="n">0.75</span> / <span class="n">2</span>);
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">pennyArea</span> = <span class="n">3.14159</span> * (<span class="n">0.75</span> / <span class="n">2</span>) * (<span class="n">0.75</span> / <span class="n">2</span>);
</pre></div>
<p>we could do all of that arithmetic in the compiler and change the code to:</p>
<div class="codehilite"><pre><span class="i">pennyArea</span> = <span class="n">0.4417860938</span>;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">pennyArea</span> = <span class="n">0.4417860938</span>;
</pre></div>
<p>Optimization is a huge part of the programming language business. Many language
hackers spend their entire careers here, squeezing every drop of performance
2 changes: 1 addition & 1 deletion site/a-tree-walk-interpreter.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>A Tree-Walk Interpreter &middot; Crafting Interpreters</title>
124 changes: 62 additions & 62 deletions site/a-virtual-machine.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/acknowledgements.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Acknowledgements &middot; Crafting Interpreters</title>
14 changes: 7 additions & 7 deletions site/appendix-i.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Appendix I &middot; Crafting Interpreters</title>
@@ -89,12 +89,12 @@ <h2><a href="#syntax-grammar" id="syntax-grammar"><small>A1&#8202;.&#8202;1</sma
<p>The syntactic grammar is used to parse the linear sequence of tokens into the
nested syntax tree structure. It starts with the first rule that matches an
entire Lox program (or a single REPL entry).</p>
<div class="codehilite"><pre><span class="i">program</span><span class="i">declaration</span>* <span class="t">EOF</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">program</span><span class="i">declaration</span>* <span class="t">EOF</span> ;
</pre></div>
<h3><a href="#declarations" id="declarations"><small>A1&#8202;.&#8202;1&#8202;.&#8202;1</small>Declarations</a></h3>
<p>A program is a series of declarations, which are the statements that bind new
identifiers or any of the other statement types.</p>
<div class="codehilite"><pre><span class="i">declaration</span><span class="i">classDecl</span>
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">declaration</span><span class="i">classDecl</span>
| <span class="i">funDecl</span>
| <span class="i">varDecl</span>
| <span class="i">statement</span> ;
@@ -107,7 +107,7 @@ <h3><a href="#declarations" id="declarations"><small>A1&#8202;.&#8202;1&#8202;.&
<h3><a href="#statements" id="statements"><small>A1&#8202;.&#8202;1&#8202;.&#8202;2</small>Statements</a></h3>
<p>The remaining statement rules produce side effects, but do not introduce
bindings.</p>
<div class="codehilite"><pre><span class="i">statement</span><span class="i">exprStmt</span>
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">statement</span><span class="i">exprStmt</span>
| <span class="i">forStmt</span>
| <span class="i">ifStmt</span>
| <span class="i">printStmt</span>
@@ -133,7 +133,7 @@ <h3><a href="#expressions" id="expressions"><small>A1&#8202;.&#8202;1&#8202;.&#8
different levels of precedence. Some grammars for languages do not directly
encode the precedence relationships and specify that elsewhere. Here, we use a
separate rule for each precedence level to make it explicit.</p>
<div class="codehilite"><pre><span class="i">expression</span><span class="i">assignment</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">expression</span><span class="i">assignment</span> ;

<span class="i">assignment</span> → ( <span class="i">call</span> <span class="s">&quot;.&quot;</span> )? <span class="t">IDENTIFIER</span> <span class="s">&quot;=&quot;</span> <span class="i">assignment</span>
| <span class="i">logic_or</span> ;
@@ -154,15 +154,15 @@ <h3><a href="#expressions" id="expressions"><small>A1&#8202;.&#8202;1&#8202;.&#8
<h3><a href="#utility-rules" id="utility-rules"><small>A1&#8202;.&#8202;1&#8202;.&#8202;4</small>Utility rules</a></h3>
<p>In order to keep the above rules a little cleaner, some of the grammar is
split out into a few reused helper rules.</p>
<div class="codehilite"><pre><span class="i">function</span><span class="t">IDENTIFIER</span> <span class="s">&quot;(&quot;</span> <span class="i">parameters</span>? <span class="s">&quot;)&quot;</span> <span class="i">block</span> ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="i">function</span><span class="t">IDENTIFIER</span> <span class="s">&quot;(&quot;</span> <span class="i">parameters</span>? <span class="s">&quot;)&quot;</span> <span class="i">block</span> ;
<span class="i">parameters</span><span class="t">IDENTIFIER</span> ( <span class="s">&quot;,&quot;</span> <span class="t">IDENTIFIER</span> )* ;
<span class="i">arguments</span><span class="i">expression</span> ( <span class="s">&quot;,&quot;</span> <span class="i">expression</span> )* ;
</pre></div>
<h2><a href="#lexical-grammar" id="lexical-grammar"><small>A1&#8202;.&#8202;2</small>Lexical Grammar</a></h2>
<p>The lexical grammar is used by the scanner to group characters into tokens.
Where the syntax is <a href="https://en.wikipedia.org/wiki/Context-free_grammar">context free</a>, the lexical grammar is <a href="https://en.wikipedia.org/wiki/Regular_grammar">regular</a><span class="em">&mdash;</span>note
that there are no recursive rules.</p>
<div class="codehilite"><pre><span class="t">NUMBER</span><span class="t">DIGIT</span>+ ( <span class="s">&quot;.&quot;</span> <span class="t">DIGIT</span>+ )? ;
<div class="codehilite notranslate"><pre class="notranslate"><span class="t">NUMBER</span><span class="t">DIGIT</span>+ ( <span class="s">&quot;.&quot;</span> <span class="t">DIGIT</span>+ )? ;
<span class="t">STRING</span><span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span> &lt;<span class="i">any</span> <span class="i">char</span> <span class="i">except</span> <span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span>&gt;* <span class="s">&quot;</span><span class="e">\&quot;</span><span class="s">&quot;</span> ;
<span class="t">IDENTIFIER</span><span class="t">ALPHA</span> ( <span class="t">ALPHA</span> | <span class="t">DIGIT</span> )* ;
<span class="t">ALPHA</span><span class="s">&quot;a&quot;</span> ... <span class="s">&quot;z&quot;</span> | <span class="s">&quot;A&quot;</span> ... <span class="s">&quot;Z&quot;</span> | <span class="s">&quot;_&quot;</span> ;
94 changes: 47 additions & 47 deletions site/appendix-ii.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/backmatter.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Backmatter &middot; Crafting Interpreters</title>
210 changes: 105 additions & 105 deletions site/calls-and-functions.html

Large diffs are not rendered by default.

162 changes: 81 additions & 81 deletions site/chunks-of-bytecode.html

Large diffs are not rendered by default.

96 changes: 48 additions & 48 deletions site/classes-and-instances.html

Large diffs are not rendered by default.

192 changes: 96 additions & 96 deletions site/classes.html

Large diffs are not rendered by default.

204 changes: 102 additions & 102 deletions site/closures.html

Large diffs are not rendered by default.

148 changes: 74 additions & 74 deletions site/compiling-expressions.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/contents.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Table of Contents &middot; Crafting Interpreters</title>
84 changes: 42 additions & 42 deletions site/control-flow.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/dedication.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Dedication &middot; Crafting Interpreters</title>
102 changes: 51 additions & 51 deletions site/evaluating-expressions.html

Large diffs are not rendered by default.

144 changes: 72 additions & 72 deletions site/functions.html

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions site/garbage-collection.html

Large diffs are not rendered by default.

162 changes: 81 additions & 81 deletions site/global-variables.html

Large diffs are not rendered by default.

110 changes: 55 additions & 55 deletions site/hash-tables.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Crafting Interpreters</title>
84 changes: 42 additions & 42 deletions site/inheritance.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions site/introduction.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Introduction &middot; Crafting Interpreters</title>
@@ -269,7 +269,7 @@ <h3><a href="#snippets" id="snippets"><small>1&#8202;.&#8202;2&#8202;.&#8202;2</
program in a runnable state even when major features are missing, sometimes we
add temporary code that gets replaced in later snippets.</p>
<p>A snippet with all the bells and whistles looks like this:</p>
<div class="codehilite"><pre class="insert-before">
<div class="codehilite notranslate"><pre class="insert-before">
default:
</pre><div class="source-file"><em>lox/Scanner.java</em><br>
in <em>scanToken</em>()<br>
108 changes: 54 additions & 54 deletions site/jumping-back-and-forth.html

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions site/local-variables.html

Large diffs are not rendered by default.

158 changes: 79 additions & 79 deletions site/methods-and-initializers.html

Large diffs are not rendered by default.

76 changes: 38 additions & 38 deletions site/optimization.html

Large diffs are not rendered by default.

116 changes: 58 additions & 58 deletions site/parsing-expressions.html

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions site/representing-code.html

Large diffs are not rendered by default.

186 changes: 93 additions & 93 deletions site/resolving-and-binding.html

Large diffs are not rendered by default.

154 changes: 77 additions & 77 deletions site/scanning-on-demand.html

Large diffs are not rendered by default.

148 changes: 74 additions & 74 deletions site/scanning.html

Large diffs are not rendered by default.

188 changes: 94 additions & 94 deletions site/statements-and-state.html

Large diffs are not rendered by default.

120 changes: 60 additions & 60 deletions site/strings.html

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions site/superclasses.html

Large diffs are not rendered by default.

82 changes: 41 additions & 41 deletions site/the-lox-language.html

Large diffs are not rendered by default.

96 changes: 48 additions & 48 deletions site/types-of-values.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion site/welcome.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title>Welcome &middot; Crafting Interpreters</title>