Aligned to current syntax

This commit is contained in:
perro tuerto 2023-03-16 15:42:44 -07:00
parent 841e1733d4
commit 6bd36cfc16
4 changed files with 37 additions and 27 deletions

31
dist/lin.lua vendored
View File

@ -6262,6 +6262,10 @@ local fnl = mod
local nat = {} local nat = {}
function nat.parse(str)
return str
end
----------------------------------- LITERATE ---------------------------------- ----------------------------------- LITERATE ----------------------------------
-- Variable for all literate stuff -- Variable for all literate stuff
@ -6317,14 +6321,13 @@ function lit.eval(code)
end end
]]-- ]]--
function lit.parse_declarations(codeblock) function lit.parse_blocks(codeblock)
print(codeblock) print(codeblock)
return codeblock return codeblock
end end
function lit.parse_calls(inlines) function lit.parse_inserts(code)
str = pandoc.utils.stringify(inlines) print(code)
print(str)
-- lpeg.match(lit.g.inlines, raw) -- lpeg.match(lit.g.inlines, raw)
--[[ --[[
local doc = "" local doc = ""
@ -6336,27 +6339,29 @@ function lit.parse_calls(inlines)
end end
return doc return doc
]]-- ]]--
return inlines return code
end end
------------------------------------ PANDOC ----------------------------------- ------------------------------------ PANDOC -----------------------------------
return { return {
{ {
-- Parses LIN declarations -- Parses and evals literate blocks
CodeBlock = function(codeblock) CodeBlock = function(codeblock)
return lit.parse_declarations(codeblock) return lit.parse_blocks(codeblock)
end, end,
}, },
{ {
-- Avoids quotes conversion in stringify -- Parses literate inserts
Quoted = function(quoted) Code = function(code)
str = pandoc.utils.stringify(quoted.content):gsub('"', '\\"') return lit.parse_inserts(code)
return '"' .. str .. '"'
end, end,
-- Parses and does LIN calls -- Parses and evals natural programming
-- TODO
Inlines = function(inlines) Inlines = function(inlines)
return lit.parse_calls(inlines) md = pandoc.utils.stringify(inlines)
md = nat.parse(md)
return inlines
end, end,
} }
} }

View File

@ -53,14 +53,13 @@ function lit.eval(code)
end end
]]-- ]]--
function lit.parse_declarations(codeblock) function lit.parse_blocks(codeblock)
print(codeblock) print(codeblock)
return codeblock return codeblock
end end
function lit.parse_calls(inlines) function lit.parse_inserts(code)
str = pandoc.utils.stringify(inlines) print(code)
print(str)
-- lpeg.match(lit.g.inlines, raw) -- lpeg.match(lit.g.inlines, raw)
--[[ --[[
local doc = "" local doc = ""
@ -72,7 +71,7 @@ function lit.parse_calls(inlines)
end end
return doc return doc
]]-- ]]--
return inlines return code
end end
return lit return lit

View File

@ -2,4 +2,8 @@
local nat = {} local nat = {}
return natural function nat.parse(str)
return str
end
return nat

View File

@ -2,20 +2,22 @@
return { return {
{ {
-- Parses LIN declarations -- Parses and evals literate blocks
CodeBlock = function(codeblock) CodeBlock = function(codeblock)
return lit.parse_declarations(codeblock) return lit.parse_blocks(codeblock)
end, end,
}, },
{ {
-- Avoids quotes conversion in stringify -- Parses literate inserts
Quoted = function(quoted) Code = function(code)
str = pandoc.utils.stringify(quoted.content):gsub('"', '\\"') return lit.parse_inserts(code)
return '"' .. str .. '"'
end, end,
-- Parses and does LIN calls -- Parses and evals natural programming
-- TODO
Inlines = function(inlines) Inlines = function(inlines)
return lit.parse_calls(inlines) md = pandoc.utils.stringify(inlines)
md = nat.parse(md)
return inlines
end, end,
} }
} }