- Replaced leading whitespaces by tabs
This commit is contained in:
parent
e8dccbf5d8
commit
b8ded16210
32
pret-pas.lua
32
pret-pas.lua
|
@ -1,9 +1,9 @@
|
||||||
if not modules then modules = { } end modules ['pret-pas'] = {
|
if not modules then modules = { } end modules ['pret-pas'] = {
|
||||||
version = 1.0,
|
version = 1.0,
|
||||||
comment = "custom pretty printer for Pascal code",
|
comment = "custom pretty printer for Pascal code",
|
||||||
author = "Stefan Müller, Chemnitz DE",
|
author = "Stefan Müller, Chemnitz DE",
|
||||||
copyright = "Stefan Müller",
|
copyright = "Stefan Müller",
|
||||||
license = "see context related readme files"
|
license = "see context related readme files"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- The code formatting is adapted from Lazarus, a Free Pascal RAD IDE, which
|
-- The code formatting is adapted from Lazarus, a Free Pascal RAD IDE, which
|
||||||
|
@ -31,7 +31,7 @@ visualizer.reservedwords = {
|
||||||
-- "dispose", "exit", "false", "new", "true",
|
-- "dispose", "exit", "false", "new", "true",
|
||||||
|
|
||||||
-- Object Pascal
|
-- Object Pascal
|
||||||
"as", "class", "dispinterface", "except", "exports", "finalization",
|
"as", "class", "dispinterface", "except", "exports", "finalization",
|
||||||
"finally", "initialization", "inline", "is", "library", "on", "out",
|
"finally", "initialization", "inline", "is", "library", "on", "out",
|
||||||
"packed", "property", "raise", "resourcestring", "threadvar", "try",
|
"packed", "property", "raise", "resourcestring", "threadvar", "try",
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ visualizer.reservedwords = {
|
||||||
local known_words = { }
|
local known_words = { }
|
||||||
|
|
||||||
for k,v in next, visualizer.reservedwords do
|
for k,v in next, visualizer.reservedwords do
|
||||||
known_words[v] = k
|
known_words[v] = k
|
||||||
end
|
end
|
||||||
|
|
||||||
local colors = {
|
local colors = {
|
||||||
"prettyone", -- red: compiler directive, symbol
|
"prettyone", -- red: compiler directive, symbol
|
||||||
"prettytwo", -- green: assembler (dark green)
|
"prettytwo", -- green: assembler (dark green)
|
||||||
"prettythree", -- blue: comment, number (dark blue)
|
"prettythree", -- blue: comment, number (dark blue)
|
||||||
"prettyfour", -- yellow
|
"prettyfour", -- yellow
|
||||||
}
|
}
|
||||||
|
|
||||||
local reserved_style = "\{\\bf "
|
local reserved_style = "\{\\bf "
|
||||||
|
@ -64,7 +64,7 @@ local comment_style = "\{\\sl "
|
||||||
local inlongcomment, inlongcomment_alt, incompdirec, inasm = false, 0, false, false
|
local inlongcomment, inlongcomment_alt, incompdirec, inasm = false, 0, false, false
|
||||||
|
|
||||||
local function flush_pas_word(word, state)
|
local function flush_pas_word(word, state)
|
||||||
if word then
|
if word then
|
||||||
local lword = string.lower(word)
|
local lword = string.lower(word)
|
||||||
local id = known_words[lword]
|
local id = known_words[lword]
|
||||||
if id then
|
if id then
|
||||||
|
@ -88,7 +88,7 @@ local function flush_pas_word(word, state)
|
||||||
tex.write(word)
|
tex.write(word)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
tex.write(word)
|
tex.write(word)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return state
|
return state
|
||||||
|
@ -112,14 +112,14 @@ local function flush_whatever(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
function visualizer.reset()
|
function visualizer.reset()
|
||||||
inlongcomment, inlongcomment_alt, incompdirec, inasm = false, 0, false, false
|
inlongcomment, inlongcomment_alt, incompdirec, inasm = false, 0, false, false
|
||||||
end
|
end
|
||||||
|
|
||||||
function visualizer.flush_line(str, nested)
|
function visualizer.flush_line(str, nested)
|
||||||
local state = 0
|
local state = 0
|
||||||
local incomment, instring = false, false
|
local incomment, instring = false, false
|
||||||
--local code, comment = nil, nil
|
--local code, comment = nil, nil
|
||||||
buffers.currentcolors = colors
|
buffers.currentcolors = colors
|
||||||
|
|
||||||
if inlongcomment or (inlongcomment_alt == 2) or incompdirec then
|
if inlongcomment or (inlongcomment_alt == 2) or incompdirec then
|
||||||
incomment = true
|
incomment = true
|
||||||
|
|
Loading…
Reference in New Issue