Skip to content

Commit 851360b

Browse files
committed
Fix Batch strings
1 parent 0d1ef5c commit 851360b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pygments/lexers/shell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,16 @@ class BatchLexer(RegexLexer):
214214
(_nl, _punct, _ws, _nl))
215215
_number = r'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)' % _token_terminator
216216
_opword = r'(?:equ|geq|gtr|leq|lss|neq)'
217-
_string = r'(?:"[^%s"]*"?)' % _nl
217+
_string = r'(?:"[^%s"]*(?:"|(?=[%s])))' % (_nl, _nl)
218218
_variable = (r'(?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|'
219219
r'[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|'
220220
r'\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|'
221221
r'(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:'
222222
r'[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))' %
223223
(_nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl))
224-
_core_token = r'(?:(?:(?:\^[%s]?)?[^%s%s%s])+)' % (_nl, _nl, _punct, _ws)
225-
_core_token_compound = r'(?:(?:(?:\^[%s]?)?[^%s%s%s)])+)' % (_nl, _nl,
226-
_punct, _ws)
224+
_core_token = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s])+)' % (_nl, _nl, _punct, _ws)
225+
_core_token_compound = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s)])+)' % (_nl, _nl,
226+
_punct, _ws)
227227
_token = r'(?:[%s]+|%s)' % (_punct, _core_token)
228228
_token_compound = r'(?:[%s]+|%s)' % (_punct, _core_token_compound)
229229
_stoken = (r'(?:[%s]+|(?:%s|%s|%s)+)' %

0 commit comments

Comments
 (0)