Re: ta and running java classes

From: mitchell <mforal.n....at.gmail.com>
Date: Tue, 23 Jun 2009 18:40:41 -0700 (PDT)

Martin,

> To make it work on Windows separate the classpath with ';' instead of
> ':'.

Thanks. I also incorporated my get_style_name fix. Changes in HG
(r405)

I've included the patch again for convenience below.

-Mitchell;

# HG changeset patch
# User mitchell
# Date 1245807521 14400
# Node ID 9c4d44b329d62e40d3256946cf74b74cdb537e1f
# Parent ab95cc339359ca5eabaa0fa304649b9b73236eda
Ignore Java 'package' statements inside comments; modules/textadept/
run.lua

diff -r ab95cc339359 -r 9c4d44b329d6 modules/textadept/run.lua
--- a/modules/textadept/run.lua Mon Jun 22 20:25:45 2009 -0400
+++ b/modules/textadept/run.lua Tue Jun 23 21:38:41 2009 -0400
@@ -67,11 +67,15 @@
   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
Received on Tue 23 Jun 2009 - 21:40:41 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:38:11 EST