Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Commit

Permalink
applied code cleanup and format preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
maxijabase committed Feb 10, 2022
1 parent de387a8 commit b052035
Show file tree
Hide file tree
Showing 8 changed files with 388 additions and 388 deletions.
174 changes: 87 additions & 87 deletions SourcepawnCondenser/SourcepawnCondenser/Condenser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,122 +38,122 @@ public SMDefinition Condense()
switch (ct.Kind)
{
case TokenKind.FunctionIndicator:
{
var newIndex = ConsumeSMFunction();
if (newIndex != -1)
{
var newIndex = ConsumeSMFunction();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.EnumStruct:
{
var newIndex = ConsumeSMEnumStruct();
if (newIndex != -1)
{
var newIndex = ConsumeSMEnumStruct();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.Enum:
{
var newIndex = ConsumeSMEnum();
if (newIndex != -1)
{
var newIndex = ConsumeSMEnum();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.Struct:
{
var newIndex = ConsumeSMStruct();
if (newIndex != -1)
{
var newIndex = ConsumeSMStruct();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.PreprocessorDirective:
{
var newIndex = ConsumeSMPPDirective();
if (newIndex != -1)
{
var newIndex = ConsumeSMPPDirective();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.Constant:
{
var newIndex = ConsumeSMConstant();
if (newIndex != -1)
{
var newIndex = ConsumeSMConstant();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.MethodMap:
{
var newIndex = ConsumeSMMethodmap();
if (newIndex != -1)
{
var newIndex = ConsumeSMMethodmap();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.TypeSet:
{
var newIndex = ConsumeSMTypeset();
if (newIndex != -1)
{
var newIndex = ConsumeSMTypeset();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.TypeDef:
{
var newIndex = ConsumeSMTypedef();
if (newIndex != -1)
{
var newIndex = ConsumeSMTypedef();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

break;
position = newIndex + 1;
continue;
}

break;
}
case TokenKind.Identifier:
{
var newIndex = ConsumeSMVariable();
if (newIndex != -1)
{
var newIndex = ConsumeSMVariable();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}

// If Variable is not found try function
newIndex = ConsumeSMFunction();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}
position = newIndex + 1;
continue;
}
break;

// If Variable is not found try function
newIndex = ConsumeSMFunction();
if (newIndex != -1)
{
position = newIndex + 1;
continue;
}
}
break;
}

++position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,66 +20,66 @@ private int ConsumeSMFunction()
switch (t[startPosition].Value)
{
case "stock":
{
if (startPosition + 1 < length)
{
if (startPosition + 1 < length)
if (t[startPosition + 1].Kind == TokenKind.FunctionIndicator)
{
if (t[startPosition + 1].Kind == TokenKind.FunctionIndicator)
if (t[startPosition + 1].Value == "static")
{
if (t[startPosition + 1].Value == "static")
{
kind = SMFunctionKind.StockStatic;
++iteratePosition;
break;
}
kind = SMFunctionKind.StockStatic;
++iteratePosition;
break;
}
}

kind = SMFunctionKind.Stock;
break;
}

kind = SMFunctionKind.Stock;
break;
}
case "native":
{
kind = SMFunctionKind.Native;
break;
}
{
kind = SMFunctionKind.Native;
break;
}
case "forward":
{
kind = SMFunctionKind.Forward;
break;
}
{
kind = SMFunctionKind.Forward;
break;
}
case "public":
{
if (startPosition + 1 < length)
{
if (startPosition + 1 < length)
if (t[startPosition + 1].Kind == TokenKind.FunctionIndicator)
{
if (t[startPosition + 1].Kind == TokenKind.FunctionIndicator)
if (t[startPosition + 1].Value == "native")
{
if (t[startPosition + 1].Value == "native")
{
kind = SMFunctionKind.PublicNative;
++iteratePosition;
break;
}
kind = SMFunctionKind.PublicNative;
++iteratePosition;
break;
}
}

kind = SMFunctionKind.Public;
break;
}

kind = SMFunctionKind.Public;
break;
}
case "static":
{
kind = SMFunctionKind.Static;
break;
}
{
kind = SMFunctionKind.Static;
break;
}
case "normal":
{
kind = SMFunctionKind.Normal;
break;
}
{
kind = SMFunctionKind.Normal;
break;
}
default:
{
functionReturnType = t[startPosition].Value;
break;
}
{
functionReturnType = t[startPosition].Value;
break;
}
}

var functionCommentString = string.Empty;
Expand Down
Loading

0 comments on commit b052035

Please sign in to comment.