Skip to content

Commit

Permalink
Push for changing PCs.
Browse files Browse the repository at this point in the history
  • Loading branch information
DevReaper0 committed Dec 16, 2021
1 parent 1453ae0 commit 73b9307
Show file tree
Hide file tree
Showing 40 changed files with 1,024 additions and 971 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
- Support for variables in the `catch` statement
- More errors
- Complete requests HTTP library
- Complete regex support
- Better interfacing with python code from ParaCode
- The ability to use keyword arguments when calling a function
- **kwargs (Keyword Arguments)

## [2.1.0] - CURRENTLY UNRELEASED
### Added
- Easy use of default parameters in functions
- *args (Non-Keyword Arguments)
- Complete regex support

## [2.0.1] - 2021-10-18
### Fixed
Expand Down Expand Up @@ -41,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
- PCPM package uploading doesn't require a login

[Unreleased]: https://github.com/DaRubyMiner360/ParaCode/compare/2.0.1...HEAD
[Unreleased]: https://github.com/DaRubyMiner360/ParaCode/compare/2.1.0...HEAD
[2.1.0]: https://github.com/DaRubyMiner360/ParaCode/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/DaRubyMiner360/ParaCode/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/DaRubyMiner360/ParaCode/releases/tag/2.0.0
5 changes: 2 additions & 3 deletions ParaCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class ParaCode():
initialized = False

# Language Info
version = "2.0.1"
release_stage = "stable"
version = "2.1.0"
release_stage = "development"

def __init__(self):
ParaCode.instance = self
Expand Down Expand Up @@ -59,7 +59,6 @@ def eval(self, data=None, filename=None, interpret=True, default_imports=['std/_

return_code = None
if interpret:

# init interpreter and visit nodes
self.interpreter = Interpreter(source_loc)

Expand Down
2 changes: 1 addition & 1 deletion doc/70_console.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extended from the `Console` object.

The `io` module is included by default as
it is imported from within the
standard __core__ module, so you don't have to
standard \_\_core\_\_ module, so you don't have to
import any modules manually in order to start using
it.

Expand Down
12 changes: 7 additions & 5 deletions error.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
from util import LogColor

class InterpreterError(Exception):
def __init__(self, m, node=None, type=None, message=None, cont=False, name=None, classnames=None):
def __init__(self, m, node=None, type=None, message=None, cont=False, name=None, classnames=None, object=None):
super().__init__(m)
self.node = node
self.type = type
self.message = message
self.cont = cont
self.name = name
self.classnames = classnames
self.object = object

class ErrorType(Enum):
Exception = auto()
Expand All @@ -21,7 +22,7 @@ class ErrorType(Enum):
MacroExpansionError = auto()

class Error():
def __init__(self, type, location, message, filename, name=None):
def __init__(self, type, location, message, filename, name="Exception"):
self.type = type
self.filename = filename
self.message = message
Expand Down Expand Up @@ -50,9 +51,10 @@ def location_col(self):
return self.location[0]

def __repr__(self):
nstr = f"{self.location_filename}:{self.location_row}:{self.location_col}: {LogColor.Error}{self.type.name} error:{LogColor.Default}"
if self.type == ErrorType.Exception:
nstr = f"{self.location_filename}:{self.location_row}:{self.location_col}: {LogColor.Error}{self.name}:{LogColor.Default}"
nstr = f"{self.location_filename}:{self.location_row}:{self.location_col}: {LogColor.Error}{self.name}:{LogColor.Default}"
# nstr = f"{self.location_filename}:{self.location_row}:{self.location_col}: {LogColor.Error}{self.type.name} error:{LogColor.Default}"
# if self.type == ErrorType.Exception:
# nstr = f"{self.location_filename}:{self.location_row}:{self.location_col}: {LogColor.Error}{self.name}:{LogColor.Default}"
return f"{LogColor.Bold}{nstr}{LogColor.Default} {self.message}"
__str__ = __repr__

Expand Down
35 changes: 18 additions & 17 deletions examples/exceptions.para
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
try {
// Comment below line, change the exception to MultipleDefinitionError, TypeError, ArgumentError, MacroExpansionError, or Exception
ArgumentError.new("A").raise();
MultipleDefinitionError.new("AIEVN").raise();
print("TRY");
}
catch MultipleDefinitionError {
catch MultipleDefinitionError e {
print("CATCH MultipleDefinitionError");
print(e.type());
}
catch [TypeError, ArgumentError] {
print("CATCH ArgumentError/TypeError");
}
catch MacroExpansionError {
print("CATCH MacroExpansionError");
}
catch {
print("CATCH Any Exception");
}
else {
print("ELSE");
}
finally {
print("FINALLY");
}
//catch [TypeError, ArgumentError] {
// print("CATCH ArgumentError/TypeError");
//}
//catch MacroExpansionError {
// print("CATCH MacroExpansionError");
//}
//catch {
// print("CATCH Any Exception");
//}
//else {
// print("ELSE");
//}
//finally {
// print("FINALLY");
//}
Binary file not shown.
Binary file not shown.
Binary file added interpreter/__pycache__/function.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file added interpreter/__pycache__/scope.cpython-38.pyc
Binary file not shown.
Binary file added interpreter/__pycache__/stack.cpython-38.pyc
Binary file not shown.
Binary file added interpreter/__pycache__/variable.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 73b9307

Please sign in to comment.