Ejemplo n.º 1
0
 public static object DefineSymbolMacro(Symbol sym, SymbolMacro value, string doc)
 {
     EraseVariable(sym);
     sym.SymbolMacroValue      = value;
     sym.CompilerDocumentation = doc;
     return(sym);
 }
Ejemplo n.º 2
0
 public static Expression CompileDefineSymbolMacro(Cons form, AnalysisScope scope)
 {
     // define-compiler name form
     CheckLength(form, 3);
     var sym = CheckSymbol(Second(form));
     if (sym.IsDynamic)
     {
         throw new LispException("Invalid symbol-macro name: {0}", sym);
     }
     WarnWhenShadowing(sym);
     string doc = "";
     var macro = new SymbolMacro(Third(form));
     return Expression.Call(DefineSymbolMacroMethod, Expression.Constant(sym), Expression.Constant(macro), Expression.Constant(doc, typeof(string)));
 }
Ejemplo n.º 3
0
 public static object DefineSymbolMacro(Symbol sym, SymbolMacro value, string doc)
 {
     EraseVariable(sym);
     sym.SymbolMacroValue = value;
     sym.CompilerDocumentation = doc;
     return sym;
 }
Ejemplo n.º 4
0
 public static Expression CompileLetSymbolMacro(Cons form, AnalysisScope scope)
 {
     // let-symbol-macro name form
     CheckLength(form, 3);
     CheckMinLength(form, 3);
     var sym = CheckSymbol(Second(form));
     if (sym.IsDynamic)
     {
         throw new LispException("Invalid symbol-macro name: {0}", sym);
     }
     if (!scope.IsBlockScope)
     {
         throw new LispException("Statement requires block or file scope: {0}", form);
     }
     if (sym == Symbols.Tilde)
     {
         throw new LispException("\"~\" is a reserved symbol name");
     }
     if (scope.FindDuplicate(sym))
     {
         throw new LispException("Duplicate declaration of variable: {0}", sym);
     }
     var macro = new SymbolMacro(Third(form));
     scope.DefineMacro(sym, macro, ScopeFlags.SymbolMacro | ScopeFlags.All);
     return Expression.Constant(null);
 }