@lcap/nasl-parser
Version:
Take Nasl text to Nasl AST with the help of generalized parsing.
25 lines (19 loc) • 499 B
text/typescript
import { Parser, Grammar } from "nearley";
import grammar from "../../ts/nasl";
const testOptionalSemiStr =`
logic aac() {
let x = 1
let y = 2;
if (x) { }
if (x) { } else { }
x = 12
x = 123;
x = 1234
}`
describe('Test optional semicolon', () => {
test('Test optional semicolon 1', async () => {
const parser = new Parser(Grammar.fromCompiled(grammar));
parser.feed(testOptionalSemiStr);
expect(parser.results.length).toBe(1);
});
});