eric6/ThirdParty/Pygments/pygments/lexers/make.py

changeset 7701
25f42e208e08
parent 7547
21b0534faebc
child 7983
54c5cfbb1e29
equal deleted inserted replaced
7700:a3cf077a8db3 7701:25f42e208e08
3 pygments.lexers.make 3 pygments.lexers.make
4 ~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for Makefiles and similar. 6 Lexers for Makefiles and similar.
7 7
8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
55 backslashflag = line.strip().endswith('\\') 55 backslashflag = line.strip().endswith('\\')
56 elif self.r_comment.match(line): 56 elif self.r_comment.match(line):
57 ins.append((len(done), [(0, Comment, line)])) 57 ins.append((len(done), [(0, Comment, line)]))
58 else: 58 else:
59 done += line 59 done += line
60 for item in do_insertions(ins, lex.get_tokens_unprocessed(done)): 60 yield from do_insertions(ins, lex.get_tokens_unprocessed(done))
61 yield item
62 61
63 def analyse_text(text): 62 def analyse_text(text):
64 # Many makefiles have $(BIG_CAPS) style variables 63 # Many makefiles have $(BIG_CAPS) style variables
65 if re.search(r'\$\([A-Z_]+\)', text): 64 if re.search(r'\$\([A-Z_]+\)', text):
66 return 0.1 65 return 0.1
194 (r'#.*\n', Comment), 193 (r'#.*\n', Comment),
195 ] 194 ]
196 } 195 }
197 196
198 def analyse_text(text): 197 def analyse_text(text):
199 exp = r'^ *CMAKE_MINIMUM_REQUIRED *\( *VERSION *\d(\.\d)* *( FATAL_ERROR)? *\) *$' 198 exp = (
199 r'^[ \t]*CMAKE_MINIMUM_REQUIRED[ \t]*'
200 r'\([ \t]*VERSION[ \t]*\d+(\.\d+)*[ \t]*'
201 r'([ \t]FATAL_ERROR)?[ \t]*\)[ \t]*'
202 r'(#[^\n]*)?$'
203 )
200 if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE): 204 if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE):
201 return 0.8 205 return 0.8
202 return 0.0 206 return 0.0

eric ide

mercurial