Ticket #2569: trac2569-preparse-xor.patch
| File trac2569-preparse-xor.patch, 1.2 kB (added by cwitty, 5 months ago) |
|---|
-
a/sage/misc/preparser.py
old new 586 586 'ZZ = QQ[Integer(2)**(Integer(1)/Integer(3))]; (x,) = ZZ._first_ngens(Integer(1))' 587 587 sage: QQ[2^(1/3)] 588 588 Number Field in a with defining polynomial x^3 - 2 589 590 sage: preparse("a^b") 591 'a**b' 592 sage: preparse("a^^b") 593 'a^b' 594 sage: 8^1 595 8 596 sage: 8^^1 597 9 598 sage: 9^^1 599 8 589 600 """ 590 601 try: 591 602 # [1,2,..,n] notation … … 839 850 continue 840 851 # 841 852 ####### END CALCULUS ######## 853 854 # Since we use ^ for exponentiation (see below), we 855 # rewrite ^^ to ^ so that XOR is still accessible 856 elif line[i:i+2] == "^^" and not in_quote(): 857 line = line[:i] + "^" + line[i+2:] 858 i += 1 859 continue 842 860 843 861 # exponents can be either ^ or ** 844 862 elif line[i] == "^" and not in_quote():