Skip to content

Commit

Permalink
!fixup make DataStructures multiline aware
Browse files Browse the repository at this point in the history
  • Loading branch information
Histalek committed Oct 1, 2024
1 parent b2afe35 commit 18b1d98
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
17 changes: 10 additions & 7 deletions source/DataStructures/Lua/Accessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,19 @@ public override void Process(FileParser fileParser)
if (local)
Ignore = true;

string line = fileParser.Lines[fileParser.CurrentLineCount];
for (int j = 0; j < fileParser.CurrentMatchedLines; j++)
{
Line = Line + fileParser.Lines[fileParser.CurrentLineCount + j];
}

if (typs == null)
NeoDoc.WriteErrors("Missing essential param", new List<string>{
"Missing '@accessor' in '" + GetName() + "' datastructure"
}, fileParser.relPath, fileParser.CurrentLineCount + 1, (int)NeoDoc.ERROR_CODES.MISSING_ESSENTIAL_PARAMS);

Match splitMatch = GetRegex().Match(line);
Match splitMatch = GetRegex().Match(Line);

List<string> tmpData = NeoDoc.GetEntriesFromString(line.Substring(splitMatch.Index, line.Length - splitMatch.Index), out _);
List<string> tmpData = NeoDoc.GetEntriesFromString(Line.Substring(splitMatch.Index, Line.Length - splitMatch.Index), out _);

string wrapperName = tmpData[0].Trim();
string varName = tmpData[1].Trim('"');
Expand All @@ -76,9 +79,9 @@ public override void Process(FileParser fileParser)
FoundPath = fileParser.relPath
};

setterFunc.Line = line;
setterFunc.Line = Line;
setterFunc.Local = local;
setterFunc.FunctionData = line;
setterFunc.FunctionData = Line;
setterFunc.Name = wrapperName + ":" + "Set" + (name ?? funcPartName);

List<Param> _tmpList;
Expand All @@ -105,9 +108,9 @@ public override void Process(FileParser fileParser)
FoundPath = fileParser.relPath
};

getterFunc.Line = line;
getterFunc.Line = Line;
getterFunc.Local = local;
getterFunc.FunctionData = line;
getterFunc.FunctionData = Line;
getterFunc.Name = wrapperName + ":" + "Get" + (name ?? funcPartName);

if (ParamsList == null)
Expand Down
7 changes: 5 additions & 2 deletions source/DataStructures/Lua/CreateConVar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public override bool CheckMatch(string line)

public override void Process(FileParser fileParser)
{
Line = fileParser.Lines[fileParser.CurrentLineCount];

string name = null;

if (ParamsList != null && ParamsList.Count > 0)
Expand All @@ -47,6 +45,11 @@ public override void Process(FileParser fileParser)
ParamsList = null;
}

for (int j = 0; j < fileParser.CurrentMatchedLines; j++)
{
Line = Line + fileParser.Lines[fileParser.CurrentLineCount + j];
}

Match splitMatch = GetRegex().Match(Line);
string result = Line.Substring(splitMatch.Index, Line.Length - splitMatch.Index);

Expand Down
5 changes: 4 additions & 1 deletion source/DataStructures/Lua/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public override void Process(FileParser fileParser)
}
}

Line = fileParser.Lines[fileParser.CurrentLineCount];
for (int j = 0; j < fileParser.CurrentMatchedLines; j++)
{
Line = Line + fileParser.Lines[fileParser.CurrentLineCount + j];
}

if (!Local)
{
Expand Down
6 changes: 5 additions & 1 deletion source/DataStructures/Lua/Hook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public override bool CheckMatch(string line)

public override void Process(FileParser fileParser)
{
Line = fileParser.Lines[fileParser.CurrentLineCount];

string name = null;

Expand All @@ -59,6 +58,11 @@ public override void Process(FileParser fileParser)
ParamsList = null;
}

for (int j = 0; j < fileParser.CurrentMatchedLines; j++)
{
Line = Line + fileParser.Lines[fileParser.CurrentLineCount + j];
}

Match splitMatch = GetRegex().Match(Line);

if (splitMatch.NextMatch().Success) // there are multiple hooks in this line
Expand Down
2 changes: 2 additions & 0 deletions source/FileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class FileParser

internal readonly string relPath;
internal int CurrentLineCount { get; set; }
internal int CurrentMatchedLines { get; set; }
internal List<Param> paramsList { get; set; }

public SortedDictionary<string, WrapperParam> WrapperDict { get; set; }
Expand Down Expand Up @@ -96,6 +97,7 @@ public void Process()

if (dataStructure != null)
{
CurrentMatchedLines = counter - 1;
dataStructure.Initialize(this);
}

Expand Down

0 comments on commit 18b1d98

Please sign in to comment.