Skip to content

Commit

Permalink
Merge pull request #50 from benber86/feat/hexstrings
Browse files Browse the repository at this point in the history
Add support for hex strings
  • Loading branch information
benber86 authored Dec 27, 2024
2 parents 746541e + eccc20f commit a20ac8f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mamushi/parsing/grammar.lark
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ NAME: /[a-zA-Z_]\w*/
COMMENT.3: /#[^\n\r]*/
_NEWLINE: ( /\r?\n[\t ]*/ | COMMENT )+

STRING: /b?("(?!"").*?(?<!\\)(\\\\)*?"|'(?!'').*?(?<!\\)(\\\\)*?')/i
STRING: /b?(x?"(?!"").*?(?<!\\)(\\\\)*?"|x?'(?!'').*?(?<!\\)(\\\\)*?')/i
DOCSTRING: /(""".*?(?<!\\)(\\\\)*?"""|'''.*?(?<!\\)(\\\\)*?''')/is
?strings: STRING+

Expand Down
23 changes: 23 additions & 0 deletions tests/data/declarations/bytes_string_spacing.vy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@internal
def a():
b: String[10] = '1234567890'




c: Bytes[100] = b"\x01"


d: Bytes[100] = x"01afef"

d: Bytes[100] = x'01afef'
# output
@internal
def a():
b: String[10] = "1234567890"

c: Bytes[100] = b"\x01"

d: Bytes[100] = x"01afef"

d: Bytes[100] = x"01afef"

0 comments on commit a20ac8f

Please sign in to comment.