def match(self, tokenAttributeValue): if (self.tokenList.token.attributeValue) == tokenAttributeValue: print( Style.green('Line({})-Match '.format( self.tokenList.token.line)) + 'token ({} {} {}) '.format( self.tokenList.token, Style.green('with'), tokenAttributeValue)) self.tokenList.nextToken() else: print( Style.red('Line({})-Syntax Error '.format( self.tokenList.token.line)) + Style.reset('{} required.'.format(tokenAttributeValue)))
def matchFactor(self, tokenName, tokenNameNeed=None): if (self.tokenList.token.tokenName) == tokenName: print( Style.green('Line({})-Pass '.format(self.tokenList.token.line)) + Style.reset('token {}'.format(self.tokenList.token))) self.tokenList.nextToken() else: if (tokenNameNeed): print( Style.red('Line({})-Pass Error '.format( self.tokenList.token.line)) + Style.reset('{} required.'.format(tokenNameNeed))) else: print( Style.red('Line({})-Pass Error '.format( self.tokenList.token.line)) + Style.reset('{} required.'.format(tokenName)))