Skip to content

Commit

Permalink
Merge pull request #108 from srz-zumix/feature/support_statement_groovy
Browse files Browse the repository at this point in the history
support groovy statement
  • Loading branch information
srz-zumix authored Jul 31, 2022
2 parents 5f1f289 + bb7593e commit ebec600
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions samples/command/src/groovy/sample.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// This file is a "Hello, world!" in Groovy language for wandbox.

import test1.*
import test3.Test3
import test3.test4.*;
import test3.Test3; import test3.test4.*;

println "Hello Wandbox!"
Test1.test()
Expand Down
11 changes: 7 additions & 4 deletions wandbox/__groovy__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from .cli import CLI
from .runner import Runner
from .utils import split_statements


class GroovyRunner(Runner):
Expand All @@ -23,10 +24,12 @@ def make_code(self, file, filepath, filename):
files = dict()
code = ''
for line in file:
m = self.IMPORT_REGEX.match(line)
if m:
module = m.group(1).strip('\'";')
files.update(self.import_module(os.path.dirname(filepath), module.strip()))
statements = split_statements(line, commenters="//")
for statement in statements:
m = self.IMPORT_REGEX.match(statement)
if m:
module = m.group(1).strip('\'";')
files.update(self.import_module(os.path.dirname(filepath), module.strip()))
code += line
files[filename] = code
return files
Expand Down

0 comments on commit ebec600

Please sign in to comment.