1 package kawa.standard; 2 import kawa.lang.*; 3 import gnu.expr.*; 4 import gnu.lists.*; 5 6 public class export extends Syntax 7 { 8 public static final export module_export = new export(); 9 static { module_export.setName("module-export"); } 10 11 public boolean scanForDefinitions (Pair st, java.util.Vector forms, 12 ScopeExp defs, Translator tr) 13 { 14 Object list = st.cdr; 15 Object savePos = tr.pushPositionOf(st); 16 try 17 { 18 if (defs instanceof ModuleExp) 19 ((ModuleExp) defs).setFlag(ModuleExp.EXPORT_SPECIFIED); 20 else 21 { 22 tr.error('e', "\'" + getName() + "\' not at module level"); 23 return true; 24 } 25 SyntaxForm restSyntax = null; 26 while (list != LList.Empty) 27 { 28 tr.pushPositionOf(list); 29 while (list instanceof SyntaxForm) 30 { 31 restSyntax = (SyntaxForm) list; 32 list = restSyntax.form; 33 } 34 SyntaxForm nameSyntax = restSyntax; 35 if (list instanceof Pair) 36 { 37 st = (Pair) list; 38 Object symbol = st.car; 39 while (symbol instanceof SyntaxForm) 40 { 41 nameSyntax = (SyntaxForm) symbol; 42 symbol = nameSyntax.form; 43 } 44 if (symbol instanceof String ) 45 { 46 String str = (String ) symbol; 47 if (str.startsWith("namespace:")) 48 { 49 tr.error('w', "'namespace:' prefix ignored"); 50 symbol = str.substring(10).intern(); 51 } 52 } 53 if (symbol instanceof String 54 || symbol instanceof gnu.mapping.Symbol) 55 { 56 if (nameSyntax != null) 57 { 58 } 61 Declaration decl = defs.getNoDefine(symbol); 62 if (decl.getFlag(Declaration.NOT_DEFINING)) 63 Translator.setLine(decl, st); 64 decl.setFlag(Declaration.EXPORT_SPECIFIED); 65 list = st.cdr; 66 continue; 67 } 68 } 69 tr.error('e', "invalid syntax in '" + getName() + '\''); 70 return false; 71 } 72 return true; 73 } 74 finally 75 { 76 tr.popPositionOf(savePos); 77 } 78 } 79 80 public Expression rewriteForm (Pair form, Translator tr) 81 { 82 return null; 83 } 84 } 85 | Popular Tags |