UNPKG

@lcap/nasl-parser

Version:

Take Nasl text to Nasl AST with the help of generalized parsing.

20 lines (15 loc) 441 B
import { Parser, Grammar } from "nearley"; import grammar from "../../ts/nasl"; const testJSString =` logic testJSString() { let a = js"let x = 1 "; let b = js' let x = 1;'; let z = \`123\`; }` describe('string...', () => { test.skip('js string', async () => { const parser = new Parser(Grammar.fromCompiled(grammar)); parser.feed(testJSString); expect(parser.results.length).toBe(1); }); });