コード例 #1
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'\n\r':
                                pass
                                self.mNEWLINE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'<':
                                pass
                                self.mACTION(True)
                                theRetToken = self._returnToken
                            else:
                                if ((_tokenSet_0.member(self.LA(1)))
                                        and (self.LA(1) != '\r'
                                             and self.LA(1) != '\n')):
                                    pass
                                    self.mLITERAL(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #2
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mHYPHEN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'|':
                                pass
                                self.mPIPE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMICOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLPARENTHESIS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPARENTHESIS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'?':
                                pass
                                self.mUNKNOWN_TERMINUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'0123456789':
                                pass
                                self.mINTEGER(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'L':
                                pass
                                self.mLIN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'P':
                                pass
                                self.mPRO(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'S':
                                pass
                                self.mSTA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'I':
                                pass
                                self.mISO(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'A':
                                pass
                                self.mAGL(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1)
                                        == u'R') and (self.LA(2)
                                                      == u'E') and (self.LA(3)
                                                                    == u'S'):
                                    pass
                                    self.mRES(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1)
                                      == u'R') and (self.LA(2)
                                                    == u'E') and (self.LA(3)
                                                                  == u'P'):
                                    pass
                                    self.mREP(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'b') and (self.LA(2)
                                                               == u':'):
                                    pass
                                    self.mMONOSAC_DECLARATION(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u's') and (self.LA(2)
                                                               == u':'):
                                    pass
                                    self.mSUBSTIT_DECLARATION(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'i') and (self.LA(2)
                                                               == u':'):
                                    pass
                                    self.mINCHI_DECLARATION(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) >= u'a'
                                       and self.LA(1) <= u'z')) and (True):
                                    pass
                                    self.mIDENTIFIER(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #3
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMICOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mHYPHEN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'^':
                                pass
                                self.mCARROT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'!':
                                pass
                                self.mBANG(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'|':
                                pass
                                self.mOR(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'%':
                                pass
                                self.mPREC(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\'':
                                pass
                                self.mCHAR(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'"':
                                pass
                                self.mSTRING(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'{':
                                pass
                                self.mACTION(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'/':
                                pass
                                self.mCOMMENT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u'e') and (
                                        self.LA(2)
                                        == u'r') and (self.LA(3) == u'r') and (
                                            self.LA(4) == u'o') and (
                                                self.LA(5)
                                                == u'r') and (True) and (True):
                                    pass
                                    self.mERROR(True)
                                    theRetToken = self._returnToken
                                elif (_tokenSet_0.member(self.LA(1))) and (
                                        True) and (True) and (True) and (
                                            True) and (True) and (True):
                                    pass
                                    self.mID(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #4
0
ファイル: GroupLexer.py プロジェクト: Abhilash-du/automation
 def nextToken(self):
     while True:
         try: ### try again ..
             while True:
                 _token = None
                 _ttype = INVALID_TYPE
                 self.resetText()
                 try: ## for char stream error handling
                     try: ##for lexical error handling
                         la1 = self.LA(1)
                         if False:
                             pass
                         elif la1 and la1 in u'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                             pass
                             self.mID(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'"':
                             pass
                             self.mSTRING(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'<':
                             pass
                             self.mBIGSTRING(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'{':
                             pass
                             self.mANONYMOUS_TEMPLATE(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'@':
                             pass
                             self.mAT(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'(':
                             pass
                             self.mLPAREN(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u')':
                             pass
                             self.mRPAREN(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'[':
                             pass
                             self.mLBRACK(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u']':
                             pass
                             self.mRBRACK(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u',':
                             pass
                             self.mCOMMA(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'.':
                             pass
                             self.mDOT(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u';':
                             pass
                             self.mSEMI(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'*':
                             pass
                             self.mSTAR(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'+':
                             pass
                             self.mPLUS(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'=':
                             pass
                             self.mASSIGN(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'?':
                             pass
                             self.mOPTIONAL(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'\t\n\u000c\r ':
                             pass
                             self.mWS(True)
                             theRetToken = self._returnToken
                         else:
                             if (self.LA(1)==u':') and (self.LA(2)==u':'):
                                 pass
                                 self.mDEFINED_TO_BE(True)
                                 theRetToken = self._returnToken
                             elif (self.LA(1)==u'/') and (self.LA(2)==u'/'):
                                 pass
                                 self.mSL_COMMENT(True)
                                 theRetToken = self._returnToken
                             elif (self.LA(1)==u'/') and (self.LA(2)==u'*'):
                                 pass
                                 self.mML_COMMENT(True)
                                 theRetToken = self._returnToken
                             elif (self.LA(1)==u':') and (True):
                                 pass
                                 self.mCOLON(True)
                                 theRetToken = self._returnToken
                             else:
                                 self.default(self.LA(1))
                             
                         if not self._returnToken:
                             raise antlr.TryAgain ### found SKIP token
                         ### return token to caller
                         return self._returnToken
                     ### handle lexical errors ....
                     except antlr.RecognitionException, e:
                         raise antlr.TokenStreamRecognitionException(e)
                 ### handle char stream errors ...
                 except antlr.CharStreamException,cse:
                     if isinstance(cse, antlr.CharStreamIOException):
                         raise antlr.TokenStreamIOException(cse.io)
                     else:
                         raise antlr.TokenStreamException(str(cse))
         except antlr.TryAgain:
             pass
コード例 #5
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                                pass
                                self.mID(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMI(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t\n\u000c\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u'/') and (self.LA(2)
                                                             == u'/'):
                                    pass
                                    self.mSL_COMMENT(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (self.LA(2)
                                                               == u'*'):
                                    pass
                                    self.mML_COMMENT(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #6
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'{':
                                pass
                                self.mLCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'}':
                                pass
                                self.mRCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMICOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'?':
                                pass
                                self.mQMARK(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'".ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                                pass
                                self.mIDENT(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u'/') and (self.LA(2)
                                                             == u'*'):
                                    pass
                                    self.mML_COMMENT(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (self.LA(2)
                                                               == u'D'):
                                    pass
                                    self.mDISCARD(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'(') and (self.LA(2)
                                                               == u'N'):
                                    pass
                                    self.mNOLOAD(True)
                                    theRetToken = self._returnToken
                                elif (_tokenSet_0.member(
                                        self.LA(1))) and (self.LA(2) == u'='):
                                    pass
                                    self.mOP_ASSIGN(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1)
                                      == u'0') and (self.LA(2) == u'X'
                                                    or self.LA(2) == u'x'):
                                    pass
                                    self.mHEX(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'(') and (True):
                                    pass
                                    self.mLPAREN(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'=') and (True)
                                      and (True) and (True) and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mEQUALS(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'*') and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mOP_STAR(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'-') and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mOP_MINUS(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'%' or self.LA(1) == u'+'
                                       or self.LA(1) == u'/') and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mOP_OTHERS(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'&') and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mOP_AND(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) == u'|') and (True)
                                      and (self.LA(2) != '=')):
                                    pass
                                    self.mOP_OR(True)
                                    theRetToken = self._returnToken
                                elif (_tokenSet_1.member(self.LA(1))) and (
                                        True) and (True) and (True) and (True):
                                    pass
                                    self.mOPERATOR(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) >= u'0'
                                       and self.LA(1) <= u'9')) and (True):
                                    pass
                                    self.mINT(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #7
0
ファイル: MatlabLexer.py プロジェクト: yonatancah/libermate
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'\'':
                                pass
                                self.mSTRING(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'%':
                                pass
                                self.mCOMMENT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t ':
                                pass
                                self.mSPACE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\n\r':
                                pass
                                self.mNEWLINE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                                pass
                                self.mNAME(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'?':
                                pass
                                self.mMATCH(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\\':
                                pass
                                self.mBACKDIV(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'/':
                                pass
                                self.mDIV(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'^':
                                pass
                                self.mEXP(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'[':
                                pass
                                self.mLBRACK(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'{':
                                pass
                                self.mLBRACE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mMINUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'+':
                                pass
                                self.mPLUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u']':
                                pass
                                self.mRBRACK(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'}':
                                pass
                                self.mRBRACE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMI(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'*':
                                pass
                                self.mSTAR(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u'@') and (self.LA(2)
                                                             == u'('):
                                    pass
                                    self.mATPAREN(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'&') and (self.LA(2)
                                                               == u'&'):
                                    pass
                                    self.mANDAND(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'.') and (self.LA(2)
                                                               == u'\''):
                                    pass
                                    self.mDOTTRANS(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'.') and (self.LA(2)
                                                               == u'\\'):
                                    pass
                                    self.mDOTBACKDIV(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'.') and (self.LA(2)
                                                               == u'/'):
                                    pass
                                    self.mDOTDIV(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'.') and (self.LA(2)
                                                               == u'^'):
                                    pass
                                    self.mDOTEXP(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'.') and (self.LA(2)
                                                               == u'*'):
                                    pass
                                    self.mDOTSTAR(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'=') and (self.LA(2)
                                                               == u'='):
                                    pass
                                    self.mEQUAL(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'>') and (self.LA(2)
                                                               == u'='):
                                    pass
                                    self.mGREATER_OR_EQUAL(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'<') and (self.LA(2)
                                                               == u'='):
                                    pass
                                    self.mLESS_OR_EQUAL(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'|') and (self.LA(2)
                                                               == u'|'):
                                    pass
                                    self.mOROR(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'~') and (self.LA(2)
                                                               == u'='):
                                    pass
                                    self.mNOT_EQUAL(True)
                                    theRetToken = self._returnToken
                                elif (_tokenSet_0.member(
                                        self.LA(1))) and (True):
                                    pass
                                    self.mNUMBER(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'&') and (True):
                                    pass
                                    self.mAND(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'=') and (True):
                                    pass
                                    self.mASSIGN(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'@') and (True):
                                    pass
                                    self.mAT(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'>') and (True):
                                    pass
                                    self.mGREATER_THAN(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'<') and (True):
                                    pass
                                    self.mLESS_THAN(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'~') and (True):
                                    pass
                                    self.mNOT(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'|') and (True):
                                    pass
                                    self.mOR(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #8
0
ファイル: H4Lexer.py プロジェクト: yarshure/baseband-research
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'.':
                                pass
                                self.mPERIOD(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLBRACKET(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRBRACKET(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'{':
                                pass
                                self.mLCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'}':
                                pass
                                self.mRCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'+':
                                pass
                                self.mPLUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mMINUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'*':
                                pass
                                self.mSTAR(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'%':
                                pass
                                self.mMOD(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'~':
                                pass
                                self.mTILDE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'#':
                                pass
                                self.mHASH(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMI(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\'':
                                pass
                                self.mATOM(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                                pass
                                self.mIDENT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'0123456789':
                                pass
                                self.mINT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'"':
                                pass
                                self.mQUOTEDSTRING(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u':') and (self.LA(2)
                                                             == u'-'):
                                    pass
                                    self.mDEFINED_AS(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (self.LA(2)
                                                               == u'/'):
                                    pass
                                    self.mComment(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u':') and (True):
                                    pass
                                    self.mCOLON(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (True):
                                    pass
                                    self.mDIV(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #9
0
 def nextToken(self):
     while True:
         try: ### try again ..
             while True:
                 _token = None
                 _ttype = INVALID_TYPE
                 self.resetText()
                 try: ## for char stream error handling
                     try: ##for lexical error handling
                         la1 = self.LA(1)
                         if False:
                             pass
                         elif la1 and la1 in u'\t\n ':
                             pass
                             self.mWS(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'%':
                             pass
                             self.mCOMMENT(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u';':
                             pass
                             self.mSEMICOLON(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'|':
                             pass
                             self.mBAR(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'[':
                             pass
                             self.mLSQUARE(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u']':
                             pass
                             self.mRSQUARE(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'(':
                             pass
                             self.mLBRACKET(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u')':
                             pass
                             self.mRBRACKET(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'{':
                             pass
                             self.mLCURLY(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'}':
                             pass
                             self.mRCURLY(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u',':
                             pass
                             self.mCOMMA(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'.':
                             pass
                             self.mFULLSTOP(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u':':
                             pass
                             self.mDEFINEDAS(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'<':
                             pass
                             self.mLESSTHAN(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'>':
                             pass
                             self.mGREATERTHAN(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'\\':
                             pass
                             self.mNOT(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'0123456789':
                             pass
                             self.mNUMBER(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'ABCDEFGHIJKLMNOPQRSTUVWXYZ_':
                             pass
                             self.mVARIABLE(True)
                             theRetToken = self._returnToken
                         elif la1 and la1 in u'\'abcdefghijklmnopqrstuvwxyz':
                             pass
                             self.mATOM(True)
                             theRetToken = self._returnToken
                         else:
                             if (self.LA(1)==u'=') and (self.LA(2)==u'<'):
                                 pass
                                 self.mLESSTHANOREQ(True)
                                 theRetToken = self._returnToken
                             elif (self.LA(1)==u'=') and (self.LA(2)==u'>'):
                                 pass
                                 self.mGREATERTHANOREQ(True)
                                 theRetToken = self._returnToken
                             elif (self.LA(1)==u'=') and (True):
                                 pass
                                 self.mEQUAL(True)
                                 theRetToken = self._returnToken
                             else:
                                 self.default(self.LA(1))
                             
                         if not self._returnToken:
                             raise antlr.TryAgain ### found SKIP token
                         ### option { testLiterals=true } 
                         self.testForLiteral(self._returnToken)
                         ### return token to caller
                         return self._returnToken
                     ### handle lexical errors ....
                     except antlr.RecognitionException, e:
                         raise antlr.TokenStreamRecognitionException(e)
                 ### handle char stream errors ...
                 except antlr.CharStreamException,cse:
                     if isinstance(cse, antlr.CharStreamIOException):
                         raise antlr.TokenStreamIOException(cse.io)
                     else:
                         raise antlr.TokenStreamException(str(cse))
         except antlr.TryAgain:
             pass
コード例 #10
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u':':
                                pass
                                self.mCOLON(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u';':
                                pass
                                self.mSEMI(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'+':
                                pass
                                self.mPLUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mMINUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'*':
                                pass
                                self.mSTAR(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'=':
                                pass
                                self.mEQUAL(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'^':
                                pass
                                self.mCARET(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'~':
                                pass
                                self.mTILDE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'>':
                                pass
                                self.mRANGLE(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'[':
                                pass
                                self.mLBRACK(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u']':
                                pass
                                self.mRBRACK(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'|':
                                pass
                                self.mBAR(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'0123456789':
                                pass
                                self.mNUMBER(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'"':
                                pass
                                self.mQUOTEDSTRING(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1) == u'o') and (self.LA(2)
                                                             == u'f'):
                                    pass
                                    self.mOF(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1)
                                      == u'<') and (_tokenSet_0.member(
                                          self.LA(2))):
                                    pass
                                    self.mANGLEQUOTEDSTRING(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (self.LA(2)
                                                               == u'*'):
                                    pass
                                    self.mCOMMENT(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'/') and (True):
                                    pass
                                    self.mDIV(True)
                                    theRetToken = self._returnToken
                                elif (self.LA(1) == u'<') and (True):
                                    pass
                                    self.mLANGLE(True)
                                    theRetToken = self._returnToken
                                elif (_tokenSet_1.member(
                                        self.LA(1))) and (True):
                                    pass
                                    self.mIDENT(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass
コード例 #11
0
    def nextToken(self):
        while True:
            try:  ### try again ..
                while True:
                    _token = None
                    _ttype = INVALID_TYPE
                    self.resetText()
                    try:  ## for char stream error handling
                        try:  ##for lexical error handling
                            la1 = self.LA(1)
                            if False:
                                pass
                            elif la1 and la1 in u'\t\n\r ':
                                pass
                                self.mWS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'(':
                                pass
                                self.mLPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u')':
                                pass
                                self.mRPAREN(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'{':
                                pass
                                self.mLCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'}':
                                pass
                                self.mRCURLY(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'+':
                                pass
                                self.mPLUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'-':
                                pass
                                self.mMINUS(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u',':
                                pass
                                self.mCOMMA(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'*.ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz':
                                pass
                                self.mIDENT(True)
                                theRetToken = self._returnToken
                            elif la1 and la1 in u'#':
                                pass
                                self.mSL_PREPOCESSOR_DIRECTIVE(True)
                                theRetToken = self._returnToken
                            else:
                                if (self.LA(1)
                                        == u'0') and (self.LA(2) == u'X'
                                                      or self.LA(2) == u'x'):
                                    pass
                                    self.mHEX(True)
                                    theRetToken = self._returnToken
                                elif ((self.LA(1) >= u'0'
                                       and self.LA(1) <= u'9')) and (True):
                                    pass
                                    self.mINT(True)
                                    theRetToken = self._returnToken
                                else:
                                    self.default(self.LA(1))

                            if not self._returnToken:
                                raise antlr.TryAgain  ### found SKIP token
                            ### option { testLiterals=true }
                            self.testForLiteral(self._returnToken)
                            ### return token to caller
                            return self._returnToken
                        ### handle lexical errors ....
                        except antlr.RecognitionException, e:
                            raise antlr.TokenStreamRecognitionException(e)
                    ### handle char stream errors ...
                    except antlr.CharStreamException, cse:
                        if isinstance(cse, antlr.CharStreamIOException):
                            raise antlr.TokenStreamIOException(cse.io)
                        else:
                            raise antlr.TokenStreamException(str(cse))
            except antlr.TryAgain:
                pass