Use constants and enums in UIX script parser

This commit is contained in:
Yoshi Askharoun
2024-03-13 18:55:36 -05:00
parent 3050703ab1
commit d6e3713ccd
6 changed files with 295 additions and 280 deletions
+21 -14
View File
@@ -4,27 +4,34 @@
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System;
namespace SSVParseLib
{
internal enum SSYaccAction
{
Shift, Error, Reduce, Accept, Conflict
}
internal class SSYaccTableRowEntry
{
private const int SSYaccActionShift = 0;
private const int SSYaccActionError = 1;
private const int SSYaccActionReduce = 2;
private const int SSYaccActionAccept = 3;
private const int SSYaccActionConflict = 4;
private const uint SSYaccTableEntryFlagSync = 2147483648;
private const int SSYaccTableEntryFlagShift = 1073741824;
private const int SSYaccTableEntryFlagReduce = 536870912;
private const int SSYaccTableEntryFlagAccept = 268435456;
private const int SSYaccTableEntryFlagConflict = 134217728;
private const uint SSYaccTableEntryFlagMask = 4160749568;
[Flags]
internal enum SSYaccTableEntryFlag : uint
{
Sync = 0x8000_0000,
Shift = 0x4000_0000,
Reduce = 0x2000_0000,
Accept = 0x1000_0000,
Conflict = 0x0800_0000,
Mask = 0xF800_0000,
}
private int m_token;
private int m_entry;
private int m_action;
private SSYaccAction m_action;
private bool m_sync;
public SSYaccTableRowEntry(int q_token, int q_entry, int q_action, int q_sync)
public SSYaccTableRowEntry(int q_token, int q_entry, SSYaccAction q_action, int q_sync)
{
m_token = q_token;
m_entry = q_entry;
@@ -32,7 +39,7 @@ namespace SSVParseLib
m_sync = q_sync != 0;
}
public int action() => m_action;
public SSYaccAction action() => m_action;
public int entry() => m_entry;