%D \module
%D   [       file=mult-prm,
%D        version=2011.09.18, % actually older
%D          title=\CONTEXT\ Multilingual Macros,
%D       subtitle=Primitives,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is therefore
%C copyrighted by \PRAGMA. See mreadme.pdf for details.

%D This file is only a helper for generating files that can be used in an
%D editor for syntax highlighting.

\startluacode

    context.starttext()

    function table.sorted(t)
        table.sort(t)
        return t
    end

    local missing = {
        tex = {
            "def", "catcode", "futurelet", "chardef",
            "voffset", "hoffset",
            "numexpr", "dimexpr",
            "write", "dump", "skipdef,"
        },
        etex = {
            "savingvdiscards",
        },
        pdftex = {
        },
        luatex = {
        },
        aleph = {
            "AlephVersion", "Alephminorversion", "Alephrevision", "Alephversion",
        },
        omega = {
            "Omegaminorversion", "Omegarevision", "Omegaversion",
            "omathcode", "odelcode", "omathchardef", "omathchar", "omathaccent", "odelimiter", "oradical",
        },
        xetex = {
            "XeTeXversion",
        },
        plain = {
            "TeX",
            "bgroup", "egroup", "endgraf", "space", "empty", "null",
            "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newhelp", "newread", "newwrite", "newfam", "newlanguage", "newinsert", "newif",
            "maxdimen", "magstephalf", "magstep",
            "frenchspacing", "nonfrenchspacing", "normalbaselines", "obeylines", "obeyspaces", "raggedright", "ttraggedright",
            "thinspace", "negthinspace", "enspace", "enskip", "quad", "qquad",
            "smallskip", "medskip", "bigskip", "removelastskip", "topglue", "vglue", "hglue",
            "break", "nobreak", "allowbreak", "filbreak", "goodbreak", "smallbreak", "medbreak", "bigbreak",
            "line", "leftline", "rightline", "centerline", "rlap", "llap", "underbar", "strutbox", "strut",
            "cases", "matrix", "pmatrix", "bordermatrix", "eqalign", "displaylines", "eqalignno", "leqalignno",
            "pageno", "folio", "tracingall", "showhyphens", "fmtname", "fmtversion",
            "hphantom", "vphantom", "phantom", "smash",
        },
    }

    local primitives = {
        tex    = table.sorted( table.merged( missing.tex   , table.fromhash(tex.primitives()) ) ),
        etex   = table.sorted( table.merged( missing.etex  , tex.extraprimitives('etex')      ) ),
        pdftex = table.sorted( table.merged( missing.pdftex, tex.extraprimitives('pdftex')    ) ),
        luatex = table.sorted( table.merged( missing.luatex, tex.extraprimitives('luatex')    ) ),
        aleph  = table.sorted( table.merged( missing.aleph , tex.extraprimitives('aleph')     ) ),
        omega  = table.sorted( table.merged( missing.omega , tex.extraprimitives('omega')     ) ),
        xetex  = table.sorted( table.merged( missing.xetex , { }                              ) ),
    }

 -- table.remove(primitives.tex,1) -- get rid of \-

    io.savedata("mult-prm.lua",table.serialize(primitives,true,{ reduce = true, inline = false }))

    context.stoptext()

\stopluacode
