|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file:
-- http://angg.twu.net/LUA/LuaTex1.lua.html
-- http://angg.twu.net/LUA/LuaTex1.lua
-- (find-angg "LUA/LuaTex1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun e () (interactive) (find-angg "LUA/LuaTex1.lua"))
-- (find-es "luatex" "inspecting-defs")
--
-- «.Token» (to "Token")
-- «.Token-tests» (to "Token-tests")
-- _____ _
-- |_ _|__ | | _____ _ __
-- | |/ _ \| |/ / _ \ '_ \
-- | | (_) | < __/ | | |
-- |_|\___/|_|\_\___|_| |_|
--
-- «Token» (to ".Token")
-- (find-luatexrefpage (+ 4 213) "10.6.3 Creating tokens")
-- (find-luatexreftext (+ 4 213) "10.6.3 Creating tokens")
-- (find-luatexrefpage (+ 4 213) "token.create")
-- (find-luatexreftext (+ 4 213) "token.create")
-- (find-luatexrefpage (+ 4 214) "get_macro")
-- (find-luatexreftext (+ 4 214) "get_macro")
-- (find-luatexrefpage (+ 4 220) "get_meaning")
-- (find-luatexreftext (+ 4 220) "get_meaning")
-- (find-luatexrefpage (+ 4 215) "token.expand")
-- (find-luatexreftext (+ 4 215) "token.expand")
--
Token = Class {
type = "Token",
create = function (_)
return Token {_=_, __=token.create(_)}:getfields()
end,
__tostring = mytostringv,
__index = {
fields = [[ command cmdname csname id tok active
expandable protected mode index ]],
getfields = function (tk)
for _,name in ipairs(split(tk.fields)) do tk[name] = tk.__[name] end
return tk
end,
expand = function (tk) return token.expand(tk.__) end,
get_macro = function (tk) return token.get_macro(tk._) end,
get_meaning = function (tk) return token.get_meaning(tk._) end,
},
}
-- «Token-tests» (to ".Token-tests")
--[[
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/LATEX/
lualatex 2022tikz-repl.tex # (find-LATEX "2022tikz-repl.tex" "tests")
ee_dofile "~/LUA/LuaTex1.lua" -- (find-angg "LUA/LuaTex1.lua")
tk = Token.create "repl"
tk = Token.create "bletch"
= tk
= tk:expand() -- semi-broken
= tk:get_macro()
= tk:get_meaning()
= token.get_macro("bletch")
= token.get_meaning("bletch")
= tk.expand
= tk:expand()
= token.expand("foo")
= token.expand("repl")
= token.expand("\\repl")
token.expand(tk.__)
token.expand({tk.__})
token.expand({"repl"})
token.expand({"\\repl"})
= token.expand
--]]
-- Local Variables:
-- coding: utf-8-unix
-- End: