1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-22 06:05:38 +01:00
GiantsTools/Giants.BinTools/Macro/MacroLineFactory.cs

25 lines
1.1 KiB
C#
Raw Normal View History

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,
};
}
}
}