This commit is contained in:
ninemine
2025-07-03 18:46:52 +08:00
parent cf27c2336f
commit fff7b274f5
3 changed files with 48 additions and 8 deletions

View File

@@ -0,0 +1,38 @@
namespace Convention.Symbolization.Internal
{
public class ScriptWordVariable : CloneableVariable<ScriptWordVariable>
{
public readonly string word;
public ScriptWordVariable(string word) : base("")
{
this.word = word;
}
public override ScriptWordVariable CloneVariable(string targetSymbolName)
{
return new ScriptWordVariable(word);
}
public override bool Equals(ScriptWordVariable other)
{
return other is not null && word.Equals(other.word);
}
public Keyword GetKeyword()
{
if(Keyword.Keywords.TryGetValue(word, out var keyword))
return keyword;
return null;
}
public Variable GetVariable(SymbolizationContext context)
{
if (context.Variables.TryGetValue(word, out var variable))
{
return variable;
}
return null;
}
}
}