From 5518db1fd9c5e7853680f3f9eb23d4c71d29723a Mon Sep 17 00:00:00 2001 From: Sam Saint-Pettersen Date: Tue, 14 Jul 2015 20:17:45 +0100 Subject: [PATCH] Type definitions and tests for node luaparse module --- luaparse/luaparse-tests.ts | 10 ++++++++++ luaparse/luaparse.d.ts | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 luaparse/luaparse-tests.ts create mode 100644 luaparse/luaparse.d.ts diff --git a/luaparse/luaparse-tests.ts b/luaparse/luaparse-tests.ts new file mode 100644 index 0000000000..af10d12d64 --- /dev/null +++ b/luaparse/luaparse-tests.ts @@ -0,0 +1,10 @@ +/// + +import luaparse = require('luaparse'); + +var luacode: string = '-- this is hello world in lua.\nprint(\'hello world\')'; +var ast: Object = luaparse.parse(luacode); +console.log(JSON.stringify(ast)); + +ast = luaparse.parse(luacode, {comments: false}); +console.log(JSON.stringify(ast)); diff --git a/luaparse/luaparse.d.ts b/luaparse/luaparse.d.ts new file mode 100644 index 0000000000..311bf651dc --- /dev/null +++ b/luaparse/luaparse.d.ts @@ -0,0 +1,8 @@ +// Type definitions for luaparse +// Project: https://github.com/oxyc/luaparse +// Definitions by: Sam Saint-Pettersen +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "luaparse" { + export function parse(code: string, options?: Object): Object; +}