1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-25 15:35:37 +01:00
GiantsTools/Giants.BinTools/Macro/MacroLineFactory.cs
2020-09-05 22:22:23 -07:00

25 lines
1.1 KiB
C#

namespace Giants.BinTools.Macro
{
using Giants.BinTools.Symbol;
public static class MacroLineFactory
{
public static MacroLine Read(string[] tokens, SymbolTable symbolTable)
{
string instruction = tokens[0].ToLowerInvariant().Trim();
return instruction switch
{
MacroInstruction.GroupUse => new GroupUseMacroLine(tokens),
MacroInstruction.DefByte => new DataDefinitionMacroLine(instruction, tokens, symbolTable),
MacroInstruction.DefFloat => new DataDefinitionMacroLine(instruction, tokens, symbolTable),
MacroInstruction.DefLong => new DataDefinitionMacroLine(instruction, tokens, symbolTable),
MacroInstruction.Name0cs => new DataDefinitionMacroLine(instruction, tokens, symbolTable),
MacroInstruction.If => new IfMacroLine(tokens),
MacroInstruction.Else => new ElseMacroLine(),
MacroInstruction.EndIf => new EndIfMacroLine(),
_ => null,
};
}
}
}