@lcap/nasl-parser
Version:
Take Nasl text to Nasl AST with the help of generalized parsing.
27 lines (22 loc) • 607 B
text/typescript
import { Parser, Grammar } from "nearley";
import grammar from "../../ts/nasl";
const simpleNamespace =`
namespace app {
namespace structures {
struct LCAPGetPermissionResult() { }
}
namespace dataSources {
namespace defaultDS {
namespace entities {
entity LCAPPermission() { }
}
}
}
}`
describe('Namespace', () => {
test('Simple namespace', async () => {
const parser = new Parser(Grammar.fromCompiled(grammar));
parser.feed(simpleNamespace);
expect(parser.results.length).toBe(1);
});
});