Skip to content

Commit 6ded544

Browse files
author
aafent
committed
Name refactory for some classes
1 parent e450fb7 commit 6ded544

20 files changed

+63
-63
lines changed

FAST.FBasic.InteractiveConsole/FBasicIC.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ internal class FBasicIC
99
private string iCommand;
1010
private string programsFolder;
1111
private string startupName;
12-
private executionEnvironment env = null;
12+
private ExecutionEnvironment env = null;
1313

1414
public FBasicIC(IConfiguration config)
1515
{
@@ -140,7 +140,7 @@ private void internalInfo()
140140

141141
private void runFBasicProgram()
142142
{
143-
executionResult result;
143+
ExecutionResult result;
144144
var basProgramFile = Directory.GetFiles(programsFolder, startupName).FirstOrDefault();
145145
result = FBasicSource.Run(env, basProgramFile, (interp) =>
146146
{
@@ -168,7 +168,7 @@ static void spBuilder()
168168
string cs = "Driver={Adaptive Server Enterprise};NA=alpha.pca.com.gr,5000;Uid=laskaris;Pwd=laskaris;database=LASKARIS;EncryptPassword=2;ServerInitiatedTransactions=0;AnsiNull=0";
169169
//connectionAdapterForODBC connection = new(cs, dbDialectDetails.sql);
170170

171-
executionEnvironment env = new();
171+
ExecutionEnvironment env = new();
172172
env.printHandler += Console.WriteLine;
173173
env.inputHandler += Console.ReadLine;
174174
env.callHandler += (name) => { var filepath = Path.Combine(folder, name); return File.ReadAllText(filepath); };

FAST.FBasicInterpreter/Builders/fBasicSourceBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ public class fBasicSourceBuilder : sourceCodeBuilderAbstract
66
{
77
private string source=null;
88

9-
protected override programContainer program { get; set; }
9+
protected override ProgramContainer program { get; set; }
1010

11-
public override void Build(programContainer program)
11+
public override void Build(ProgramContainer program)
1212
{
1313
this.program = program;
1414
this.source=toSource();

FAST.FBasicInterpreter/Builders/sourceCodeBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ public abstract class sourceCodeBuilderAbstract : IsourceCodeBuilder
44
{
55
private Dictionary<Token,int> tokenReferences =new();
66

7-
protected abstract programContainer program { get; set; }
7+
protected abstract ProgramContainer program { get; set; }
88

9-
public abstract void Build(programContainer program);
9+
public abstract void Build(ProgramContainer program);
1010

1111
public abstract string GetSource();
1212

@@ -29,7 +29,7 @@ public abstract class sourceCodeBuilderAbstract : IsourceCodeBuilder
2929
/// </summary>
3030
/// <param name="element">The element</param>
3131
/// <returns>Readable string</returns>
32-
protected string readableElement(programElement element)
32+
protected string readableElement(ProgramElement element)
3333
{
3434
return $"[{element.token} ({element.identifier}, {element.value})]";
3535
}
@@ -68,7 +68,7 @@ protected void lineAnalysis(int currentTokenNumber)
6868
}
6969
var prevElement = program.elements[prevIndex];
7070

71-
this.isStatement=Lexer.isStatement(element.token);
71+
this.isStatement=Lexer.IsStatement(element.token);
7272
if (!this.isStatement) switch (element.token)
7373
{
7474
case Token.Plus:

FAST.FBasicInterpreter/Builders/storedProcedureBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace FAST.FBasicInterpreter
55
public class storedProcedureBuilder : sourceCodeBuilderAbstract
66
{
77
private string source=null;
8-
protected override programContainer program { get; set; }
8+
protected override ProgramContainer program { get; set; }
99

10-
public override void Build(programContainer program)
10+
public override void Build(ProgramContainer program)
1111
{
1212
this.program=program;
1313
this.source=toSource();
@@ -84,7 +84,7 @@ private string toSource()
8484
// (v) parsing the program
8585
bool done = false;
8686
int tokensCount = 0;
87-
programElement prevItem = new() { token= Token.Unknown };
87+
ProgramElement prevItem = new() { token= Token.Unknown };
8888
foreach (var item in program.elements)
8989
{
9090
tokensCount++;
@@ -93,7 +93,7 @@ private string toSource()
9393
{
9494
}
9595

96-
if (Lexer.isStatement(item.token))
96+
if (Lexer.IsStatement(item.token))
9797
{
9898
lineAnalysis(tokensCount);
9999
if (hasLogicalOperators) src.Append("LOGICAL: ");
@@ -296,7 +296,7 @@ private string toSource()
296296

297297

298298
// (v) before reloop
299-
prevItem.copyFrom(item);
299+
prevItem.CopyFrom(item);
300300
}
301301

302302

FAST.FBasicInterpreter/Core/Interpreter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace FAST.FBasicInterpreter
44
/// <summary>
55
/// The interpreter factory of the FBASIC
66
/// </summary>
7-
public partial class Interpreter : IfbasicError
7+
public partial class Interpreter : IFBasicError
88
{
99
#region (+) Handlers
1010

@@ -103,7 +103,7 @@ public partial class Interpreter : IfbasicError
103103
/// <summary>
104104
/// Collection objects
105105
/// </summary>
106-
public readonly Dictionary<string, IfbasicCollection> collections = new();
106+
public readonly Dictionary<string, IBAasicCollection> collections = new();
107107
/// <summary>
108108
/// The result of the execution (statement: RESULT)
109109
/// </summary>

FAST.FBasicInterpreter/Core/Interpreter_Constructors.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace FAST.FBasicInterpreter
55
/// The interpreter factory of the FBASIC
66
/// Constructors
77
/// </summary>
8-
public partial class Interpreter : IfbasicError
8+
public partial class Interpreter : IFBasicError
99
{
1010
#region (+) Constructors
1111

@@ -23,7 +23,7 @@ public Interpreter(bool installBuiltIns, string source)
2323
/// Constructor with a program container as program
2424
/// </summary>
2525
/// <param name="program">the program</param>
26-
public Interpreter(bool installBuiltIns, programContainer program)
26+
public Interpreter(bool installBuiltIns, ProgramContainer program)
2727
{
2828
var source=FBasicSource.ToSource(program);
2929
constructorCommon(source);

FAST.FBasicInterpreter/Core/Interpreter_Elements.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// The interpreter factory of the FBASIC
55
/// Part: THE FBASIC ELEMENTS EXCEPT STATMENTS
66
/// </summary>
7-
public partial class Interpreter : IfbasicError
7+
public partial class Interpreter : IFBasicError
88
{
99
void Statement()
1010
{

FAST.FBasicInterpreter/Core/Interpreter_Extensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public static void AddLibrary(this Interpreter interpreter, IFBasicLibrary libra
2020
/// Execute the program and return the results
2121
/// </summary>
2222
/// <returns>the results</returns>
23-
public static executionResult ExecWithResult(this Interpreter interpreter)
23+
public static ExecutionResult ExecWithResult(this Interpreter interpreter)
2424
{
25-
executionResult result = new();
25+
ExecutionResult result = new();
2626
try
2727
{
2828
interpreter.Exec();

FAST.FBasicInterpreter/Core/Interpreter_Methods.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace FAST.FBasicInterpreter
44
/// The interpreter factory of the FBASIC
55
/// Part: THE FBASIC INTERPRETER METHODS
66
/// </summary>
7-
public partial class Interpreter : IfbasicError
7+
public partial class Interpreter : IFBasicError
88
{
99
#region (+) Add and more for variables
1010

@@ -113,7 +113,7 @@ public T GetDataAdapter<T>(string name) where T: IfbasicDataAdapter
113113
/// </summary>
114114
/// <param name="name">The collection name</param>
115115
/// <param name="collection">The collection handler</param>
116-
public void AddCollection(string name, IfbasicCollection collection)
116+
public void AddCollection(string name, IBAasicCollection collection)
117117
{
118118
if (!dataAdapters.ContainsKey(name))
119119
{
@@ -261,7 +261,7 @@ public Value GetVar(string name)
261261
/// </summary>
262262
public void Exec()
263263
{
264-
lex.setAddonStatements(statements.Keys.ToArray());
264+
lex.SetAddonStatements(statements.Keys.ToArray());
265265
GetNextToken=interpreter_GetNextToken;
266266
exit = false;
267267
GetNextToken();
@@ -273,7 +273,7 @@ public void Exec()
273273
/// </summary>
274274
public void RestartProgram()
275275
{
276-
this.lex.restartProgram();
276+
this.lex.RestartProgram();
277277
this.Result = new();
278278
this.instructionStack=new();
279279
this.ifCounter=0;
@@ -284,10 +284,10 @@ public void RestartProgram()
284284
/// Create a program container
285285
/// </summary>
286286
/// <returns>The program container</returns>
287-
public bool tryParseSourceCode(out programContainer program)
287+
public bool tryParseSourceCode(out ProgramContainer program)
288288
{
289289
program= new();
290-
List<programElement> src = new();
290+
List<ProgramElement> src = new();
291291
program.variables=new();
292292
try
293293
{
@@ -301,7 +301,7 @@ public bool tryParseSourceCode(out programContainer program)
301301
{
302302
if (src.Count > 0) // skip all the first newlines if the program start with them
303303
{
304-
src.Add(new programElement() { token = lastToken, value = lex.Value, identifier = lex.Identifier });
304+
src.Add(new ProgramElement() { token = lastToken, value = lex.Value, identifier = lex.Identifier });
305305
}
306306
while (lastToken == Token.NewLine) GetNextToken();
307307
}
@@ -311,14 +311,14 @@ public bool tryParseSourceCode(out programContainer program)
311311
break;
312312
}
313313
lineMarker = lex.TokenMarker; // save current line marker
314-
src.Add(new programElement() { token = lastToken,
314+
src.Add(new ProgramElement() { token = lastToken,
315315
value = lex.Value,
316316
identifier = lex.Identifier,
317317
isDoted=lex.Identifier.Contains('.')
318318
});
319319
GetNextToken();
320320
}
321-
src.Add(new programElement() { token = Token.EOF, value = lex.Value, identifier = "" });
321+
src.Add(new ProgramElement() { token = Token.EOF, value = lex.Value, identifier = "" });
322322
}
323323
catch
324324
{

FAST.FBasicInterpreter/Core/Interpreter_Statements.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/// The interpreter factory of the FBASIC
55
/// Part: THE FBASIC STATMENTS
66
/// </summary>
7-
public partial class Interpreter : IfbasicError
7+
public partial class Interpreter : IFBasicError
88
{
99
#region (+) methods to implement the FBASIC Flow statements
1010

0 commit comments

Comments
 (0)