Skip to content

Commit

Permalink
Modify outer lexer to admit dots in attribute keys (#864)
Browse files Browse the repository at this point in the history
Related: #3953

---------

Co-authored-by: devops <devops@runtimeverification.com>
  • Loading branch information
tothtamas28 and devops authored Feb 6, 2024
1 parent f78b717 commit 71819ec
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pyk/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
project = 'pyk'
author = 'Runtime Verification, Inc'
copyright = '2024, Runtime Verification, Inc'
version = '0.1.614'
release = '0.1.614'
version = '0.1.615'
release = '0.1.615'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyk/package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.614
0.1.615
2 changes: 1 addition & 1 deletion pyk/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 = "pyk"
version = "0.1.614"
version = "0.1.615"
description = ""
authors = [
"Runtime Verification, Inc. <contact@runtimeverification.com>",
Expand Down
8 changes: 4 additions & 4 deletions pyk/src/pyk/kast/outer_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def _attr(la: str, it: Iterator[str]) -> Generator[Token, None, str]:


def _attr_key(la: str, it: Iterator[str]) -> tuple[Token, str]:
# ["a"-"z","1"-"9"](["A"-"Z", "a"-"z", "-", "0"-"9"])*("<" (["A"-"Z", "a"-"z", "-", "0"-"9"])+ ">")?
# ["a"-"z","1"-"9"](["A"-"Z", "a"-"z", "-", "0"-"9", "."])*("<" (["A"-"Z", "a"-"z", "-", "0"-"9"])+ ">")?

consumed: list[str] = []
if la not in _LOWER and la not in _DIGIT:
Expand All @@ -732,21 +732,21 @@ def _attr_key(la: str, it: Iterator[str]) -> tuple[Token, str]:
consumed.append(la)
la = next(it, '')

while la in _ALNUM or la == '-':
while la in _ALNUM or la == '-' or la == '.':
consumed.append(la)
la = next(it, '')

if la == '<':
consumed.append(la)
la = next(it, '')

if not la in _ALNUM and la != '-':
if not la in _ALNUM and la != '-' and la != '.':
raise _unexpected_character(la)

consumed.append(la)
la = next(it, '')

while la in _ALNUM or la == '-':
while la in _ALNUM or la == '-' or la == '.':
consumed.append(la)
la = next(it, '')

Expand Down
22 changes: 22 additions & 0 deletions pyk/src/tests/unit/test-data/outer-lexer/attr-key-with-dots.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[org.kframework.attributes.Location(Location(50,10,50,120))]
===
LBRACK
[

ATTR_KEY
org.kframework.attributes.Location

LPAREN
(

ATTR_CONTENT
Location(50,10,50,120)

RPAREN
)

RBRACK
]

EOF

0 comments on commit 71819ec

Please sign in to comment.