@lcap/nasl-parser
Version:
Take Nasl text to Nasl AST with the help of generalized parsing.
16 lines (12 loc) • 420 B
text/typescript
import { Parser, Grammar } from "nearley";
import grammar from "../../ts/nasl";
const testLogicDecl= `
declare logic ff ( x : Integer, y : Bool ) => result : Integer;
`
describe('Test Logic Declaration', () => {
test('Logic Declaration', async () => {
const parser = new Parser(Grammar.fromCompiled(grammar));
parser.feed(testLogicDecl);
expect(parser.results.length).toBe(1);
});
});