Skip to content

Commit

Permalink
Fixed formatting, removed unused imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
Uralstech committed Aug 7, 2024
1 parent e676eae commit dc43304
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 59 deletions.
34 changes: 17 additions & 17 deletions src/Runtime/Interpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ private void VisitBinaryOperationNode(BinaryOperationNode node, Context executio
{
case TokenType.Period:
ExecuteObjectAttributeAccess(node, executionContext, callingContext, accessibilityModifiers, ignoreUndefinedVariable); break;

case TokenType.KeywordOr:
case TokenType.KeywordAnd:
ExecuteConjunctiveOperators(node, executionContext, callingContext, accessibilityModifiers); break;
Expand Down Expand Up @@ -607,7 +607,7 @@ private void ExecuteObjectAttributeAccess(BinaryOperationNode node, Context exec
? accessibilityModifiers & ~AccessMod.LocalScope
: accessibilityModifiers;

VisitNode(node.Left, executionContext, callingContext, accessibilityModifiers & ~AccessMod.LocalScope);
VisitNode(node.Left, executionContext, callingContext, accessibilityModifiers & ~AccessMod.LocalScope);
if (RuntimeResult.ShouldReturn)
return;

Expand Down Expand Up @@ -678,12 +678,12 @@ private void ExecuteBinaryOperation(IEzrObject first, IEzrObject second, Node no
case TokenType.AssignmentAddition:
first.Addition(second, RuntimeResult);
break;

case TokenType.HyphenMinus:
case TokenType.AssignmentSubtraction:
first.Subtraction(second, RuntimeResult);
break;

case TokenType.Asterisk:
case TokenType.AssignmentMultiplication:
first.Multiplication(second, RuntimeResult);
Expand All @@ -693,12 +693,12 @@ private void ExecuteBinaryOperation(IEzrObject first, IEzrObject second, Node no
case TokenType.AssignmentDivision:
first.Division(second, RuntimeResult);
break;

case TokenType.Caret:
case TokenType.AssignmentPower:
first.Power(second, RuntimeResult);
break;

case TokenType.PercentSign:
case TokenType.AssignmentModulo:
first.Modulo(second, RuntimeResult);
Expand All @@ -708,22 +708,22 @@ private void ExecuteBinaryOperation(IEzrObject first, IEzrObject second, Node no
case TokenType.AssignmentBitwiseAnd:
first.BitwiseAnd(second, RuntimeResult);
break;

case TokenType.VerticalBar:
case TokenType.AssignmentBitwiseOr:
first.BitwiseOr(second, RuntimeResult);
break;

case TokenType.Backslash:
case TokenType.AssignmentBitwiseXOr:
first.BitwiseXOr(second, RuntimeResult);
break;

case TokenType.BitwiseLeftShift:
case TokenType.AssignmentBitwiseLeftShift:
first.BitwiseLeftShift(second, RuntimeResult);
break;

case TokenType.BitwiseRightShift:
case TokenType.AssignmentBitwiseRightShift:
first.BitwiseRightShift(second, RuntimeResult);
Expand All @@ -732,31 +732,31 @@ private void ExecuteBinaryOperation(IEzrObject first, IEzrObject second, Node no
case TokenType.EqualSign:
first.ComparisonEqual(second, RuntimeResult);
break;

case TokenType.ExclamationMark:
first.ComparisonNotEqual(second, RuntimeResult);
break;

case TokenType.LessThanSign:
first.ComparisonLessThan(second, RuntimeResult);
break;

case TokenType.GreaterThanSign:
first.ComparisonGreaterThan(second, RuntimeResult);
break;

case TokenType.LessThanOrEqual:
first.ComparisonLessThanOrEqual(second, RuntimeResult);
break;

case TokenType.GreaterThanOrEqual:
first.ComparisonGreaterThanOrEqual(second, RuntimeResult);
break;

case TokenType.KeywordIn:
second.HasValueContained(first, RuntimeResult);
break;

case TokenType.KeywordNot:
second.NotHasValueContained(first, RuntimeResult);
break;
Expand Down Expand Up @@ -1327,7 +1327,7 @@ private void VisitCallNode(CallNode node, Context executionContext, Context call
{
Context argumentsContext = new($"<{receiver.TypeName} arguments>", false, receiver.StartPosition, callingContext, callingContext.StaticContext);
arguments = new Reference[node.Arguments.Count];

for (int i = 0; i < node.Arguments.Count; i++)
{
Node argument = node.Arguments[i];
Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Reference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public Reference Reset(IEzrObject? @object, AccessMod accessibilityModifiers, st
{
Object = @object ?? EzrRuntimeInvalidObject.s_instance;
AccessibilityModifiers = accessibilityModifiers;

Name = name;
IsEmpty = @object is null;

RegisteredContext = null;
RegisteredIn = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Types/BaseTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public virtual void Interpret(Node code, Context callingContext, Interpreter int
result.Failure(new EzrUndefinedValueError($"You cannot create nor change members of a read-only object!", Context, StartPosition, EndPosition));
return;
}

if (IsReadOnly)
result.Success(
ReferencePool.Get(
Expand Down Expand Up @@ -449,7 +449,7 @@ protected internal EzrIllegalOperationError IllegalOperation()
/// <returns>The error.</returns>
protected internal EzrIllegalOperationError IllegalOperation(IEzrObject other, bool isRightHandSide = true)
{
return
return
isRightHandSide
? new EzrIllegalOperationError($"Illegal operation for types \"{TypeName}\" and \"{other.TypeName}\"!", _executionContext, StartPosition, other.EndPosition)
: new EzrIllegalOperationError($"Illegal operation for types \"{other.TypeName}\" and \"{TypeName}\"!", _executionContext, other.StartPosition, EndPosition);
Expand Down
1 change: 0 additions & 1 deletion src/Runtime/Types/Core/RuntimeErrors/EzrAssertionError.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
1 change: 0 additions & 1 deletion src/Runtime/Types/Core/RuntimeErrors/EzrMathError.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
1 change: 0 additions & 1 deletion src/Runtime/Types/Core/RuntimeErrors/EzrRuntimeError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using EzrSquared.Runtime.WrapperAttributes;
using EzrSquared.Util;
using System;
using System.Collections.Generic;
using System.Text;

namespace EzrSquared.Runtime.Types.Core.Errors;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using EzrSquared.Runtime.WrapperAttributes;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types.Core.Errors;

Expand Down
6 changes: 3 additions & 3 deletions src/Runtime/Types/Executables/EzrClass.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Runtime.Types.Core.Errors;
using System;
using System.Collections.Generic;

namespace EzrSquared.Runtime.Types;

Expand Down
4 changes: 2 additions & 2 deletions src/Runtime/Types/Executables/EzrClassInstance.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Runtime.Types.Core;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Numerics;
using EzrSquared.Runtime.Types.Core.Text;
using System;

namespace EzrSquared.Runtime.Types;

Expand Down
10 changes: 5 additions & 5 deletions src/Runtime/Types/Executables/EzrRuntimeExecutable.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using EzrSquared.Runtime.Types.Collections;
using EzrSquared.Runtime.Collections;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Runtime.Types.Collections;
using EzrSquared.Runtime.Types.Core.Errors;
using EzrSquared.Runtime.Types.Core.Text;
using EzrSquared.Runtime.Collections;
using EzrSquared.Runtime.Nodes;
using EzrSquared.Util;
using System;

Expand Down Expand Up @@ -125,7 +125,7 @@ protected internal void CheckAndPopulateArguments(Reference[] arguments, Context

// Is the key already exist?
bool hasKey = isValidIndex && context.IsDefined(key);

// If parameterIndex is out of bounds, or the key is already defined and the argument is a keyword argument, or if all the arguments have already been set:
if (!isValidIndex || (hasKey && (isKeywordArgument || parameterIndex + 1 >= Parameters.Length)))
{
Expand Down Expand Up @@ -234,7 +234,7 @@ public override string ToString(RuntimeResult result)
string[] paramterNames = Array.ConvertAll(Parameters, parameter => parameter.Name);
return (Parameters.Length > 0, IsAnonymous) switch
{
(true, true) => $"<{TypeName} {ExecutableName}, with \"{string.Join("\", \"", paramterNames)}\">",
(true, true) => $"<{TypeName} {ExecutableName}, with \"{string.Join("\", \"", paramterNames)}\">",
(true, false) => $"<{TypeName} \"{ExecutableName}\", with \"{string.Join("\", \"", paramterNames)}\">",

(false, true) => $"<{TypeName} {ExecutableName}>",
Expand Down
4 changes: 2 additions & 2 deletions src/Shell/EzrShellEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.IO;
using System;
using System.IO;
using System.Text;
using System;

namespace EzrSquaredCli;

Expand Down
16 changes: 8 additions & 8 deletions src/Syntax/Lexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void Advance()
_currentChar = '\0';
}
}

/// <summary>
/// Reverses to the given index.
/// </summary>
Expand All @@ -81,12 +81,12 @@ private void ReverseTo(int index)
_currentChar = _script[_position.Index];
}

/// <summary>
/// Creates a <see cref="List{T}"/> of <see cref="Token"/> objects from the given script.
/// </summary>
/// <param name="tokens">The created <see cref="List{T}"/> of <see cref="Token"/> objects.</param>
/// <returns>Any <see cref="SyntaxError"/> that occurred in the lexing; <see langword="null"/> if none occurred.</returns>
public SyntaxError? Tokenize(out List<Token> tokens)
/// <summary>
/// Creates a <see cref="List{T}"/> of <see cref="Token"/> objects from the given script.
/// </summary>
/// <param name="tokens">The created <see cref="List{T}"/> of <see cref="Token"/> objects.</param>
/// <returns>Any <see cref="SyntaxError"/> that occurred in the lexing; <see langword="null"/> if none occurred.</returns>
public SyntaxError? Tokenize(out List<Token> tokens)
{
SyntaxError? error;
tokens = [];
Expand Down Expand Up @@ -379,7 +379,7 @@ private Token CompileStringLike(out SyntaxError? error)
tooLong
? "Value too long to be a character!"
: "A character cannot be empty!", startPosition, _position);

return Token.Empty;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Syntax/Parser/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ or TokenType.EndOfFile
or TokenType.KeywordEnd
or TokenType.KeywordElse
or TokenType.KeywordCatch)
// || (_usingQuickSyntax
// && (_currentToken.Type == TokenType.QeywordL
// || _currentToken.Type == TokenType.QeywordE
// || _currentToken.Type == TokenType.QeywordS)))
// || (_usingQuickSyntax
// && (_currentToken.Type == TokenType.QeywordL
// || _currentToken.Type == TokenType.QeywordE
// || _currentToken.Type == TokenType.QeywordS)))
{
_result.Success(new ReturnNode(null, false, startPosition, possibleEndPosition));
return;
Expand Down Expand Up @@ -2109,7 +2109,7 @@ private void ParseClassDefinitionExpression()
return;
}

_result.Failure(10, new SyntaxError(SyntaxError.InvalidGrammar,
_result.Failure(10, new SyntaxError(SyntaxError.InvalidGrammar,
(name is null && parents.Count == 0)
? "Expected an expression or the 'from' or 'do' keywords! An expression after the 'object' keyword defines the name, the 'from' keyword and the following expression(s, seperated by commas) define(s) the parents and the 'do' keyword declares the start of the body of the class."
: (parents.Count == 0)
Expand Down

0 comments on commit dc43304

Please sign in to comment.