epoxylang 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/hybrid.epx +2 -2
- package/examples/test.epx +3 -2
- package/package.json +1 -1
- package/src/lexer/lexer.js +8 -3
package/examples/hybrid.epx
CHANGED
package/examples/test.epx
CHANGED
package/package.json
CHANGED
package/src/lexer/lexer.js
CHANGED
|
@@ -104,6 +104,10 @@ class Lexer {
|
|
|
104
104
|
|
|
105
105
|
// Skip any whitespace before ~
|
|
106
106
|
this.skipWhitespace();
|
|
107
|
+
if (this.current !== ':') {
|
|
108
|
+
throw new Error("Expected ':' after '@js'");
|
|
109
|
+
}
|
|
110
|
+
this.advance();
|
|
107
111
|
|
|
108
112
|
if (this.current !== '~') {
|
|
109
113
|
throw new Error("Expected '~' after '@js'");
|
|
@@ -113,16 +117,17 @@ class Lexer {
|
|
|
113
117
|
// Capture everything until closing '~'
|
|
114
118
|
let code = "";
|
|
115
119
|
|
|
116
|
-
while (this.current && this.current !== '~') {
|
|
120
|
+
while (this.current && this.current !== '~' && this.peek !== ':') {
|
|
117
121
|
code += this.current;
|
|
118
122
|
this.advance();
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
if (this.current !== '~') {
|
|
122
|
-
throw new Error("Unterminated @js block - missing closing '
|
|
125
|
+
if (this.current !== '~' && this.peek !== ':') {
|
|
126
|
+
throw new Error("Unterminated @js block - missing closing '~:'");
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
this.advance(); // skip closing '~'
|
|
130
|
+
this.advance(); // skip closing ':'
|
|
126
131
|
|
|
127
132
|
return new Token(TokenType.JSBLOCK, code);
|
|
128
133
|
}
|