Skip to content

Commit 4f097d1

Browse files
authored
Merge pull request #59 from Apitax/scriptax4
Scriptax4 Release
2 parents adb4979 + 4a2d923 commit 4f097d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+14188
-1761
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ v8-compile-cache-0/
44
__pycache__/
55
*.py[cod]
66

7-
7+
.vscode/
88
.idea/
99
venv/
1010
3415-ref/

scriptax/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

scriptax/catalogs/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
2-
3-

scriptax/drivers/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

scriptax/drivers/builtin/Scriptax.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from apitaxcore.utilities.Numbers import round2str
66
from scriptax.flow.ScriptaxExecutor import Scriptax as ScriptaxExecutor
77
from apitaxcore.models.State import State
8+
from scriptax.parser.utils.BoilerPlate import read_file
9+
from pathlib import Path
10+
from antlr4 import InputStream
811

912

1013
class Scriptax(Driver):
@@ -36,7 +39,7 @@ def handleDriverScript(self, command: Command) -> ApitaxResponse:
3639

3740
executionTime = round2str(time() - t0)
3841

39-
if (command.options.debug):
42+
if command.options.debug:
4043
State.log.log('>> Script Finished Processing in ' + executionTime + 's')
4144
State.log.log('')
4245

@@ -45,7 +48,7 @@ def handleDriverScript(self, command: Command) -> ApitaxResponse:
4548
response.body.add({'commandtax': command.command[0]})
4649
response.body.add({'execution-time': executionTime})
4750

48-
if (result[1].isError()):
51+
if result[1].is_error():
4952
response.body.add({'error': result[1].message})
5053
response.status = 500
5154
else:
@@ -54,10 +57,9 @@ def handleDriverScript(self, command: Command) -> ApitaxResponse:
5457
return response
5558

5659
def handleDriverCommand(self, command: Command) -> ApitaxResponse:
57-
if(self.isDriverScriptable()):
60+
if self.isDriverScriptable():
5861
return self.handleDriverScript(command)
5962

60-
def getDriverScript(self, path) -> str:
61-
if path == 'bob/bob.ah':
62-
return "from scriptax import tester.bobytest(helloo='nope') as Slurp; sig(testingthis='beaut'); extends(Slurp); api getSig() {log(parent.testingthis); Slurp.doSig(); } api doBob() {log('THIS IS THE BOBBY');log(addOne(somenum=6));} api addOne(somenum) {return addOneRecursive(num=somenum);} api addOneRecursive(num) { num += 1; if(num < 10) num = addOneRecursive(num=num); return num;}"
63-
return "sig(helloo='yup'); api doSig() {log(parent.helloo);} api addOne(num) { if(num > 5) return num + 1; else return num; } api getPath () {log('method in script with path: ' + parent.path);} api resetPath () {parent.path='RESET';} api setPath(path){parent.path=path;} api test () {log('testing method');} log('Received filepath: " + path + "'); path='" + path + "'; arbVal=42;"
63+
def getDriverScript(self, path: str) -> InputStream:
64+
path = Path(Path(__file__).resolve().parents[2]).joinpath('tests', 'scriptax', path)
65+
return read_file(path)
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class InvalidExpression(Exception):
2+
pass
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class InvalidParameters(Exception):
2+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from scriptax.exceptions.SymbolError import SymbolError
2+
3+
4+
class InvalidSymbolAccess(SymbolError):
5+
pass

scriptax/exceptions/InvalidType.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class InvalidType(Exception):
2+
pass

scriptax/exceptions/SymbolError.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class SymbolError(Exception):
2+
pass

scriptax/exceptions/SymbolNotFound.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from scriptax.exceptions.SymbolError import SymbolError
2+
3+
4+
class SymbolNotFound(SymbolError):
5+
pass

scriptax/exceptions/__init__.py

Whitespace-only changes.

scriptax/flow/ScriptaxExecutor.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# System import
22

33
# Application import
4-
from scriptax.parser.utils.BoilerPlate import customizableParser
4+
from scriptax.parser.utils.BoilerPlate import customizable_parser
55
from apitaxcore.utilities.Files import getPath
66
from apitaxcore.flow.LoadedDrivers import LoadedDrivers
77
from apitaxcore.models.State import State
88

99

1010
# Script is used to automate the execution of many commands
11-
class Scriptax():
11+
class Scriptax:
1212
def __init__(self, parameters, options):
1313
self.options = options
1414
self.parameters = parameters
@@ -26,6 +26,6 @@ def execute(self, filepath) -> tuple:
2626

2727
scriptax = self.options.driver.getDriverScript(filepath)
2828

29-
result = customizableParser(scriptax, parameters=self.parameters, options=self.options, file=getPath(filepath))
29+
result = customizable_parser(scriptax, parameters=self.parameters, options=self.options, file=getPath(filepath))
3030

3131
return result

scriptax/flow/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

scriptax/grammar/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

scriptax/grammar/build/Ah3.interp

+255
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)