diff --git a/packages/goldstein/index.spec.js b/packages/goldstein/index.spec.js index 9d9f8b6..1f9f429 100644 --- a/packages/goldstein/index.spec.js +++ b/packages/goldstein/index.spec.js @@ -259,6 +259,7 @@ test('goldstein: parse: if let', (t) => { const expected = montag` { let a = b?.c; + if (a) { log(a); } diff --git a/packages/keyword-broken-string/fixture/infinite.gs b/packages/keyword-broken-string/fixture/infinite.gs new file mode 100644 index 0000000..ba8c260 --- /dev/null +++ b/packages/keyword-broken-string/fixture/infinite.gs @@ -0,0 +1 @@ +const a = 'b \ No newline at end of file diff --git a/packages/keyword-broken-string/fixture/infinite.js b/packages/keyword-broken-string/fixture/infinite.js new file mode 100644 index 0000000..e309ee6 --- /dev/null +++ b/packages/keyword-broken-string/fixture/infinite.js @@ -0,0 +1 @@ +const a = ''; diff --git a/packages/keyword-broken-string/index.js b/packages/keyword-broken-string/index.js index 9aef6eb..668cd61 100644 --- a/packages/keyword-broken-string/index.js +++ b/packages/keyword-broken-string/index.js @@ -17,6 +17,9 @@ export default function keywordBrokenString(Parser) { for (;;) { const ch = this.input.charCodeAt(this.pos); + if (!ch) + break; + if (ch === quote) break; diff --git a/packages/keyword-broken-string/index.spec.js b/packages/keyword-broken-string/index.spec.js index d58e036..d9e5224 100644 --- a/packages/keyword-broken-string/index.spec.js +++ b/packages/keyword-broken-string/index.spec.js @@ -12,3 +12,8 @@ test('goldstein: broken-string: no-semi', (t) => { t.compile('no-semi'); t.end(); }); + +test('goldstein: broken-string: infinite', (t) => { + t.compile('infinite'); + t.end(); +}); diff --git a/packages/keyword-if/fixture/if-let.js b/packages/keyword-if/fixture/if-let.js index 84ca2b7..9582eb5 100644 --- a/packages/keyword-if/fixture/if-let.js +++ b/packages/keyword-if/fixture/if-let.js @@ -1,6 +1,7 @@ let a = 5; { let x = john.info?.name; + if (x) { print(x); }