]> git.lizzy.rs Git - metalua.git/blob - metalua/compiler/parser.lua
Merge branch 'master' of ssh://git.eclipse.org/gitroot/koneki/org.eclipse.koneki...
[metalua.git] / metalua / compiler / parser.lua
1 --------------------------------------------------------------------------------
2 -- Copyright (c) 2006-2013 Fabien Fleutot and others.
3 --
4 -- All rights reserved.
5 --
6 -- This program and the accompanying materials are made available
7 -- under the terms of the Eclipse Public License v1.0 which
8 -- accompanies this distribution, and is available at
9 -- http://www.eclipse.org/legal/epl-v10.html
10 --
11 -- This program and the accompanying materials are also made available
12 -- under the terms of the MIT public license which accompanies this
13 -- distribution, and is available at http://www.lua.org/license.html
14 --
15 -- Contributors:
16 --     Fabien Fleutot - API and implementation
17 --
18 --------------------------------------------------------------------------------
19
20 -- Export all public APIs from sub-modules, squashed into a flat spacename
21
22 local MT = { __type='metalua.compiler.parser' }
23
24 local MODULE_REL_NAMES = { "annot.grammar", "expr", "meta", "misc",
25                            "stat", "table", "ext" }
26
27 local function new()
28     local M = {
29         lexer = require "metalua.compiler.parser.lexer" ();
30         extensions = { } }
31     for _, rel_name in ipairs(MODULE_REL_NAMES) do
32         local abs_name = "metalua.compiler.parser."..rel_name
33         local extender = require (abs_name)
34         if not M.extensions[abs_name] then
35             if type (extender) == 'function' then extender(M) end
36             M.extensions[abs_name] = extender
37         end
38     end
39     return setmetatable(M, MT)
40 end
41
42 return { new = new }