aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/run.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-06-23 21:38:41 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2009-06-23 21:38:41 -0400
commite3465214ff873069305386ca3584002f89107976 (patch)
treeaccb20dba37fff9ea57f39a2c2f028abb6d23079 /modules/textadept/run.lua
parent7de84ef35184bc9e180a8c2ca158974e0899f558 (diff)
downloadtextadept-e3465214ff873069305386ca3584002f89107976.tar.gz
textadept-e3465214ff873069305386ca3584002f89107976.zip
Ignore Java 'package' statements inside comments; modules/textadept/run.lua
Diffstat (limited to 'modules/textadept/run.lua')
-rw-r--r--modules/textadept/run.lua8
1 files changed, 6 insertions, 2 deletions
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)'