public ScannedToken(SheepTokenType type, BetterString text, int line) { Type = type; Position = text.Position; Line = line; Text = text; }
private void addToTokens(SheepTokenType type, bool isRegex, string text) { SheepToken token; token.Type = type; token.IsRegex = isRegex; token.Text = text; if (isRegex) { token.Regex = new Regex(text); _regexTokens.Add(token); } else { token.Regex = null; _normalTokens.Add(token); } }
private float getFloatFromLiteralToken(SheepTokenType type, BetterString text) { if (type == SheepTokenType.LiteralFloat) { float data; if (text.TryParseFloat(out data)) { return(data); } } else if (type == SheepTokenType.LiteralInteger) { int data; if (text.TryParseInt(out data)) { return((float)data); } } throw new SheepCompilerException(); }
public SheepToken2(SheepTokenType type, string text) { Type = type; Text = text; }