Added CPL 2021.10.0 support
This commit is contained in:
parent
1197863296
commit
1f6d13551b
@ -32,6 +32,8 @@ class LanguageDefinition:
|
|||||||
Keywords.Foreach.value,
|
Keywords.Foreach.value,
|
||||||
# access
|
# access
|
||||||
Keywords.Public.value,
|
Keywords.Public.value,
|
||||||
|
Keywords.Private.value,
|
||||||
|
Keywords.Static.value,
|
||||||
Keywords.This.value
|
Keywords.This.value
|
||||||
]
|
]
|
||||||
datatypes = [
|
datatypes = [
|
||||||
|
@ -33,6 +33,8 @@ class Keywords(Enum):
|
|||||||
|
|
||||||
# access
|
# access
|
||||||
Public = 'public'
|
Public = 'public'
|
||||||
|
Private = 'private'
|
||||||
|
Static = 'static'
|
||||||
This = 'this'
|
This = 'this'
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from cpl.application import ApplicationABC
|
from cpl_core.application import ApplicationABC
|
||||||
from cpl.configuration import ConfigurationABC
|
from cpl_core.configuration import ConfigurationABC
|
||||||
from cpl.console import Console
|
from cpl_core.console import Console
|
||||||
from cpl.dependency_injection import ServiceProviderABC
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
|
|
||||||
from lexer.abc.lexer_abc import LexerABC
|
from lexer.abc.lexer_abc import LexerABC
|
||||||
from runtime.abc.runtime_service_abc import RuntimeServiceABC
|
from runtime.abc.runtime_service_abc import RuntimeServiceABC
|
||||||
@ -18,19 +18,22 @@ class Application(ApplicationABC):
|
|||||||
self._runtime: RuntimeServiceABC = services.get_service(RuntimeServiceABC)
|
self._runtime: RuntimeServiceABC = services.get_service(RuntimeServiceABC)
|
||||||
|
|
||||||
self._path = config.get_configuration('p')
|
self._path = config.get_configuration('p')
|
||||||
|
Console.write_line('t', self._path)
|
||||||
|
|
||||||
def _interpret(self, line: str):
|
def _interpret(self, line: str):
|
||||||
tokens = self._lexer.tokenize(line)
|
tokens = self._lexer.tokenize(line)
|
||||||
|
|
||||||
line.replace("\n", "").replace("\t", "")
|
line.replace("\n", "").replace("\t", "")
|
||||||
Console.write_line(f'\nLINE: {line}')
|
Console.write_line(f'<{self._runtime.line_count}> LINE: {line}')
|
||||||
tokens.for_each(lambda t: Console.write_line(t.type, t.value))
|
header, values = ['Type', 'Value'], []
|
||||||
|
tokens.for_each(lambda t: values.append([t.type, t.value]))
|
||||||
|
Console.table(header, values)
|
||||||
|
|
||||||
def _console(self):
|
def _console(self):
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
self._runtime.line_count = i + 1
|
self._runtime.line_count = i + 1
|
||||||
self._interpret(input('> '))
|
self._interpret(Console.read('> '))
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
def _files(self):
|
def _files(self):
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
"LicenseName": "",
|
"LicenseName": "",
|
||||||
"LicenseDescription": "",
|
"LicenseDescription": "",
|
||||||
"Dependencies": [
|
"Dependencies": [
|
||||||
"sh_cpl==2021.4.0.post2"
|
"sh_cpl-core==2021.10.0.post1",
|
||||||
|
"sh_cpl-query==2021.10.0"
|
||||||
],
|
],
|
||||||
"PythonVersion": ">=3.9.2",
|
"PythonVersion": ">=3.9.2",
|
||||||
"PythonPath": {
|
"PythonPath": {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from cpl.application import ApplicationBuilder
|
from cpl_core.application import ApplicationBuilder
|
||||||
|
|
||||||
from cc_lang_interpreter.application import Application
|
from cc_lang_interpreter.application import Application
|
||||||
from cc_lang_interpreter.startup import Startup
|
from cc_lang_interpreter.startup import Startup
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from cpl.application import StartupABC
|
from cpl_core.application import StartupABC
|
||||||
from cpl.configuration import ConfigurationABC, ConsoleArgument
|
from cpl_core.configuration import ConfigurationABC, ConsoleArgument
|
||||||
from cpl.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC
|
||||||
|
from cpl_core.environment import ApplicationEnvironment
|
||||||
|
|
||||||
from lexer.abc.lexer_abc import LexerABC
|
from lexer.abc.lexer_abc import LexerABC
|
||||||
from lexer.service.lexer_service import LexerService
|
from lexer.service.lexer_service import LexerService
|
||||||
@ -10,21 +11,17 @@ from runtime.service.runtime_service import RuntimeService
|
|||||||
|
|
||||||
class Startup(StartupABC):
|
class Startup(StartupABC):
|
||||||
|
|
||||||
def __init__(self, config: ConfigurationABC, services: ServiceCollectionABC):
|
def __init__(self):
|
||||||
StartupABC.__init__(self)
|
StartupABC.__init__(self)
|
||||||
|
|
||||||
self._configuration = config
|
def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironment) -> ConfigurationABC:
|
||||||
self._environment = self._configuration.environment
|
config.add_console_argument(ConsoleArgument('-', 'p', [], ' ', is_value_token_optional=True))
|
||||||
self._services = services
|
config.add_console_arguments()
|
||||||
|
|
||||||
def configure_configuration(self) -> ConfigurationABC:
|
return config
|
||||||
self._configuration.add_console_argument(ConsoleArgument('-', 'p', [], ' ', is_value_token_optional=True))
|
|
||||||
self._configuration.add_console_arguments()
|
|
||||||
|
|
||||||
return self._configuration
|
def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironment) -> ServiceProviderABC:
|
||||||
|
services.add_singleton(LexerABC, LexerService)
|
||||||
|
services.add_singleton(RuntimeServiceABC, RuntimeService)
|
||||||
|
|
||||||
def configure_services(self) -> ServiceProviderABC:
|
return services.build_service_provider()
|
||||||
self._services.add_singleton(LexerABC, LexerService)
|
|
||||||
self._services.add_singleton(RuntimeServiceABC, RuntimeService)
|
|
||||||
|
|
||||||
return self._services.build_service_provider()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user