Changeset 2734


Ignore:
Timestamp:
Apr 24, 2007, 7:07:05 AM (14 years ago)
Author:
orlov
Message:
  • Format expressions according to new syntax rules.
  • Fixed comparing of terms with equal priorities.
  • Fixed priority of Result class (equals to Expr).
Location:
to-imperative/trunk/java/org/refal/plus
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/java/org/refal/plus/Expr.java

    r2682 r2734  
    214214        for (int i = start, j = e.start; min_len > 0; min_len--, i++, j++) {
    215215            int res;
    216             Class c1 = terms[i].getClass();
    217             Class c2 = e.terms[j].getClass();
    218             if (c1 != c2) {
    219                 if (RefalRuntime.getPriority(c1) < RefalRuntime.getPriority(c2))
    220                     res = -1;
    221                 else
    222                     res = 1;
    223             }
     216            int p1 = RefalRuntime.getPriority(terms[i].getClass());
     217            int p2 = RefalRuntime.getPriority(e.terms[j].getClass());
     218            if (p1 < p2)
     219                res = -1;
     220            else if (p1 > p2)
     221                res = 1;
    224222            else {
    225223                try {
  • to-imperative/trunk/java/org/refal/plus/Result.java

    r2682 r2734  
    77public final class Result extends Expr
    88{
     9    static
     10    {
     11        RefalRuntime.setPriorityTheSame(Result.class, Expr.class);
     12    }
     13
    914    /**
    1015     * Creates uninitialized expression.
  • to-imperative/trunk/java/org/refal/plus/Word.java

    r2655 r2734  
    4747            return false;
    4848        char c = str.charAt(0);
    49         if (!Character.isUpperCase(c) && c != '!' && c != '?')
     49        if (!Character.isUpperCase(c) && c != '_')
    5050            return false;
    5151        for (int i = 1; i < str.length(); i++) {
    5252            c = str.charAt(i);
    53             if (!Character.isLetterOrDigit(c) && c != '!' && c != '?' && c != '-')
     53            if (!Character.isLetterOrDigit(c) && c != '_')
    5454                return false;
    5555        }
Note: See TracChangeset for help on using the changeset viewer.