mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 00:02:14 -04:00
Merge pull request #606 from quinox/issue_518
Consume longest possible match
This commit is contained in:
commit
8ba87b8c18
2 changed files with 9 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ class RawNginxParser(object):
|
|||
+ Group(ZeroOrMore(Group(comment | assignment) | block))
|
||||
+ right_bracket)
|
||||
|
||||
script = OneOrMore(Group(comment | assignment) | block) + stringEnd
|
||||
script = OneOrMore(Group(comment | assignment) ^ block) + stringEnd
|
||||
|
||||
def __init__(self, source):
|
||||
self.source = source
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import unittest
|
|||
from pyparsing import ParseException
|
||||
|
||||
from letsencrypt_nginx.nginxparser import (
|
||||
RawNginxParser, load, dumps, dump)
|
||||
RawNginxParser, loads, load, dumps, dump)
|
||||
from letsencrypt_nginx.tests import util
|
||||
|
||||
|
||||
|
|
@ -160,6 +160,13 @@ class TestRawNginxParser(unittest.TestCase):
|
|||
['#', ' listen 80;']]],
|
||||
])
|
||||
|
||||
def test_issue_518(self):
|
||||
parsed = loads('if ($http_accept ~* "webp") { set $webp "true"; }')
|
||||
|
||||
self.assertEqual(parsed, [
|
||||
[['if', '($http_accept ~* "webp")'],
|
||||
[['set', '$webp "true"']]]
|
||||
])
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main() # pragma: no cover
|
||||
|
|
|
|||
Loading…
Reference in a new issue