Compare commits
2 Commits
f3898809d6
...
024b78a87f
Author | SHA1 | Date |
---|---|---|
alexandre.aboulin | 024b78a87f | 2 years ago |
alexandre.aboulin | 0e0f4b5c6a | 2 years ago |
5 changed files with 47 additions and 42 deletions
@ -0,0 +1,15 @@ |
|||
import re |
|||
|
|||
def isChar(n): |
|||
return re.match(r'[a-z]', str(n)) is not None |
|||
|
|||
def isNumber(n): |
|||
return re.match(r'\d+', str(n)) is not None |
|||
|
|||
def getPrecedence(tok): |
|||
if tok == "(" or tok == "" or tok == "^": |
|||
return 4 |
|||
elif tok == "*" or tok == "/": |
|||
return 3 |
|||
elif tok == "+" or tok == "-": |
|||
return 2 |
Loading…
Reference in new issue