Пример #1
0
 def uriref(self):
     if self.peek('<'):
         uri = self.eat(r_uriref).group(1)
         uri = unquote(uri)
         uri = uriquote(uri)
         return URI(uri)
     return False
Пример #2
0
 def literal(self):
     if self.peek('"'):
         lit, lang, dtype = self.eat(r_literal).groups()
         if lang:
             lang = lang
         else:
             lang = None
         if dtype:
             dtype = unquote(dtype)
             dtype = uriquote(dtype)
             dtype = URI(dtype)
         else:
             dtype = None
         if lang and dtype:
             raise ParseError("Can't have both a language and a datatype")
         lit = unquote(lit)
         return Literal(lit, lang, dtype)
     return False