Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Ariphmetical(Ind):
- (newInd, Composite, err) = is_Composite_Ariphmetical(Ind)
- if (Composite):
- return (newInd, True, True)
- (newInd, Operand, err) = is_Operand(Ind)
- if (Operand):
- return (newInd, True, True)
- print ("Не является арифметическим выражением")
- return (Ind, False, False)
- def is_Composite_Ariphmetical(Ind):
- StartInd = Ind
- try:
- StartInd = Ind
- (newInd, Operand, err) = is_Operand(Ind)
- if Operand:
- Ind=newInd
- if (Ind>=len(Lexems)):
- return (StartInd, False, False)
- else:
- return (StartInd, False, False)
- (typing, i)=Lexems[Ind]
- if (typing[i]) == '+' or (typing[i]) == '-':
- Ind=Ind+1
- if (Ind>=len(Lexems)):
- return (StartInd, False, False)
- else:
- return (StartInd, False, False)
- (newInd, Operand, err) = is_Operand(Ind)
- if Operand:
- Ind=newInd
- if (Ind>len(Lexems)):
- return (StartInd, False, False)
- else:
- print("Ожидается второй аргумент арифметической операции")
- return (StartInd, False, False)
- return (Ind, True, True)
- except BaseException:
- return (StartInd, False, False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement