Commits

Gaurav Jain committed 89c2fb3

Add analyse_text method to CMake lexer

Comments (0)

Files changed (2)

pygments/lexers/text.py

         ]
     }
 
+    def analyse_text(text):
+        exp = r'^ *CMAKE_MINIMUM_REQUIRED *\( *VERSION *\d(\.\d)* *( FATAL_ERROR)? *\) *$'
+        if re.search(exp, text, flags = re.MULTILINE | re.IGNORECASE):
+            return 0.8
+        return 0.0
+
 
 class HttpLexer(RegexLexer):
     """

tests/examplefiles/main.cmake

+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+
 SET( SOURCES back.c io.c main.c )
 MESSAGE( ${SOURCES}   )      # three arguments, prints "back.cio.cmain.c"
 MESSAGE( "${SOURCES}" )      # one argument,    prints "back.c;io.c;main.c"