Commits

Daniele Varrazzo committed f4d5465

Only consider PostgreSQL ones as keywords

SQL keywords are too many and contain stuff regularly used for fields
(eg. 'a')

Comments (0)

Files changed (1)

pygments/lexers/_postgres_builtins.py

 
 def parse_keywords(f):
     kw = []
-    re_entry = re.compile('\s*<entry><token>([^<]+)</token></entry>')
-    for line in f:
-        m = re_entry.match(line)
-        if m is None:
-            continue
+    for m in re.finditer(
+            r'\s*<entry><token>([^<]+)</token></entry>\s*'
+            r'<entry>([^<]+)</entry>', f.read()):
+        kw.append(m.group(1))
 
-        kw.append(m.group(1))
+    if not kw:
+        raise ValueError('no keyword found')
 
     kw.sort()
     return kw