Commits

gbrandl  committed bf0c677

Update to the Logtalk lexer, from Paulo Moura.

  • Participants
  • Parent commits 6e76392
  • Branches trunk

Comments (0)

Files changed (2)

   * CMake
   * OOC
 
+- Updated the Logtalk lexer.
+
 - Fixed the HtmlFormatter's handling of noclasses=True to not output any
   classes (#427).
 

File pygments/lexers/other.py

             # Reflection
             (r'(current_predicate|predicate_property)(?=[(])', Keyword),
             # DCGs and term expansion
-            (r'(expand_term|(goal|term)_expansion|phrase)(?=[(])', Keyword),
+            (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])',
+             Keyword),
             # Entity
             (r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])',
              Keyword),
         ],
 
         'directive': [
+            # Conditional compilation directives
+            (r'(el)?if(?=[(])', Keyword, 'root'),		
+            (r'(e(lse|ndif))[.]', Keyword, 'root'),
             # Entity directives
             (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'),
             (r'(end_(category|object|protocol))[.]',Keyword, 'root'),
             # Predicate scope directives
             (r'(public|protected|private)(?=[(])', Keyword, 'root'),
             # Other directives
-            (r'e(ncoding|xport)(?=[(])', Keyword, 'root'),
+            (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'),
             (r'in(fo|itialization)(?=[(])', Keyword, 'root'),
             (r'(dynamic|synchronized|threaded)[.]', Keyword, 'root'),
-            (r'(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)'
-             r'|synchronized)(?=[(])', Keyword, 'root'),
+            (r'(alias|d(ynamic|iscontiguous)|m(eta_predicate|ode|ultifile)|'
+             r's(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'),
             (r'op(?=[(])', Keyword, 'root'),
-            (r'(calls|use(s|_module))(?=[(])', Keyword, 'root'),
+            (r'(calls|reexport|use(s|_module))(?=[(])', Keyword, 'root'),
             (r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'),
             (r'[a-z][a-zA-Z0-9_]*[.]', Text, 'root'),
         ],
         ]
     }
 
+    def analyse_text(text):
+        if ':- object(' in text:
+            return True
+        if ':- protocol(' in text:
+            return True
+        if ':- category(' in text:
+            return True
+        return False
+
 
 def _shortened(word):
     dpos = word.find('$')