예제 #1
0
파일: core.py 프로젝트: ray58750034/shorp
 def parse(self, c):
     if self.intext:
         ret = self.textparser.parse(c)
         if ret == ParsedFlag.PASS:
             self.intext = False  
     elif self.textparser.check(c):
         self.intext = True
         return self.textparser.parse(c)
     elif c == '(':
         return ParsedFlag.CONTINUE
     elif c == ')':
         self.setAttribute()
         return ParsedFlag.PASS
     elif c == ',':
         return self.setAttribute()
     elif c == '=':
         token = self.context.token
         if token.idx != 0:
             return ParsedFlag.FAIL
         else:
             token.idx = 1
     elif char.isToken(c):
         token = self.context.token
         token.token[token.idx] = token.token[token.idx] + c
     elif not char.isSpace(c):
         return ParsedFlag.FAIL
     return ParsedFlag.CONTINUE
예제 #2
0
파일: core.py 프로젝트: ray58750034/shorp
 def parse(self, c):
     if char.isToken(c):
         self.content = self.content + c
         return ParsedFlag.CONTINUE
     elif self.content != '' and getattr(self, self.parsers[self.signal])():
         self.content = ''; self.signal = ''
         if self.signal == c:
             return ParsedFlag.CONTINUE
         else:
             return ParsedFlag.DONE
     elif self.signal == c:
         return ParsedFlag.CONTINUE
     
     # attribute already exist
     print ("already exist %s"%self.content)
     return ParsedFlag.FAIL