Advertisement
messimmous

Untitled

Apr 29th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. def Ariphmetical(Ind):
  2. (newInd, Composite, err) = is_Composite_Ariphmetical(Ind)
  3. if (Composite):
  4. return (newInd, True, True)
  5. (newInd, Operand, err) = is_Operand(Ind)
  6. if (Operand):
  7. return (newInd, True, True)
  8. print ("Не является арифметическим выражением")
  9. return (Ind, False, False)
  10. def is_Composite_Ariphmetical(Ind):
  11. StartInd = Ind
  12. try:
  13. StartInd = Ind
  14. (newInd, Operand, err) = is_Operand(Ind)
  15. if Operand:
  16. Ind=newInd
  17. if (Ind>=len(Lexems)):
  18. return (StartInd, False, False)
  19. else:
  20. return (StartInd, False, False)
  21. (typing, i)=Lexems[Ind]
  22. if (typing[i]) == '+' or (typing[i]) == '-':
  23. Ind=Ind+1
  24. if (Ind>=len(Lexems)):
  25. return (StartInd, False, False)
  26. else:
  27. return (StartInd, False, False)
  28. (newInd, Operand, err) = is_Operand(Ind)
  29. if Operand:
  30. Ind=newInd
  31. if (Ind>len(Lexems)):
  32. return (StartInd, False, False)
  33. else:
  34. print("Ожидается второй аргумент арифметической операции")
  35. return (StartInd, False, False)
  36. return (Ind, True, True)
  37. except BaseException:
  38. return (StartInd, False, False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement