prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Terraform parsing error string with escaped backslash at the end
  **Describe the issue**
  Checkov crashes if it encounters an escaped backslash (`"\\"`) at the end of a string.
  
  **Examples**
  Minimal example to reproduce the error:
  ```terraform
  variable "slash" {
      default = "\\"
  }
  
  output "slash" {
      value = var.slash
  }
  ```
  `terraform validate` sees this configuration as valid, but checkov fails with a parsing error.
  
  This only happens when the last character of the string is the escaped backslash, as the parser assumes the closing quotation mark is escaped. Adding any normal character at the end of the string doesn't trigger this error.
  ```terraform
  variable "slash" {
      default = "\\"
  }
  ```
  
  **Exception Trace**
  Relevant traceback
  ```sh
  > LOG_LEVEL=DEBUG checkov -d .
  [...]
  [MainThread  ] [DEBUG]  failed while parsing file /workdir/main.tf
  Traceback (most recent call last):
    File "/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/checkov/terraform/parser.py", line 726, in _load_or_die_quietly
      raw_data = hcl2.load(f)
    File "/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/hcl2/api.py", line 12, in load
      return loads(file.read())
    File "/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/hcl2/api.py", line 80, in loads
      raise ValueError(f"Line has unclosed quote marks: {line}")
  ValueError: Line has unclosed quote marks:     default = "\\"
  [...]
  ```
  
  **Desktop (please complete the following information):**
   - OS: MacOS 12.3.1 (Intel)
   - Checkov Version: 2.0.1230
  
  </issue>
  <code>
  [start of setup.py]
  1 #!/usr/bin/env python
  2 import logging
  3 import os
  4 from importlib import util
  5 from os import path
  6 
  7 import setuptools
  8 from setuptools import setup
  9 
  10 # read the contents of your README file
  11 this_directory = path.abspath(path.dirname(__file__))
  12 with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
  13     long_description = f.read()
  14 
  15 logger = logging.getLogger(__name__)
  16 spec = util.spec_from_file_location(
  17     "checkov.version", os.path.join("checkov", "version.py")
  18 )
  19 # noinspection PyUnresolvedReferences
  20 mod = util.module_from_spec(spec)
  21 spec.loader.exec_module(mod)  # type: ignore
  22 version = mod.version  # type: ignore
  23 
  24 setup(
  25     extras_require={
  26         "dev": [
  27             "pytest==5.3.1",
  28             "coverage==5.5",
  29             "coverage-badge",
  30             "GitPython==3.1.7",
  31             "bandit",
  32             "jsonschema",
  33         ]
  34     },
  35     install_requires=[
  36         "bc-python-hcl2==0.3.42",
  37         "cloudsplaining>=0.4.1",
  38         "deep_merge",
  39         "tabulate",
  40         "colorama",
  41         "termcolor",
  42         "junit-xml>=1.9",
  43         "dpath>=1.5.0,<2",
  44         "pyyaml>=5.4.1",
  45         "boto3>=1.17",
  46         "GitPython",
  47         "jmespath",
  48         "tqdm",
  49         "update_checker",
  50         "semantic_version",
  51         "packaging",
  52         "networkx",
  53         "dockerfile-parse",
  54         "docker",
  55         "configargparse",
  56         "argcomplete",
  57         "detect-secrets",
  58         "policyuniverse",
  59         "typing-extensions>=4.1.0",
  60         "cachetools",
  61         "cyclonedx-python-lib>=2.4.0",
  62         "click>=8.0.0",
  63         "aiohttp",
  64         "aiodns",
  65         "aiomultiprocess",
  66         "jsonpath_ng",
  67         "jsonschema~=3.0",
  68         "prettytable>=3.0.0",
  69         "pycep-parser==0.3.7",
  70         "charset-normalizer",
  71     ],
  72     license="Apache License 2.0",
  73     name="checkov",
  74     version=version,
  75     python_requires=">=3.7",
  76     description="Infrastructure as code static analysis",
  77     author="bridgecrew",
  78     author_email="meet@bridgecrew.io",
  79     url="https://github.com/bridgecrewio/checkov",
  80     packages=setuptools.find_packages(exclude=["tests*", "integration_tests*"]),
  81     include_package_data=True,
  82     package_dir={
  83         "checkov.bicep.checks.graph_checks": "checkov/bicep/checks/graph_checks",
  84         "checkov.terraform.checks.graph_checks": "checkov/terraform/checks/graph_checks",
  85     },
  86     package_data={
  87         "checkov": ["py.typed"],
  88         "checkov.bicep.checks.graph_checks": ["*.yaml"],
  89         "checkov.common.util.templates": ["*.jinja2"],
  90         "checkov.terraform.checks.graph_checks": [
  91             "aws/*.yaml",
  92             "gcp/*.yaml",
  93             "azure/*.yaml",
  94         ],
  95     },
  96     scripts=["bin/checkov", "bin/checkov.cmd"],
  97     long_description=long_description,
  98     long_description_content_type="text/markdown",
  99     classifiers=[
  100         "Environment :: Console",
  101         "Intended Audience :: Developers",
  102         "Intended Audience :: System Administrators",
  103         "License :: OSI Approved :: Apache Software License",
  104         "Programming Language :: Python :: 3 :: Only",
  105         "Programming Language :: Python :: 3.7",
  106         "Programming Language :: Python :: 3.8",
  107         "Programming Language :: Python :: 3.9",
  108         "Programming Language :: Python :: 3.10",
  109         "Topic :: Security",
  110         "Topic :: Software Development :: Build Tools",
  111         "Typing :: Typed",
  112     ],
  113 )
  114
  [end of setup.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/setup.py b/setup.py
  --- a/setup.py
  +++ b/setup.py
  @@ -33,7 +33,7 @@
           ]
       },
       install_requires=[
  -        "bc-python-hcl2==0.3.42",
  +        "bc-python-hcl2==0.3.44",
           "cloudsplaining>=0.4.1",
           "deep_merge",
           "tabulate",
  
verification_info: {"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -33,7 +33,7 @@\n         ]\n     },\n     install_requires=[\n-        \"bc-python-hcl2==0.3.42\",\n+        \"bc-python-hcl2==0.3.44\",\n         \"cloudsplaining>=0.4.1\",\n         \"deep_merge\",\n         \"tabulate\",\n", "issue": "Terraform parsing error string with escaped backslash at the end\n**Describe the issue**\r\nCheckov crashes if it encounters an escaped backslash (`\"\\\\\"`) at the end of a string.\r\n\r\n**Examples**\r\nMinimal example to reproduce the error:\r\n```terraform\r\nvariable \"slash\" {\r\n    default = \"\\\\\"\r\n}\r\n\r\noutput \"slash\" {\r\n    value = var.slash\r\n}\r\n```\r\n`terraform validate` sees this configuration as valid, but checkov fails with a parsing error.\r\n\r\nThis only happens when the last character of the string is the escaped backslash, as the parser assumes the closing quotation mark is escaped. Adding any normal character at the end of the string doesn't trigger this error.\r\n```terraform\r\nvariable \"slash\" {\r\n    default = \"\\\\\"\r\n}\r\n```\r\n\r\n**Exception Trace**\r\nRelevant traceback\r\n```sh\r\n> LOG_LEVEL=DEBUG checkov -d .\r\n[...]\r\n[MainThread  ] [DEBUG]  failed while parsing file /workdir/main.tf\r\nTraceback (most recent call last):\r\n  File \"/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/checkov/terraform/parser.py\", line 726, in _load_or_die_quietly\r\n    raw_data = hcl2.load(f)\r\n  File \"/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/hcl2/api.py\", line 12, in load\r\n    return loads(file.read())\r\n  File \"/Users/user/.local/pipx/venvs/checkov/lib/python3.8/site-packages/hcl2/api.py\", line 80, in loads\r\n    raise ValueError(f\"Line has unclosed quote marks: {line}\")\r\nValueError: Line has unclosed quote marks:     default = \"\\\\\"\r\n[...]\r\n```\r\n\r\n**Desktop (please complete the following information):**\r\n - OS: MacOS 12.3.1 (Intel)\r\n - Checkov Version: 2.0.1230\n", "before_files": [{"content": "#!/usr/bin/env python\nimport logging\nimport os\nfrom importlib import util\nfrom os import path\n\nimport setuptools\nfrom setuptools import setup\n\n# read the contents of your README file\nthis_directory = path.abspath(path.dirname(__file__))\nwith open(path.join(this_directory, \"README.md\"), encoding=\"utf-8\") as f:\n    long_description = f.read()\n\nlogger = logging.getLogger(__name__)\nspec = util.spec_from_file_location(\n    \"checkov.version\", os.path.join(\"checkov\", \"version.py\")\n)\n# noinspection PyUnresolvedReferences\nmod = util.module_from_spec(spec)\nspec.loader.exec_module(mod)  # type: ignore\nversion = mod.version  # type: ignore\n\nsetup(\n    extras_require={\n        \"dev\": [\n            \"pytest==5.3.1\",\n            \"coverage==5.5\",\n            \"coverage-badge\",\n            \"GitPython==3.1.7\",\n            \"bandit\",\n            \"jsonschema\",\n        ]\n    },\n    install_requires=[\n        \"bc-python-hcl2==0.3.42\",\n        \"cloudsplaining>=0.4.1\",\n        \"deep_merge\",\n        \"tabulate\",\n        \"colorama\",\n        \"termcolor\",\n        \"junit-xml>=1.9\",\n        \"dpath>=1.5.0,<2\",\n        \"pyyaml>=5.4.1\",\n        \"boto3>=1.17\",\n        \"GitPython\",\n        \"jmespath\",\n        \"tqdm\",\n        \"update_checker\",\n        \"semantic_version\",\n        \"packaging\",\n        \"networkx\",\n        \"dockerfile-parse\",\n        \"docker\",\n        \"configargparse\",\n        \"argcomplete\",\n        \"detect-secrets\",\n        \"policyuniverse\",\n        \"typing-extensions>=4.1.0\",\n        \"cachetools\",\n        \"cyclonedx-python-lib>=2.4.0\",\n        \"click>=8.0.0\",\n        \"aiohttp\",\n        \"aiodns\",\n        \"aiomultiprocess\",\n        \"jsonpath_ng\",\n        \"jsonschema~=3.0\",\n        \"prettytable>=3.0.0\",\n        \"pycep-parser==0.3.7\",\n        \"charset-normalizer\",\n    ],\n    license=\"Apache License 2.0\",\n    name=\"checkov\",\n    version=version,\n    python_requires=\">=3.7\",\n    description=\"Infrastructure as code static analysis\",\n    author=\"bridgecrew\",\n    author_email=\"meet@bridgecrew.io\",\n    url=\"https://github.com/bridgecrewio/checkov\",\n    packages=setuptools.find_packages(exclude=[\"tests*\", \"integration_tests*\"]),\n    include_package_data=True,\n    package_dir={\n        \"checkov.bicep.checks.graph_checks\": \"checkov/bicep/checks/graph_checks\",\n        \"checkov.terraform.checks.graph_checks\": \"checkov/terraform/checks/graph_checks\",\n    },\n    package_data={\n        \"checkov\": [\"py.typed\"],\n        \"checkov.bicep.checks.graph_checks\": [\"*.yaml\"],\n        \"checkov.common.util.templates\": [\"*.jinja2\"],\n        \"checkov.terraform.checks.graph_checks\": [\n            \"aws/*.yaml\",\n            \"gcp/*.yaml\",\n            \"azure/*.yaml\",\n        ],\n    },\n    scripts=[\"bin/checkov\", \"bin/checkov.cmd\"],\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    classifiers=[\n        \"Environment :: Console\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: System Administrators\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Programming Language :: Python :: 3.10\",\n        \"Topic :: Security\",\n        \"Topic :: Software Development :: Build Tools\",\n        \"Typing :: Typed\",\n    ],\n)\n", "path": "setup.py"}]}