public static Symbol ReadBranch(LispReader stream, bool hasTest, BranchMode mode, ref Vector branch) { var haveFeatures = false; if (hasTest) { var test = stream.Read(); switch (mode) { case BranchMode.False: { haveFeatures = false; break; } case BranchMode.True: { haveFeatures = true; break; } case BranchMode.Eval: default: { haveFeatures = EvalFeatureExpr(test); break; } } } else { haveFeatures = mode == BranchMode.True; } if (haveFeatures) { branch = new Vector(); } while (true) { var obj = haveFeatures ? stream.Read() : stream.ReadSuppressed(); if (obj == Symbols.HashElif || obj == Symbols.HashElse || obj == Symbols.HashEndif) { return((Symbol)obj); } else if (haveFeatures) { branch.Add(obj); } } }
public static object ReadPlusExprHandler(LispReader stream, string ch, int arg) { object test = stream.Read(); bool haveFeatures = EvalFeatureExpr(test); if (!haveFeatures) { stream.ReadSuppressed(); return(VOID.Value); } else { return(stream.Read()); } }
public static object ReadCommaHandler(LispReader stream, char ch) { var ch2 = stream.ReadChar(); if (ch2 == '@' || ch2 == '.') { // Destructive splicing is handled as ordinary splicing return(MakeList(Symbols.UnquoteSplicing, stream.Read())); } else { stream.UnreadChar(); return(MakeList(Symbols.Unquote, stream.Read())); } }
public static object ReadQuasiQuoteHandler(LispReader stream, char ch) { var exp1 = stream.Read(); var exp2 = QuasiQuoteExpandRest(exp1); return(exp2); }
public static object ReadCharacterHandler(LispReader stream, string ch, int arg) { stream.UnreadChar(); var name = MakeString(stream.Read()); var chr = DecodeCharacterName(name); return(chr); }
public static object ReadExecuteHandler(LispReader stream, string ch, int arg) { var expr = stream.Read(); var readEval = GetDynamic(Symbols.ReadEval); if (readEval == null) { readEval = false; //stream.loading; } if (!ToBool(readEval)) { throw stream.MakeScannerException("Invalid use of '#.' (prohibited by $read-eval variable)"); } var value = Eval(expr); return(value); }
public static object ReadQuoteHandler(LispReader stream, char ch) { return(MakeList(Symbols.Quote, stream.Read())); }
public static object ReadQuasiQuoteHandler(LispReader stream, char ch) { var exp1 = stream.Read(); var exp2 = QuasiQuoteExpandRest(exp1); return exp2; }
public static object ReadQuoteHandler(LispReader stream, char ch) { return MakeList(Symbols.Quote, stream.Read()); }
public static object ReadPlusExprHandler(LispReader stream, string ch, int arg) { object test = stream.Read(); bool haveFeatures = EvalFeatureExpr(test); if (!haveFeatures) { stream.ReadSuppressed(); return VOID.Value; } else { return stream.Read(); } }
public static object ReadExecuteHandler(LispReader stream, string ch, int arg) { var expr = stream.Read(); var readEval = GetDynamic(Symbols.ReadEval); if (readEval == null) { readEval = false; //stream.loading; } if (!ToBool(readEval)) { throw stream.MakeScannerException("Invalid use of '#.' (prohibited by $read-eval variable)"); } var value = Eval(expr); return value; }
public static object ReadCommaHandler(LispReader stream, char ch) { var ch2 = stream.ReadChar(); if (ch2 == '@' || ch2 == '.') { // Destructive splicing is handled as ordinary splicing return MakeList(Symbols.UnquoteSplicing, stream.Read()); } else { stream.UnreadChar(); return MakeList(Symbols.Unquote, stream.Read()); } }
public static object ReadCharacterHandler(LispReader stream, string ch, int arg) { stream.UnreadChar(); var name = MakeString(stream.Read()); var chr = DecodeCharacterName(name); return chr; }
public static Symbol ReadBranch(LispReader stream, bool hasTest, BranchMode mode, ref Vector branch) { var haveFeatures = false; if (hasTest) { var test = stream.Read(); switch (mode) { case BranchMode.False: { haveFeatures = false; break; } case BranchMode.True: { haveFeatures = true; break; } case BranchMode.Eval: default: { haveFeatures = EvalFeatureExpr(test); break; } } } else { haveFeatures = mode == BranchMode.True; } if (haveFeatures) { branch = new Vector(); } while (true) { var obj = haveFeatures ? stream.Read() : stream.ReadSuppressed(); if (obj == Symbols.HashElif || obj == Symbols.HashElse || obj == Symbols.HashEndif) { return (Symbol)obj; } else if (haveFeatures) { branch.Add(obj); } } }