Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- This file: -- http://anggtwu.net/LUA/ParseTikz1.lua.html -- http://anggtwu.net/LUA/ParseTikz1.lua -- (find-angg "LUA/ParseTikz1.lua") -- Author: Eduardo Ochs <eduardoochs@gmail.com> -- -- See: (find-es "tikz" "tikz-non-terminals") -- http://anggtwu.net/IMAGES/2024-ParseTikz1-1.png -- -- (defun e () (interactive) (find-angg "LUA/ParseTikz1.lua")) -- (defun o () (interactive) (find-angg "LUA/ParseTree2.lua")) -- (find-angg "LUA/MapAST1.lua") -- -- «.grammar-2» (to "grammar-2") -- «.grammar-2-tests» (to "grammar-2-tests") require "Tos3" -- (find-angg "LUA/Tos3.lua") require "ELpeg1" -- (find-angg "LUA/ELpeg1.lua") require "MapAST2" -- (find-angg "LUA/MapAST2.lua") require "ToTeX1" -- (find-angg "LUA/ToTeX1.lua") -- (find-angg "LUA/ToTeX1.lua" "totexer") -- (find-angg "LUA/ParseTree2.lua" "grammar") -- (find-angg "LUA/SubstInSteps1.lua") -- (find-es "tikz" "path-operations") -- (find-es "tikz" "labels-next-to-lines") -- (find-angg "LUA/ELpeg1.lua" "AST") Gram.__index.be = true Gram.__index.cm0 = function (gr, top, newsubj, pos) subj = newsubj if type(pos) == "string" then pos = subj:match(pos) end return gr:compile(top):match(subj, pos) end gr,V,VA,VE,PE = Gram.new() _ = S(" ")^0 VA.Name = C"(c)" VA.CanvasPolar = C"(240:1)" VA.Coordinate = V.CanvasPolar VA.NameAtCoordinate = V.Name *_* C"at" *_* V.Coordinate VA.Contents = C"{C}" VA.Node = C"node" *_* V.NameAtCoordinate *_* V.Contents --[[ * (show2-use "/tmp/Show2.tex") * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) dofile "ParseTikz1.lua" MapAST.__index.trivs = Set.from(split("var num")) o = gr:cm0("Node", "node (c) at (240:1) {C}") = subj = o = o:delstrings() = o:dotstrings() = o:delstrings():underbracify() o10 = o:delstrings():underbracify() = o10:show {em=1} * (etv) --]] -- \path [draw] [->] (node cs:name=c) to node [swap] {CA} (node cs:name=a); -- ------- ------- ---------------- ------- -------- ---------------- -- Options Options Coordinate Options Contents Coordinate -- ---------------- --------------------- ---------------- -- MoveTo Node MoveTo -- ---------------- ---------------- -- PathOp PathOp -- ---------------- -- Path -- ----------------------------------------- -- ToPath -- ----------------------------------------- -- PathOp -- -------------------------------------------------------------------------- -- PathSpec -- «grammar-2» (to ".grammar-2") gr,V,VA,VE,PE = Gram.new() _ = S(" ")^0 VA.Options = C"[draw]" + C"[->]" + C"[swap]" VA.Coordinate = C"(node cs:name=a)" + C"(node cs:name=c)" VA.Contents = C"{CA}" VA.MoveTo = V.Coordinate VA.Node = C"node" *_* V.Options *_* V.Contents VA.ToPath = C"to" *_* V.Node *_* V.Path VA.Path = V.PathOp VA.PathOp = V.MoveTo + V.ToPath VA.PathSpec = oneormorec(V.Options + V.PathOp, "") -- «grammar-2-tests» (to ".grammar-2-tests") --[[ * (show2-use "/tmp/Show2.tex") * (eepitch-lua51) * (eepitch-kill) * (eepitch-lua51) -- (find-angg "LUA/MapAST2.lua" "totex") -- (find-angg "LUA/MapAST2.lua" "totex" "<>") dofile "ParseTikz1.lua" o = gr:cm0("PathOp", "(node cs:name=c)") o = gr:cm0("ToPath", "to node [swap] {CA} (node cs:name=a)") o = gr:cm0("PathSpec", "[draw] [->] (node cs:name=c) to node [swap] {CA} (node cs:name=a)") = subj = o = o:delstrings() = o:dotstrings() -- = o:delstrings():underbracify() o10 = o:delstrings():underbracify() = o10:show {em=1,scale=0.8} * (etv) --]] -- Local Variables: -- coding: utf-8-unix -- End: