Exemple #1
0
    /// Callback executed by the Lua syntax() function.
    ///
    /// \param syntax_version The syntax format version as provided by the
    ///     configuration file in the call to syntax().
    void
    syntax_callback(const int syntax_version)
    {
        if (_syntax_called)
            throw syntax_error("syntax() can only be called once");
        _syntax_called = true;

        // Allow the parser caller to populate the tree with its own schema
        // depending on the format/version combination.
        _parent->setup(_tree, syntax_version);

        // Export the config module to the Lua state so that all global variable
        // accesses are redirected to the configuration tree.
        config::redirect(_state, _tree);
    }