@@ -6,10 +6,12 @@
['html:gen-styles'] = true;
}
local function
-main(input, output, log, mode, suggestions, vars)
- local doc = ct.parse(input.stream, input.src, mode)
+main(input, output, log, mode, suggestions, vars, extrule)
+ local doc = ct.parse(input.stream, input.src, mode, function(c)
+ c.doc.ext = extrule
+ end)
input.stream:close()
if mode['parse:show-tree'] then
log:write(ss.dump(doc))
end
@@ -73,8 +75,13 @@
['mode-set-weak'] = 1;
['mode-clear-weak'] = 1;
['mode-weak'] = 2;
+ ['use'] = 1;
+ ['inhibit'] = 1;
+ ['need'] = 1;
+ ['load'] = 1;
+ ['enc'] = 1;
}
return param_opts[o] or 0
end
@@ -86,9 +93,14 @@
h = 'help';
y = 'mode-set', Y = 'mode-set-weak';
n = 'mode-clear', N = 'mode-clear-weak';
m = 'mode', M = 'mode-weak';
+ L = 'load',
+ u = 'use', i = 'inhibit', r = 'require';
+ e = 'enc';
}
+
+ local extrule = {use={},inhibit={},need={}}
local checkmodekey = function(key)
if not key:match '[^:]+:.+' then
ct.exns.cli('invalid mode key %s', key):throw()
@@ -120,9 +132,13 @@
['mode-weak'] = function(key,value) suggestions[checkmodekey(key)] = value end;
['mode-set-weak'] = function(key) suggestions[checkmodekey(key)] = true end;
['mode-clear-weak'] = function(key) suggestions[checkmodekey(key)] = false end;
-
+ ['use' ] = function(ext) extrule.use [ext] = true end;
+ ['inhibit'] = function(ext) extrule.inhibit[ext] = true end;
+ ['require'] = function(ext) extrule.need [ext] = true end;
+ ['load'] = function(extpath) end;
+ ['enc'] = function(enc) end;
['version'] = function()
outp:write(ct.info:about())
if next(ct.ext.loaded) then
outp:write('\nactive extensions:\n')
@@ -178,9 +194,9 @@
if keepParsing and longopt then
execLongOpt(longopt)
else
if keepParsing and v:sub(1,1) == '-' then
- for c,p in ss.str.enc.utf8.each(v:sub(2)) do
+ for c,p in ss.str.each(ss.str.enc.utf8, v:sub(2)) do
if optmap[c] then
execLongOpt(optmap[c])
else
ct.exns.cli('switch -%s unrecognized', c):throw()
@@ -200,13 +216,13 @@
input.stream = file
input.src.file = args[1]
end
- return main(input, outp, log, mode, suggestions, vars)
+ return main(input, outp, log, mode, suggestions, vars, extrule)
end
-local ok, e = pcall(entry_cli)
--- local ok, e = true, entry_cli()
+-- local ok, e = pcall(entry_cli)
+local ok, e = true, entry_cli()
if not ok then
local str = 'translation failure'
if ss.exn.is(e) then
str = e.kind.desc