Can define more than one language.
This commit is contained in:
parent
b1ccec0cef
commit
6502708b08
|
@ -132,10 +132,14 @@ class Interpreter():
|
||||||
print('Message: %s' % args[0])
|
print('Message: %s' % args[0])
|
||||||
|
|
||||||
def func_language(self, node, args):
|
def func_language(self, node, args):
|
||||||
self.validate_arguments(args, 1, [str])
|
if len(args) == 0:
|
||||||
|
raise InvalidArguments('Line %d: no arguments to function language.' % node.lineno())
|
||||||
|
for a in args:
|
||||||
|
if not isinstance(a, str):
|
||||||
|
raise InvalidArguments('Line %d: Argument %s is not a string.' % (node.lineno(), str(a)))
|
||||||
if len(self.compilers) > 0:
|
if len(self.compilers) > 0:
|
||||||
raise InvalidCode('Function language() can only be called once (line %d).' % node.lineno())
|
raise InvalidCode('Function language() can only be called once (line %d).' % node.lineno())
|
||||||
lang = args[0]
|
for lang in args:
|
||||||
if lang.lower() == 'c':
|
if lang.lower() == 'c':
|
||||||
comp = environment.detect_c_compiler('gcc')
|
comp = environment.detect_c_compiler('gcc')
|
||||||
comp.sanity_check(self.scratch_dir)
|
comp.sanity_check(self.scratch_dir)
|
||||||
|
|
Loading…
Reference in New Issue