Changeset 423
- Timestamp:
- Jun 12, 2010 11:26:01 PM (14 years ago)
- Location:
- MetaXa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MetaXa/src/XaLib.rsc
r422 r423 43 43 return t.args[i]; 44 44 } 45 else if( cf(iter(sort(_))) := t.prod.lhs[i]) {45 else if(\cf(iter(sort(_))) := t.prod.lhs[i]) { 46 46 return t.args[i].args; 47 47 } … … 60 60 if(isCF(t)) 61 61 for(i <- domain(t.args)) 62 if( cf(iter(sort(_))) := t.prod.lhs[i]) {62 if(\cf(iter(sort(_))) := t.prod.lhs[i]) { 63 63 return t.args[i].args; 64 64 } … … 68 68 69 69 public bool isCF(Tree t) { 70 return ( cf(sort(_)) := t.prod.rhs ||cf(\parameterized-sort(_,_)) := t.prod.rhs) ? false;70 return (\cf(sort(_)) := t.prod.rhs || \cf(\parameterized-sort(_,_)) := t.prod.rhs) ? false; 71 71 } 72 72 73 73 public bool isCF(Symbol s) { 74 return ( cf(sort(_)) := s||cf(\parameterized-sort(_,_)) := s) ? false;74 return (\cf(sort(_)) := s|| \cf(\parameterized-sort(_,_)) := s) ? false; 75 75 } 76 76 … … 80 80 public list[Tree] asList(Tree t) { 81 81 assert notAmb(t); 82 if( cf(\iter-star-sep(sort(srt),lit(sep))) := t.prod.rhs)83 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];84 else if( cf(\iter-star(sort(srt),lit(sep))) := t.prod.rhs)85 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];86 else if( cf(\iter-sep(sort(srt),lit(sep))) := t.prod.rhs)87 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];88 else if( cf(\iter(sort(srt),lit(sep))) := t.prod.rhs)89 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];90 else if(\list( cf(\iter(sort(srt)))) := t.prod)91 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];92 else if(\list( cf(\iter-star(sort(srt)))) := t.prod)93 return [x | x <- t.args, cf(sort(srt)) := x.prod.rhs];82 if(\cf(\iter-star-sep(sort(srt),lit(sep))) := t.prod.rhs) 83 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 84 else if(\cf(\iter-star(sort(srt),lit(sep))) := t.prod.rhs) 85 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 86 else if(\cf(\iter-sep(sort(srt),lit(sep))) := t.prod.rhs) 87 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 88 else if(\cf(\iter(sort(srt),lit(sep))) := t.prod.rhs) 89 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 90 else if(\list(\cf(\iter(sort(srt)))) := t.prod) 91 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 92 else if(\list(\cf(\iter-star(sort(srt)))) := t.prod) 93 return [x | x <- t.args, \cf(sort(srt)) := x.prod.rhs]; 94 94 throw IllegalTreeFormat("List node not found", t); 95 95 } … … 127 127 assert notAmb(t); 128 128 for(i <- [0 .. size(t.prod.lhs)]) 129 if( cf(opt(\layout())) := t.prod.lhs[i])129 if(\cf(opt(\layout())) := t.prod.lhs[i]) 130 130 ; 131 else if( cf(_) := t.prod.lhs[i]) {131 else if(\cf(_) := t.prod.lhs[i]) { 132 132 if(n == 0) 133 133 return t.args[i]; … … 188 188 public str sortOfList(Symbol sym) { 189 189 switch(sym) { 190 case cf(\iter-star-sep(s, _)):191 return sortName(s); 192 case cf(\iter-sep(s, _)):193 return sortName(s); 194 case cf(\iter-star(s)):195 return sortName(s); 196 case cf(\iter(s)):190 case \cf(\iter-star-sep(s, _)): 191 return sortName(s); 192 case \cf(\iter-sep(s, _)): 193 return sortName(s); 194 case \cf(\iter-star(s)): 195 return sortName(s); 196 case \cf(\iter(s)): 197 197 return sortName(s); 198 198 default: … … 212 212 public str sortName(Symbol sym) { 213 213 switch(sym) { 214 case cf(s):214 case \cf(s): 215 215 return sortName(s); 216 216 case \lex(s): -
MetaXa/src/XaTree.rsc
r422 r423 238 238 239 239 list[XaToken] concPat = []; 240 list[XaToken] space = [];240 list[XaToken] spaces = []; 241 241 list[XaToken] toks = []; 242 242 str firstChar; 243 243 for(tok <- tree@concrete) { 244 244 if(concPat != []) 245 space = [space(" ")];245 spaces = [space(" ")]; 246 246 if(lastChar == "\n") { 247 247 if(indent != "") 248 248 concPat += [space(indent)]; 249 space = [];249 spaces = []; 250 250 lastChar = "\t"; 251 251 } … … 254 254 chars = lastChar; 255 255 toks = [tok]; 256 256 rawPrintln(tok); 257 257 switch(tok) { 258 258 case space(l): 259 space = [];259 spaces = []; 260 260 case comment(c): { 261 261 firstChar = firstChar ? "#"; … … 286 286 if(lastChar != "\t") { // add newline and indent 287 287 toks = [space((lastChar == "\n") ? indent : "\n" + indent), tok]; 288 space = [];288 spaces = []; 289 289 } 290 290 <tree.args[i], fc, _> = reindent(tree.args[i], indent, "\t"); … … 303 303 304 304 if(/^(<suppressSpace>)$/ := chars && /^(<alwaysSpace>)$/ !:= chars) 305 space = [];306 concPat += space ;305 spaces = []; 306 concPat += spaces; 307 307 concPat += toks; 308 308 }
Note:
See TracChangeset
for help on using the changeset viewer.