mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Move syntax interfaces to separate file, add IDirective interface
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace Microsoft.Iris.Asm.Models;
|
||||
|
||||
public interface IAsmItem
|
||||
{
|
||||
public int Line { get; set; }
|
||||
public int Column { get; set; }
|
||||
}
|
||||
|
||||
public abstract record AsmItem : IAsmItem
|
||||
{
|
||||
public int Line { get; set; } = -1;
|
||||
public int Column { get; set; } = -1;
|
||||
}
|
||||
|
||||
public interface IDirective : IAsmItem;
|
||||
public abstract record Directive : AsmItem, IDirective;
|
||||
|
||||
public interface IImport : IDirective;
|
||||
public abstract record Import : Directive;
|
||||
|
||||
public interface IBodyItem : IAsmItem;
|
||||
public abstract record BodyItem : AsmItem, IBodyItem;
|
||||
@@ -5,10 +5,7 @@ using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Asm.Models;
|
||||
|
||||
public interface IBodyItem { }
|
||||
public interface IImport { }
|
||||
|
||||
public record Instruction(string Mnemonic, IEnumerable<Operand> Operands) : IBodyItem
|
||||
public record Instruction(string Mnemonic, IEnumerable<Operand> Operands) : BodyItem
|
||||
{
|
||||
public Instruction(OpCode opCode, OperationType? operationType, IEnumerable<Operand> Operands)
|
||||
: this(LexerMaps.GetMnemonic(opCode, operationType), Operands)
|
||||
@@ -27,12 +24,12 @@ public record Instruction(string Mnemonic, IEnumerable<Operand> Operands) : IBod
|
||||
: Mnemonic;
|
||||
}
|
||||
|
||||
public record Label(string Name) : IBodyItem
|
||||
public record Label(string Name) : BodyItem
|
||||
{
|
||||
public override string ToString() => $"{Name}:";
|
||||
}
|
||||
|
||||
public record Operand(object Value, string Content = null)
|
||||
public record Operand(object Value, string Content = null) : AsmItem
|
||||
{
|
||||
public override string ToString() => Content ?? Value.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user