Move 'system' module
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
from smnp.error.function import IllegalArgumentException
|
||||
from smnp.library.model import Function
|
||||
from smnp.library.signature import signature, ofTypes
|
||||
from smnp.type.model import Type
|
||||
|
||||
_signature = signature(ofTypes(Type.STRING))
|
||||
def _function(env, parameter):
|
||||
if parameter.value == "environment":
|
||||
print(env)
|
||||
return
|
||||
elif parameter.value == "variables":
|
||||
print(env.scopesToString())
|
||||
return
|
||||
elif parameter.value == "functions":
|
||||
print(env.functionsToString())
|
||||
return
|
||||
elif parameter.value == "methods":
|
||||
print(env.methodsToString())
|
||||
return
|
||||
|
||||
raise IllegalArgumentException(f"Unknown parameter '{parameter.value}'")
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'debug')
|
||||
@@ -1,10 +0,0 @@
|
||||
from smnp.library.model import Function
|
||||
from smnp.library.signature import varargSignature, allTypes
|
||||
|
||||
|
||||
_signature = varargSignature(allTypes())
|
||||
def _function(env, vararg):
|
||||
print("".join([arg.stringify() for arg in vararg]))
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'print')
|
||||
@@ -1,12 +0,0 @@
|
||||
import sys
|
||||
|
||||
from smnp.library.model import Function
|
||||
from smnp.library.signature import signature, ofTypes
|
||||
from smnp.type.model import Type
|
||||
|
||||
_signature = signature(ofTypes(Type.INTEGER))
|
||||
def _function(env, code):
|
||||
sys.exit(code.value)
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'exit')
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
# TODO read function
|
||||
# def read(args, env):
|
||||
# if len(args) == 2 and isinstance(args[0], str) and isinstance(args[1], str):
|
||||
# print(args[0], end="")
|
||||
# value = input()
|
||||
# if args[1] == "integer":
|
||||
# try:
|
||||
# return int(value)
|
||||
# except ValueError as v:
|
||||
# pass # not int
|
||||
# elif args[1] == "string":
|
||||
# return value
|
||||
# # TODO: note - wydzielić parsowanie nut do osobnej funkcji w pakiecie smnp.note
|
||||
# # elif args[1] == "note":
|
||||
# # chars, token = tokenizeNote(value, 0, 0)
|
||||
# # if chars == 0:
|
||||
# # return # not note
|
||||
# # return parseNote([token], None).value
|
||||
# else:
|
||||
# pass # invalid type
|
||||
# elif len(args) == 1 and isinstance(args[0], str):
|
||||
# print(args[0], end="")
|
||||
# return input()
|
||||
# elif len(args) == 0:
|
||||
# return input()
|
||||
# else:
|
||||
# pass # not valid signature
|
||||
@@ -1,12 +0,0 @@
|
||||
import time
|
||||
|
||||
from smnp.library.model import Function
|
||||
from smnp.library.signature import ofTypes, signature
|
||||
from smnp.type.model import Type
|
||||
|
||||
_signature = signature(ofTypes(Type.INTEGER))
|
||||
def _function(env, value):
|
||||
time.sleep(value.value)
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'sleep')
|
||||
@@ -1,10 +0,0 @@
|
||||
from smnp.library.model import Function
|
||||
from smnp.library.signature import signature, allTypes
|
||||
|
||||
|
||||
_signature = signature(allTypes())
|
||||
def _function(env, obj):
|
||||
return obj.type.name
|
||||
|
||||
|
||||
function = Function(_signature, _function, 'type')
|
||||
Reference in New Issue
Block a user