- More code clean-up

This commit is contained in:
Stefan Müller 2010-09-30 14:06:14 +02:00
parent 04b05f14ba
commit 55cef57db4
2 changed files with 19 additions and 8 deletions

View File

@ -71,10 +71,10 @@ local function flush_pas_word(word)
end end
end end
local incomment, inlongstring, incompdirec, inasm = false, false, false, false local inlongcomment, incompdirec, inasm = false, false, false
function visualizer.reset() function visualizer.reset()
incomment, inlongstring, incompdirec, inasm = false, false, false, false inlongcomment, incompdirec, inasm = false, false, false
end end
--[[local function written(state, c, i) --[[local function written(state, c, i)
@ -94,9 +94,23 @@ end
end]] end]]
function visualizer.flush_line(str, nested) function visualizer.flush_line(str, nested)
local state, instr, inesc, word = 0, false, false, nil local state, word = 0, nil
buffers.currentcolors = colors buffers.currentcolors = colors
--[[
print("SEARCHING FOR IDENTIFIERS IN: " .. str)
local remain = str
local identifier
repeat
identifier = nil
identifier, remain = string.match(remain, "^[^%a_]*([%a_]+[%a%d_]*)(.*)$")
if identifier then
print("IDENTIFIER: " .. identifier)
--print("REMAIN: " .. remain)
end
until not identifier
]]
--state = buffers.changestate(1, state) --state = buffers.changestate(1, state)
for c in string.utfcharacters(str) do for c in string.utfcharacters(str) do
if string.find(c, "^[%a_]$") then if string.find(c, "^[%a_]$") then
@ -106,7 +120,6 @@ function visualizer.flush_line(str, nested)
else else
word = c word = c
end end
--state = buffers.changestate(2, state)
elseif string.find(c, "^[%d]$") then elseif string.find(c, "^[%d]$") then
if word and (#word > 1) then if word and (#word > 1) then
-- number, that belongs to identifier -- number, that belongs to identifier
@ -116,7 +129,6 @@ function visualizer.flush_line(str, nested)
state = buffers.changestate(3, state) state = buffers.changestate(3, state)
tex.write(c) tex.write(c)
end end
--state = buffers.changestate(3, state)
else else
flush_pas_word(word) flush_pas_word(word)
word = nil word = nil
@ -135,7 +147,6 @@ function visualizer.flush_line(str, nested)
tex.write(c) tex.write(c)
end end
end end
--tex.write(c)
state = buffers.finishstate(state) state = buffers.finishstate(state)
end end
flush_pas_word(word) flush_pas_word(word)

View File

@ -6,8 +6,8 @@
\starttext \starttext
\startPAS \startPAS
blub { Comment } blub normal { Comment } normal
blub {$R- compiler directive} blub normal {$R- compiler directive} normal
procedure TForm1.Button1.Click(Sender: TObject); procedure TForm1.Button1.Click(Sender: TObject);
var // Delphi Comment var // Delphi Comment
Number, I, X: Integer; Number, I, X: Integer;