add ir emitter

This commit is contained in:
Youmu Liu
2026-06-16 21:04:51 +08:00
parent 3cfd29f793
commit a7bb3209dd
9 changed files with 711 additions and 148 deletions
@@ -148,7 +148,7 @@ namespace StgSharp.RegularAnalysis.TextRegex
}
throw new InvalidOperationException("Unclosed count specifier");
case '*' or '+':
int count = _source[pos + 1] == '?' ? 2 : 1;
int count = pos + 1 >= _source.Length ? 1 : (_source[pos + 1] == '?' ? 2 : 1);
position = pos + count;
return new Token<RegexElementLabel>(_source[(pos)..(pos + count)], 0, pos,
RegexElementLabel.COUNT);
@@ -157,6 +157,7 @@ namespace StgSharp.RegularAnalysis.TextRegex
return new Token<RegexElementLabel>(_source[(pos)..(pos + 1)], 0, pos,
RegexElementLabel.COUNT);
case '.':
position = pos + 1;
return new Token<RegexElementLabel>(_source[(pos)..(pos + 1)], 0, pos,
RegexElementLabel.UNIT);
default:
@@ -287,7 +288,7 @@ namespace StgSharp.RegularAnalysis.TextRegex
}
// Consume "(?<name>"
int consumedLen = (i - start) + 1; // include '>'
int consumedLen = i - start + 1; // include '>'
string text = _source.Substring(start, consumedLen);
position = start + consumedLen;