Skip to content

Commit

Permalink
Add . to escaped character (#175)
Browse files Browse the repository at this point in the history
* Add `.` to escaped character

* Set Version: 0.1.60

* Escape module names

* Fix quotation

* Update expected files, change lemmas.k to reference escaped contract name

* Set Version: 0.1.61

---------

Co-authored-by: devops <devops@runtimeverification.com>
Co-authored-by: Juan C <juanconrod@protonmail.com>
Co-authored-by: Noah Watson <noah@nwatson.xyz>
Co-authored-by: Noah Watson <107630091+nwatson22@users.noreply.github.com>
  • Loading branch information
5 people authored Nov 15, 2023
1 parent ca6390c commit df313d0
Show file tree
Hide file tree
Showing 7 changed files with 391 additions and 387 deletions.
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.60
0.1.61
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kontrol"
version = "0.1.60"
version = "0.1.61"
description = "Foundry integration for KEVM"
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '0.1.60'
VERSION: Final = '0.1.61'
10 changes: 7 additions & 3 deletions src/kontrol/solc_to_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,11 @@ def srcmap(self) -> dict[int, tuple[int, int, int, str, int]]:

@staticmethod
def contract_to_module_name(c: str) -> str:
return c + '-CONTRACT'
return Contract.escaped(c, 'S2K') + '-CONTRACT'

@staticmethod
def contract_to_verification_module_name(c: str) -> str:
return c + '-VERIFICATION'
return Contract.escaped(c, 'S2K') + '-VERIFICATION'

@staticmethod
def test_to_claim_name(t: str) -> str:
Expand All @@ -426,7 +426,7 @@ def name_upper(self) -> str:

@staticmethod
def escaped_chars() -> list[str]:
return [Contract.PREFIX_CODE, '_', '$']
return [Contract.PREFIX_CODE, '_', '$', '.']

@staticmethod
def escape_char(char: str) -> str:
Expand All @@ -437,6 +437,8 @@ def escape_char(char: str) -> str:
as_ecaped = 'Und'
case '$':
as_ecaped = 'Dlr'
case '.':
as_ecaped = 'Dot'
case _:
as_ecaped = hex(ord(char)).removeprefix('0x')
return f'{Contract.PREFIX_CODE}{as_ecaped}'
Expand All @@ -449,6 +451,8 @@ def unescape_seq(seq: str) -> tuple[str, int]:
return '_', 3
elif seq.startswith('Dlr'):
return '$', 3
elif seq.startswith('Dot'):
return '.', 3
else:
return chr(int(seq, base=16)), 4

Expand Down
Loading

0 comments on commit df313d0

Please sign in to comment.