Skip to content

Commit a9b8b76

Browse files
Merge pull request ryanmcdermott#244 from wolfoo2931/master
improve "Functions should only be one level of abstraction" example
2 parents 4373896 + d98f9e7 commit a9b8b76

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ function parseBetterJSAlternative(code) {
345345
```javascript
346346
function parseBetterJSAlternative(code) {
347347
const tokens = tokenize(code);
348-
const ast = lexer(tokens);
349-
ast.forEach((node) => {
348+
const syntaxTree = parse(tokens);
349+
syntaxTree.forEach((node) => {
350350
// parse...
351351
});
352352
}
@@ -367,13 +367,13 @@ function tokenize(code) {
367367
return tokens;
368368
}
369369

370-
function lexer(tokens) {
371-
const ast = [];
370+
function parse(tokens) {
371+
const syntaxTree = [];
372372
tokens.forEach((token) => {
373-
ast.push( /* ... */ );
373+
syntaxTree.push( /* ... */ );
374374
});
375375

376-
return ast;
376+
return syntaxTree;
377377
}
378378
```
379379
**[⬆ back to top](#table-of-contents)**

0 commit comments

Comments
 (0)