UNPKG

@lcap/nasl-parser

Version:

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

17 lines (13 loc) 422 B
import { Parser, Grammar } from "nearley"; import grammar from "../../ts/nasl"; const testStrIntp =` logic testStrIntp ( ) { let zmc = s" 123 \${xy - 1} abc "; }` describe('string interpolation', () => { test('string interpolation', async () => { const parser = new Parser(Grammar.fromCompiled(grammar)); parser.feed(testStrIntp); expect(parser.results.length).toBe(1); }); });