Changeset 1938
- Timestamp:
- 02/15/08 15:49:38 (9 months ago)
- Files:
-
- branches/dictionary_changes/resources/dictionary/dictionary.fdic (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/Compiler.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/ErrorHandler.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/FSysGenerator.java (modified) (3 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessDefn.java (modified) (11 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessTarget.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/DictionaryParser.jj (modified) (35 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/IDictionaryObject.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/ISystemResourceState.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/Rdef.java (modified) (14 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/SysResourceState.java (modified) (2 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/Target.java (modified) (2 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/linkage/Linkage.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/compiler/policy/ComponentWithDictObjects.java (modified) (4 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/systemResources/DirResource.java (modified) (2 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/systemResources/FileResource.java (modified) (2 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/systemResources/SystemResource.java (modified) (7 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/systemResources/SystemResourceTypes.java (modified) (3 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/systemResources/SystemResourcesParser.jj (modified) (8 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/translator/Translator.java (modified) (4 diffs)
- branches/dictionary_changes/src/com/tresys/framework/compiler/translator/TranslatorSELinux.java (modified) (35 diffs)
- branches/dictionary_changes/src/com/tresys/framework/plugin/editor/policy/graphic/model/DomainShape.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/plugin/editor/policy/graphic/model/ResourceShape.java (modified) (1 diff)
- branches/dictionary_changes/src/com/tresys/framework/plugin/editor/properties/PathRdefEditContainer.java (modified) (4 diffs)
- branches/dictionary_changes/src/com/tresys/framework/plugin/wizards/shape/ResourceShapePropertyPage.java (modified) (4 diffs)
- branches/dictionary_changes/src/com/tresys/framework/plugin/wizards/shape/ResourceShapePropertyWizard.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dictionary_changes/resources/dictionary/dictionary.fdic
r1768 r1938 75 75 } 76 76 } 77 new 78 [desc : "Create new file in directory"] 79 { 80 resource { 81 dir { read getattr lock search ioctl add_name remove_name write } 82 } 83 transition { 84 dir 85 file 86 } 87 } 88 } 89 } 90 91 rdef file 92 [desc: "a single file"] 93 { 94 requires { file } 95 owner { 96 resource { 97 file { append getattr ioctl link lock read rename setattr unlink write } 98 lnk_file { append getattr ioctl link lock read rename setattr unlink write } 99 } 100 } 101 read { 102 default { read } 103 read 104 [desc: "Read data from file"] 105 [backflow : 0 ] 106 { 107 resource { 108 file { read getattr } 109 lnk_file { read } 110 } 111 } 112 execute 113 [desc: "Execute file"] 114 [backflow : 0 ] 115 { 116 resource { 117 file { read getattr execute } 118 lnk_file { read } 119 } 120 } 121 } 122 write { 123 default { write } 124 write 125 [desc: "Write to file"] 126 [backflow : 1] 127 { 128 resource { 129 file { append lock write } 130 lnk_file { append lock write } 131 } 132 } 133 append_only 134 [desc: "Append existing files"] 135 [backflow : 1] 136 { 137 resource { 138 file { append lock } 139 lnk_file { append lock } 140 } 141 } 77 142 } 78 143 } branches/dictionary_changes/src/com/tresys/framework/compiler/Compiler.java
r1895 r1938 367 367 String policyFilename = (String) iter.next (); 368 368 System.out.println ("Parsing policy in " + polSourceFilenames); 369 if (linkage != null && linkage.LNFILESPATH == null 370 && policyFilename.lastIndexOf ("/") > 0) 371 { 372 linkage.LNFILESPATH = policyFilename 373 .substring (0, policyFilename.lastIndexOf ("/")); 369 if (linkage != null) 370 { 371 if (policyFilename.lastIndexOf ("/") > 0) 372 { 373 linkage.LNFILESPATH = policyFilename.substring (0, policyFilename.lastIndexOf ("/")); 374 } 374 375 } 375 376 CLIErrorHandler policyHandler = new CLIErrorHandler (policyFilename); branches/dictionary_changes/src/com/tresys/framework/compiler/ErrorHandler.java
r1878 r1938 37 37 static final public int ERROR_ENTRYPOINT_MISSING_FILE = 28; 38 38 static final public int ERROR_DUPLICATE_ACCESS = 29; 39 static final public int ERROR_UNABLE_TO_GET_TYPE_FROM_PATH = 30; 39 40 40 41 branches/dictionary_changes/src/com/tresys/framework/compiler/FSysGenerator.java
r1878 r1938 66 66 return; 67 67 68 Iterator rdefs = rdef_map.values().iterator(); 69 70 while (rdefs.hasNext()) 68 for (Iterator rdefs = rdef_map.values().iterator(); rdefs.hasNext(); ) 71 69 { 72 70 Rdef rdef = (Rdef) rdefs.next(); 73 if (rdef.GetSysResourceState(SystemResourceTypes.dir) == SysResourceState.No) 71 if (rdef.GetSysResourceState(SystemResourceTypes.dir) == SysResourceState.No 72 && rdef.GetSysResourceState (SystemResourceTypes.file) == SysResourceState.No) 73 { 74 74 continue; 75 } 75 76 76 77 StringBuffer buff = new StringBuffer (); … … 114 115 return; 115 116 116 Iterator rdefs = rdef_map.values().iterator(); 117 118 while (rdefs.hasNext()) 117 for (Iterator rdefs = rdef_map.values().iterator(); rdefs.hasNext(); ) 119 118 { 120 119 Rdef rdef = (Rdef) rdefs.next(); 121 if (rdef.GetSysResourceState(SystemResourceTypes.dir) == SysResourceState.No) 120 if (rdef.GetSysResourceState(SystemResourceTypes.dir) == SysResourceState.No 121 && rdef.GetSysResourceState (SystemResourceTypes.file) == SysResourceState.No) 122 { 122 123 continue; 123 124 } 125 124 126 StringBuffer buff = new StringBuffer (); 125 127 buff.append(i_domain.getName()); … … 181 183 m_dataBuff.append("\""); 182 184 FileResource fres = (FileResource) iter.next(); 183 m_dataBuff.append(fres. File.getPath());185 m_dataBuff.append(fres.getFile ().getPath()); 184 186 185 187 m_dataBuff.append("\" "); branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessDefn.java
r1878 r1938 15 15 import com.tresys.framework.compiler.linkage.Linkage; 16 16 17 import java.util.Collection; 18 import java.util.HashSet; 17 19 import java.util.Iterator; 18 20 import java.util.Map; … … 20 22 21 23 /** 22 * This class represents an access definition in a Rdef. An AccessDefn in this23 * case refers to one named set of information flow sub-groups. 24 * This class represents an access definition in a Rdef. An AccessDefn in this 25 * case refers to one named set of information flow sub-groups. 24 26 * <p> 25 27 * Syntactically:<br> … … 30 32 * }<br></code> 31 33 * 32 * @see NameValueGroup34 * @see NameValueGroup 33 35 * @see AccessTarget 34 36 */ 35 public final class AccessDefn 36 implements Comparable/* <AccessDefn>*/, INameValue37 public final class AccessDefn 38 implements Comparable/* <AccessDefn> */, INameValue 37 39 { 38 40 … … 43 45 44 46 // The information flow AccessTargets associated with this AccessDefn 45 protected final Map/*<Integer *//*Target*//*, AccessTarget>*/AccessTargets; 47 protected final Map/* <Integer *//* Target *//* , AccessTarget> */AccessTargets; 48 49 // The list of classes to generate type transitions for 50 protected final Collection /* <String> */m_Transitions = new HashSet /* <String> */ (); 46 51 47 52 // optional name value pairs object to associate w/ this access 48 protected final Map/* <String, NameValuePair<?>>*/NameValuePairs;53 protected final Map/* <String, NameValuePair<?>> */NameValuePairs; 49 54 50 55 protected boolean unRevokable; … … 53 58 * AccessDefn constructor creates AccessDefn object and assigns name. 54 59 * 55 * @param token Token from the parser that identifies the AccessResource 56 * @param adg The access definition group this access definition is a member of 57 */ 58 public AccessDefn(AbstractToken token, AccessDefnGroup adg) { 59 this(token, adg, false); 60 * @param token 61 * Token from the parser that identifies the AccessResource 62 * @param adg 63 * The access definition group this access definition is a member 64 * of 65 */ 66 public AccessDefn (AbstractToken token, AccessDefnGroup adg) 67 { 68 this (token, adg, false); 60 69 } 61 70 … … 63 72 * AccessDefn constructor creates AccessDefn object and assigns name. 64 73 * 65 * @param token Token from the parser that identifies the AccessResource 66 * @param adg The access definition group this access definition is a member of 67 */ 68 public AccessDefn(AbstractToken token, AccessDefnGroup adg, boolean unRevokable) { 74 * @param token 75 * Token from the parser that identifies the AccessResource 76 * @param adg 77 * The access definition group this access definition is a member 78 * of 79 */ 80 public AccessDefn (AbstractToken token, AccessDefnGroup adg, boolean unRevokable) 81 { 69 82 Token = token; 70 AccessTargets = new TreeMap/* <Integer *//*Target*//*, AccessTarget>*/();83 AccessTargets = new TreeMap/* <Integer *//* Target *//* , AccessTarget> */(); 71 84 AccessDefnGroup = adg; 72 NameValuePairs = new TreeMap/* <String, NameValuePair<?>>*/();85 NameValuePairs = new TreeMap/* <String, NameValuePair<?>> */(); 73 86 this.unRevokable = unRevokable; 74 87 } 75 88 76 89 /** 77 * Add an AccessTarget to this AccessDefn. 78 * 79 * @param taget The AccessTarget to associate with this AccessDefn. 80 * @return <code>true</code> if access target successfully 81 * inserted, <code>false</code> otherwise 82 */ 83 public boolean AddAccessTarget(AccessTarget target) { 84 if(!AccessTargets.containsKey(target.TargetName)) { 85 AccessTargets.put(target.TargetName, target); 90 * Add an AccessTarget to this AccessDefn. 91 * 92 * @param taget 93 * The AccessTarget to associate with this AccessDefn. 94 * @return <code>true</code> if access target successfully inserted, 95 * <code>false</code> otherwise 96 */ 97 public boolean AddAccessTarget (AccessTarget target) 98 { 99 if (!AccessTargets.containsKey (target.TargetName)) 100 { 101 AccessTargets.put (target.TargetName, target); 86 102 return true; 87 103 } … … 92 108 * Get AccessTarget by Target 93 109 * 94 * @param trgt The Target for the desired AccessTarget 95 * @return AcccessTarget if found, otherwise null 96 */ 97 public AccessTarget GetAccessTarget(Integer /*Target*/trgt) { 98 return (AccessTarget) AccessTargets.get(trgt); 110 * @param trgt 111 * The Target for the desired AccessTarget 112 * @return AcccessTarget if found, otherwise null 113 */ 114 public AccessTarget GetAccessTarget (Integer /* Target */trgt) 115 { 116 return (AccessTarget) AccessTargets.get (trgt); 99 117 } 100 118 … … 102 120 * Add a NameValuePair metadata object. 103 121 * 104 * @param pair NameValuePair to add 105 * @return <code>true</code> when name/value inserted 106 * successfully. <code>false</code> otherwise. 107 */ 108 public boolean AddNameValuePair(NameValuePair /*<?>*/pair) { 122 * @param pair 123 * NameValuePair to add 124 * @return <code>true</code> when name/value inserted successfully. 125 * <code>false</code> otherwise. 126 */ 127 public boolean AddNameValuePair (NameValuePair /* <?> */pair) 128 { 109 129 // insert nvp into pairs map 110 if(NameValuePairs.containsKey(pair.GetName())) { 130 if (NameValuePairs.containsKey (pair.GetName ())) 131 { 111 132 return false; 112 133 } 113 134 114 NameValuePairs.put (pair.GetName(), pair);135 NameValuePairs.put (pair.GetName (), pair); 115 136 return true; 116 137 } … … 119 140 * Retrieve the name/value associated with the name. 120 141 * 121 * @param name String identifying pair to be returned 122 * @return name/value pair indexed by name 123 */ 124 public NameValuePair /*<?>*/GetNameValuePair(String name) { 125 return (NameValuePair /*<?>*/) NameValuePairs.get(name); 142 * @param name 143 * String identifying pair to be returned 144 * @return name/value pair indexed by name 145 */ 146 public NameValuePair /* <?> */GetNameValuePair (String name) 147 { 148 return (NameValuePair /* <?> */) NameValuePairs.get (name); 126 149 } 127 150 128 151 /** 129 152 * Get the Map of name/value pairs. 130 * 131 * @return NameValuePairs associated with object 132 */ 133 public Map/*<String, NameValuePair<?>>*/GetNameValuePairs() { 153 * 154 * @return NameValuePairs associated with object 155 */ 156 public Map/* <String, NameValuePair<?>> */GetNameValuePairs () 157 { 134 158 return NameValuePairs; 135 159 } 136 160 137 /** 138 * Check to ensure this instance is a subset of another. In other words, 139 * this method returns <code>true</code> when the parameter passed to this 140 * method is a superset of this instance. 141 * 142 * @param other Another AccessDefn instance to perform comparison against. 143 * @return <code>true</code> if this instance is a subset of other, 144 * <code>false</code> otherwise. 145 */ 146 public boolean IsSubsetOf(AccessDefn other) { 147 if(other == null) { 161 public void AddTransitionObjectClass (String i_sObjClass) 162 { 163 m_Transitions.add (i_sObjClass); 164 } 165 166 public Collection GetTransitionObjectClasses () 167 { 168 return m_Transitions; 169 } 170 171 /** 172 * Check to ensure this instance is a subset of another. In other words, 173 * this method returns <code>true</code> when the parameter passed to this 174 * method is a superset of this instance. 175 * 176 * @param other 177 * Another AccessDefn instance to perform comparison against. 178 * @return <code>true</code> if this instance is a subset of other, 179 * <code>false</code> otherwise. 180 */ 181 public boolean IsSubsetOf (AccessDefn other) 182 { 183 if (other == null) 184 { 148 185 return false; 149 186 } 150 187 // iterate over targets checking for superset 151 /*for (Map.Entry<Integer *//*Target*//*, AccessTarget> mapEntry: this.AccessTargets.entrySet())*/ 152 Iterator iter = this.AccessTargets.entrySet().iterator(); 153 while(iter.hasNext()) { 154 Map.Entry mapEntry = (Map.Entry) iter.next(); 188 /* for (Map.Entry<Integer *//* Target *//* 189 * , AccessTarget> mapEntry: 190 * this.AccessTargets.entrySet()) 191 */ 192 Iterator iter = this.AccessTargets.entrySet ().iterator (); 193 while (iter.hasNext ()) 194 { 195 Map.Entry mapEntry = (Map.Entry) iter.next (); 155 196 // if it has a corresponding target check that target 156 if(other.AccessTargets.containsKey(mapEntry.getKey())) { 157 if(!((AccessTarget) mapEntry.getValue()) 158 .IsSubsetOf((AccessTarget) other.AccessTargets.get(mapEntry 159 .getKey()))) { 197 if (other.AccessTargets.containsKey (mapEntry.getKey ())) 198 { 199 if (! ((AccessTarget) mapEntry.getValue ()) 200 .IsSubsetOf ((AccessTarget) other.AccessTargets.get (mapEntry.getKey ()))) 201 { 160 202 return false; 161 203 } 162 204 163 } else { 205 } 206 else 207 { 164 208 return false; 165 209 } … … 170 214 /** 171 215 * Test AccessDefn for validity. 172 * 173 * @return <code>true</code> if definition is valid. 174 */ 175 final boolean Validate(Linkage linkage) { 216 * 217 * @return <code>true</code> if definition is valid. 218 */ 219 final boolean Validate (Linkage linkage) 220 { 176 221 boolean valid = true; 177 222 178 /*for (AccessTarget at:AccessTargets.values())*/ 179 Iterator iter = AccessTargets.values().iterator(); 180 while(iter.hasNext()) { 181 AccessTarget at = (AccessTarget) iter.next(); 182 valid &= at.Validate(linkage); 223 /* for (AccessTarget at:AccessTargets.values()) */ 224 Iterator iter = AccessTargets.values ().iterator (); 225 while (iter.hasNext ()) 226 { 227 AccessTarget at = (AccessTarget) iter.next (); 228 valid &= at.Validate (linkage); 183 229 } 184 230 return valid; 185 231 } 186 232 187 public int compareTo(Object o) { 233 public int compareTo (Object o) 234 { 188 235 if (o instanceof AccessDefn) 189 return this.getName ().compareTo(((AccessDefn) o).getName());236 return this.getName ().compareTo ( ((AccessDefn) o).getName ()); 190 237 return -1; 191 238 } 192 239 193 public Map getAccessTargets() { 240 public Map getAccessTargets () 241 { 194 242 return AccessTargets; 195 243 } 196 244 197 public String getName() { 198 if(Token == null) 199 return ""; 245 public String getName () 246 { 247 if (Token == null) 248 return new String (); 200 249 return Token.image; 201 250 } 202 251 203 public AbstractToken getToken() { 252 public AbstractToken getToken () 253 { 204 254 return Token; 205 255 } 206 256 207 public AccessDefnGroup getAccessDefnGroup() { 257 public AccessDefnGroup getAccessDefnGroup () 258 { 208 259 return AccessDefnGroup; 209 260 } … … 212 263 * @return the unRevokable 213 264 */ 214 public boolean isUnRevokable() { 265 public boolean isUnRevokable () 266 { 215 267 return unRevokable; 216 268 } branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/AccessTarget.java
r1396 r1938 138 138 } 139 139 140 public static AccessTarget MergeAccessTargets (141 Collection/*<AccessTarget>*/targets){140 public static AccessTarget MergeAccessTargets (Collection/*<AccessTarget>*/targets) 141 { 142 142 Map/*<String, Vector<PermVector>>*/pvMap = new TreeMap/*<String, Vector<PermVector>>*/(); 143 143 Integer /*Target*/name = null; branches/dictionary_changes/src/com/tresys/framework/compiler/dictionary/DictionaryParser.jj
r1825 r1938 4 4 STATIC = false; 5 5 JDK_VERSION = "1.4"; 6 //DEBUG_PARSER = true;7 //DEBUG_TOKEN_MANAGER = true;6 DEBUG_PARSER = false; 7 DEBUG_TOKEN_MANAGER = false; 8 8 OUTPUT_DIRECTORY="."; 9 9 } … … 14 14 PARSER_BEGIN (DictionaryParser) 15 15 /* 16 * Copyright (C) 2005-200 6Tresys Technology, LLC16 * Copyright (C) 2005-2008 Tresys Technology, LLC 17 17 * License: refer to COPYING file for license information. 18 18 * Authors: Spencer Shimko <sshimko@tresys.com> 19 19 * James Athey <jathey@tresys.com> 20 20 * Brian Williams <bwilliams@tresys.com> 21 * Dave Sugar <dsugar@tresys.com> 21 22 * 22 23 * DictionaryParser: Lexical analyzer and parser generator source 23 * Version: @version@ 24 * 25 * $Rev$ 26 * $Date$ 24 27 */ 25 28 … … 33 36 import com.tresys.framework.compiler.systemResources.SystemResourceTypes; 34 37 35 / *@SuppressWarnings({"unchecked","unused", "serial"})*/38 //@SuppressWarnings({"unchecked","unused", "serial"}) 36 39 37 40 /** 38 41 * This is the DictionaryParser class which drives the parser. 39 42 */ 40 public final class DictionaryParser { 43 public final class DictionaryParser 44 { 41 45 42 46 // Dictionary object that will be filled as parsing occurs … … 51 55 * @param errmsg Error message to display 52 56 */ 53 private void errorGenerate (Token tok, String errmsg){ 57 private void errorGenerate (Token tok, String errmsg) 58 { 54 59 errorHandler.Error(errmsg, tok.beginLine, tok.beginColumn, tok.endColumn); 55 60 } … … 61 66 * @param errmsg Error message to display 62 67 */ 63 private void warnGenerate(Token tok, String errmsg) { 68 private void warnGenerate(Token tok, String errmsg) 69 { 64 70 errorHandler.Warning(errmsg, tok.beginLine, tok.beginColumn, tok.endColumn); 65 71 } 66 72 67 private String parseErrorMessage(ParseException e) { 73 private String parseErrorMessage(ParseException e) 74 { 68 75 String expected = new String (); 69 76 int maxSize = 0; 70 for (int i = 0; i < e.expectedTokenSequences.length; i++) { 71 if (maxSize < e.expectedTokenSequences[i].length) { 77 for (int i = 0; i < e.expectedTokenSequences.length; i++) 78 { 79 if (maxSize < e.expectedTokenSequences[i].length) 80 { 72 81 maxSize = e.expectedTokenSequences[i].length; 73 82 } 74 83 int j; 75 for (j = 0; j < (e.expectedTokenSequences[i].length - 1); j++) { 84 for (j = 0; j < (e.expectedTokenSequences[i].length - 1); j++) 85 { 76 86 expected += e.tokenImage[e.expectedTokenSequences[i][j]]; 77 87 expected += " "; … … 84 94 85 95 if (i != (e.expectedTokenSequences.length - 1) && 86 e.expectedTokenSequences[i][e.expectedTokenSequences[i].length - 1] != 0) { 96 e.expectedTokenSequences[i][e.expectedTokenSequences[i].length - 1] != 0) 97 { 87 98 expected += ", "; 88 99 } … … 90 101 String message = new String ("Encountered \""); 91 102 Token tok = e.currentToken.next; 92 for (int i = 0; i < maxSize; i++) { 103 for (int i = 0; i < maxSize; i++) 104 { 93 105 if (i != 0 && i != (maxSize - 1)) 94 106 message += " "; 95 if (tok.kind == 0) { 107 if (tok.kind == 0) 108 { 96 109 message += e.tokenImage[0]; 97 110 break; … … 100 113 tok = tok.next; 101 114 } 102 if (e.expectedTokenSequences.length == 1) { 115 if (e.expectedTokenSequences.length == 1) 116 { 103 117 message += "\", was expecting: "; 104 } else { 118 } 119 else 120 { 105 121 message += "\", was expecting one of: "; 106 122 } … … 116 132 * @param str String to process. 117 133 */ 118 private String add_escapes(String str) { 134 private String add_escapes(String str) 135 { 119 136 String retval = new String (); 120 137 char[] chars = str.toCharArray(); … … 123 140 { 124 141 char ch = chars[i]; 125 switch (ch) { 126 case 0 : 127 continue; 128 case '\b': 129 retval += ("\\b"); 130 continue; 131 case '\t': 132 retval += ("\\t"); 133 continue; 134 case '\n': 135 retval += ("\\n"); 136 continue; 137 case '\f': 138 retval += ("\\f"); 139 continue; 140 case '\r': 141 retval += ("\\r"); 142 continue; 143 case '\"': 144 retval += ("\\\""); 145 continue; 146 case '\'': 147 retval += ("\\\'"); 148 continue; 149 case '\\': 150 retval += ("\\\\"); 151 continue; 152 default: 153 if (ch < 0x20 || ch > 0x7e) { 154 String s = "0000" + Integer.toString(ch, 16); 155 retval += ("\\u" + s.substring(s.length() - 4, s.length())); 156 } else { 157 retval += (ch); 158 } 159 continue; 142 switch (ch) 143 { 144 case 0 : 145 continue; 146 case '\b': 147 retval += ("\\b"); 148 continue; 149 case '\t': 150 retval += ("\\t"); 151 continue; 152 case '\n': 153 retval += ("\\n"); 154 continue; 155 case '\f': 156 retval += ("\\f"); 157 continue; 158 case '\r': 159 retval += ("\\r"); 160 continue; 161 case '\"': 162 retval += ("\\\""); 163 continue; 164 case '\'': 165 retval += ("\\\'"); 166 continue; 167 case '\\': 168 retval += ("\\\\"); 169 continue; 170 default: 171 if (ch < 0x20 || ch > 0x7e) 172 { 173 String s = "0000" + Integer.toString(ch, 16); 174 retval += ("\\u" + s.substring(s.length() - 4, s.length())); 175 } 176 else 177 { 178 retval += (ch); 179 } 180 continue; 160 181 } 161 182 } … … 185 206 errorHandler = handler; 186 207 187 try { 208 try 209 { 188 210 // attempt to open Reader 189 211 ReInit(dictReader); 190 } catch (TokenMgrError e) { 212 } 213 catch (TokenMgrError e) 214 { 191 215 errorHandler.CriticalError("Error tokenizing dictionary file: " + e.getMessage()); 192 216 } … … 194 218 // encloses parser call to catch all ParseExceptions not 195 219 // handled internally 196 try { 220 try
