Changeset 423


Ignore:
Timestamp:
Jun 12, 2010 11:26:01 PM (14 years ago)
Author:
Anya Helene Bagge
Message:

More fixes for Rascal 0.1.26

Location:
MetaXa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MetaXa/src/XaLib.rsc

    r422 r423  
    4343                                        return t.args[i];
    4444                        }
    45                         else if(cf(iter(sort(_))) := t.prod.lhs[i]) {
     45                        else if(\cf(iter(sort(_))) := t.prod.lhs[i]) {
    4646                                return t.args[i].args;
    4747                        }
     
    6060        if(isCF(t))
    6161            for(i <- domain(t.args))
    62                         if(cf(iter(sort(_))) := t.prod.lhs[i]) {
     62                        if(\cf(iter(sort(_))) := t.prod.lhs[i]) {
    6363                                return t.args[i].args;
    6464                        }
     
    6868
    6969public 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;
    7171}
    7272
    7373public bool isCF(Symbol s) {
    74         return (cf(sort(_)) := s|| cf(\parameterized-sort(_,_)) := s) ? false;
     74        return (\cf(sort(_)) := s|| \cf(\parameterized-sort(_,_)) := s) ? false;
    7575}
    7676
     
    8080public list[Tree] asList(Tree t) {
    8181        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];
    9494        throw IllegalTreeFormat("List node not found", t);
    9595}
     
    127127        assert notAmb(t);
    128128        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])
    130130                        ;
    131                 else if(cf(_) := t.prod.lhs[i]) {
     131                else if(\cf(_) := t.prod.lhs[i]) {
    132132                        if(n == 0)
    133133                                return t.args[i];
     
    188188public str sortOfList(Symbol sym) {
    189189        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)):
    197197                        return sortName(s);
    198198                default:
     
    212212public str sortName(Symbol sym) {
    213213        switch(sym) {
    214                 case cf(s):
     214                case \cf(s):
    215215                        return sortName(s);
    216216                case \lex(s):
  • MetaXa/src/XaTree.rsc

    r422 r423  
    238238       
    239239        list[XaToken] concPat = [];
    240         list[XaToken] space = [];
     240        list[XaToken] spaces = [];
    241241        list[XaToken] toks = [];
    242242        str firstChar;
    243243        for(tok <- tree@concrete) {
    244244                if(concPat != [])
    245                         space = [space(" ")];
     245                        spaces = [space(" ")];
    246246                if(lastChar == "\n") {
    247247                        if(indent != "")
    248248                                concPat += [space(indent)];
    249                         space = [];
     249                        spaces = [];
    250250                        lastChar = "\t";
    251251                }
     
    254254                chars = lastChar;
    255255                toks = [tok];
    256 
     256                rawPrintln(tok);
    257257                switch(tok) {
    258258                        case space(l):
    259                                         space = [];
     259                                        spaces = [];
    260260                        case comment(c): {
    261261                                firstChar = firstChar ? "#";
     
    286286                                        if(lastChar != "\t") { // add newline and indent
    287287                                                toks = [space((lastChar == "\n") ? indent : "\n" + indent), tok];
    288                                                 space = [];
     288                                                spaces = [];
    289289                                        }
    290290                                        <tree.args[i], fc, _> = reindent(tree.args[i], indent, "\t");
     
    303303
    304304                if(/^(<suppressSpace>)$/ := chars && /^(<alwaysSpace>)$/ !:= chars)
    305                         space = [];
    306                 concPat += space;
     305                        spaces = [];
     306                concPat += spaces;
    307307                concPat += toks;
    308308        }
Note: See TracChangeset for help on using the changeset viewer.