@@ -41,7 +41,7 @@ The limitation of syntax extension lead into introducing a new Lexer and a Strea
41
41
Parser (if you're interested in this topic I will be writing an article about this in the
42
42
future).
43
43
44
- The new Lexer is much simpler and easier to maintain, only had one bug recenly related to
44
+ The new Lexer is much simpler and easier to maintain, only had one bug recently related to
45
45
Lexer inner working ([ #433 ] ( https://github.com/jcubic/lips/issues/433 ) ).
46
46
47
47
The new Lexer is a class that have rules for the state machine, this is an example
@@ -62,7 +62,7 @@ Lexer._rules = [
62
62
]
63
63
```
64
64
65
- The single rule is consisted of a currect character, next character, and a previous
65
+ The single rule is consisted of a current character, next character, and a previous
66
66
character (they can be single character strings or regular expressions). If the character
67
67
is null it can be any character. The last two elements of the array are the starting and
68
68
the ending state (they are symbols so they are unique values).
@@ -82,7 +82,7 @@ That's why in above example there are no rule like this:
82
82
83
83
This rule may be added in the future to speed up the Lexer.
84
84
85
- ### Exmaple
85
+ ### Example
86
86
87
87
When we have a string like this:
88
88
@@ -91,11 +91,11 @@ When we have a string like this:
91
91
```
92
92
93
93
It matches the second rule because the first character is a quote, so it enters
94
- ` Lexer.string ` state. The first rule don't match becuase the inital state is null. For
95
- characters ` foo ` it collects the tokens becasue no rule match them. When it finds slash
94
+ ` Lexer.string ` state. The first rule don't match because the initial state is null. For
95
+ characters ` foo ` it collects the tokens because no rule match them. When it finds slash
96
96
` \ ` it changes state from ` Lexer.string ` to ` Lexer.string_escape ` , and for next character
97
97
it enters again ` Lexer.string ` . Then it consumes sequence of characters ` bar ` , and the
98
- last quote maches the first rule. And that's how we have the full token.
98
+ last quote matches the first rule. And that's how we have the full token.
99
99
100
100
### Syntax Extensions and Constants
101
101
@@ -118,6 +118,6 @@ maintain. If you want to look how it works for yourself. You can jump into
118
118
search for ` "class Lexer" ` , ` "Lexer._rule" ` , ` Object.defineProperty(Lexer, 'rules' ` .
119
119
120
120
The source code is in one file, so to navigate you need to use search. I've made an attempt to split
121
- the code into modules, but failed. Becuse of Rollup errors about circular dependencies.
121
+ the code into modules, but failed. Because of Rollup errors about circular dependencies.
122
122
123
123
This was first part of articles about [ LIPS Scheme Internals] ( https://github.com/jcubic/lips/issues/437 ) .
0 commit comments