private static FunnyType ToFunnyType(this Tok token) { switch (token.Type) { case TokType.Int16Type: return(FunnyType.Int16); case TokType.Int32Type: return(FunnyType.Int32); case TokType.Int64Type: return(FunnyType.Int64); case TokType.UInt8Type: return(FunnyType.UInt8); case TokType.UInt16Type: return(FunnyType.UInt16); case TokType.UInt32Type: return(FunnyType.UInt32); case TokType.UInt64Type: return(FunnyType.UInt64); case TokType.RealType: return(FunnyType.Real); case TokType.BoolType: return(FunnyType.Bool); case TokType.TextType: return(FunnyType.Text); case TokType.AnythingType: return(FunnyType.Anything); case TokType.Id: if (token.Value == "any") { return(FunnyType.Anything); } break; } throw ErrorFactory.TypeExpectedButWas(token); }
public static bool MoveIf(this TokFlow flow, TokType tokType, out Tok tok) { if (flow.IsCurrent(tokType)) { tok = flow.Current; flow.MoveNext(); return(true); } tok = null; return(false); }