From e3465214ff873069305386ca3584002f89107976 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 23 Jun 2009 21:38:41 -0400 Subject: Ignore Java 'package' statements inside comments; modules/textadept/run.lua --- modules/textadept/run.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/textadept/run.lua') diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 3210adac..f6d75ff0 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -67,11 +67,15 @@ local go_for_ext = { cpp = '%(filedir)%(filename_noext)', java = function() local buffer = buffer - local package = buffer:get_text():match('package%s+([^;]+)') + local text = buffer:get_text() + local s, e, package + repeat + s, e, package = text:find('package%s+([^;]+)', e or 1) + until not s or buffer:get_style_name(buffer.style_at[s]) ~= 'comment' if package then local classpath = '' for dot in package:gmatch('%.') do classpath = classpath..'../' end - return 'java -cp '..(WIN32 and '%CLASSPATH%:' or '$CLASSPATH:').. + return 'java -cp '..(WIN32 and '%CLASSPATH%;' or '$CLASSPATH:').. classpath..'../ '..package..'.%(filename_noext)' else return 'java %(filename_noext)' -- cgit v1.2.3