hispano-lang 1.0.2 → 1.0.3
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/dist/index.js +3 -2
- package/dist/tokenizer.js +8 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45,8 +45,8 @@ function clearVariables() {
|
|
|
45
45
|
interpreter.clearEnvironment();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// Example usage
|
|
49
|
-
|
|
48
|
+
// Example usage (commented out to avoid execution when imported)
|
|
49
|
+
/*
|
|
50
50
|
const exampleCode = `
|
|
51
51
|
mostrar "Hola mundo"
|
|
52
52
|
`;
|
|
@@ -63,6 +63,7 @@ if (result.success) {
|
|
|
63
63
|
} else {
|
|
64
64
|
console.log('✗ Error:', result.error);
|
|
65
65
|
}
|
|
66
|
+
*/
|
|
66
67
|
|
|
67
68
|
// Export functions for use in other modules
|
|
68
69
|
module.exports = {
|
package/dist/tokenizer.js
CHANGED
|
@@ -191,7 +191,11 @@ class Tokenizer {
|
|
|
191
191
|
break;
|
|
192
192
|
|
|
193
193
|
case '"':
|
|
194
|
-
this.string();
|
|
194
|
+
this.string('"');
|
|
195
|
+
break;
|
|
196
|
+
|
|
197
|
+
case "'":
|
|
198
|
+
this.string("'");
|
|
195
199
|
break;
|
|
196
200
|
|
|
197
201
|
case '/':
|
|
@@ -218,9 +222,10 @@ class Tokenizer {
|
|
|
218
222
|
|
|
219
223
|
/**
|
|
220
224
|
* Processes a string literal
|
|
225
|
+
* @param {string} quoteType - Type of quote (' or ")
|
|
221
226
|
*/
|
|
222
|
-
string() {
|
|
223
|
-
while (this.peek() !==
|
|
227
|
+
string(quoteType = '"') {
|
|
228
|
+
while (this.peek() !== quoteType && !this.isAtEnd()) {
|
|
224
229
|
if (this.peek() === '\n') this.currentLine++;
|
|
225
230
|
this.advance();
|
|
226
231
|
}
|
package/package.json
CHANGED