-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperand.cs
More file actions
38 lines (32 loc) · 947 Bytes
/
Copy pathOperand.cs
File metadata and controls
38 lines (32 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Sid.Parse.TextPatternParser
{
public delegate T fOperand<T>(int pos, string str, RunState runState);
public class Operand
{
public static fOperand<T> StaticValue<T>(T value)
{
return (int pos, string str, RunState runState) => value;
}
public static fOperand<T> Variable<T>(string varName)
{
return (int pos, string str, RunState runState) => (T)runState.GetVariable(varName);
}
public static fOperand<int> InputStringLength()
{
return (int pos, string str, RunState runState) => str.Length;
}
public static fOperand<int> CurrentPosition()
{
return (int pos, string str, RunState runState) => pos;
}
public static fOperand<T> CallFunction<T>(string funcName)
{
return (int pos, string str, RunState runState) => (T)runState.CallFunction<T>(funcName, pos, str);
}
}
}