1 package kawa.standard; 2 import kawa.lang.*; 3 import gnu.expr.*; 4 import gnu.lists.*; 5 6 public class module_static extends Syntax 7 { 8 public static final module_static module_static = new module_static(); 9 static { module_static.setName("module-static"); } 10 11 public boolean scanForDefinitions (Pair st, java.util.Vector forms, 12 ScopeExp defs, Translator tr) 13 { 14 Object list = st.cdr; 15 if (! (defs instanceof ModuleExp)) 16 { 17 tr.error('e', "\'" + getName() + "\' not at module level"); 18 return true; 19 } 20 if (list instanceof Pair 21 && (st = (Pair) list).cdr == LList.Empty 22 && st.car instanceof Boolean ) 23 { 24 if (st.car == Boolean.FALSE) 25 ((ModuleExp) defs).setFlag(ModuleExp.NONSTATIC_SPECIFIED); 26 else 27 ((ModuleExp) defs).setFlag(ModuleExp.STATIC_SPECIFIED); 28 } 29 else if (list instanceof Pair 30 && (st = (Pair) list).cdr == LList.Empty 31 && st.car instanceof Pair 32 && tr.matches((st = (Pair) st.car).car, Scheme.quote_sym)) 33 { 34 if ((st = (Pair)st.cdr) != LList.Empty 35 && st.car == "init-run") 36 { 37 ((ModuleExp) defs).setFlag(ModuleExp.STATIC_SPECIFIED); 39 ((ModuleExp) defs).setFlag(ModuleExp.STATIC_RUN_SPECIFIED); 40 } 41 else 42 { 43 tr.error('e', "invalid quoted symbol for '" + getName() + '\''); 44 return false; 45 } 46 } 47 else 48 { 49 ((ModuleExp) defs).setFlag(ModuleExp.NONSTATIC_SPECIFIED); 50 51 52 while (list != LList.Empty) 53 { 54 if (! (list instanceof Pair) 55 || ! ((st = (Pair) list).car instanceof String )) 56 { 57 tr.error('e', "invalid syntax in '" + getName() + '\''); 58 return false; 59 } 60 String symbol = (String ) st.car; 61 Declaration decl = defs.getNoDefine(symbol); 62 if (decl.getFlag(Declaration.NOT_DEFINING)) 63 Translator.setLine(decl, st); 64 decl.setFlag(Declaration.STATIC_SPECIFIED); 65 list = st.cdr; 66 } 67 } 68 return true; 69 } 70 71 public Expression rewriteForm (Pair form, Translator tr) 72 { 73 return null; 74 } 75 } 76 | Popular Tags |