Skip to content

Commit

Permalink
Format multiple prefixes. (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahularya50 authored and kavigupta committed Apr 29, 2019
1 parent 57ee9ef commit cd0787f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions editor/format_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def __init__(self, lst):
self.lst = lst

def __enter__(self):
self.prefix = self.lst.prefix
self.lst.prefix = ""
self.prefix = self.lst.prefix[0]
self.lst.prefix = self.lst.prefix[1:]
return self.prefix

def __exit__(self, *_):
self.lst.prefix = self.prefix
self.lst.prefix = self.prefix + self.lst.prefix

def hold_prefix(self):
return self.PrefixManager(self)
Expand Down Expand Up @@ -59,15 +59,15 @@ def get_expression(buffer: TokenBuffer) -> Formatted:
out = get_rest_of_list(buffer, ")" if token == "(" else "]")
elif token in ("'", "`"):
out = get_expression(buffer)
out.prefix = token.value
out.prefix = token.value + out.prefix
elif token == ",":
if buffer.get_next_token() == "@":
buffer.pop_next_token()
out = get_expression(buffer)
out.prefix = ",@"
out.prefix = ",@" + out.prefix
else:
out = get_expression(buffer)
out.prefix = token.value
out.prefix = token.value + out.prefix
elif token == "\"":
out = FormatAtom('"' + buffer.pop_next_token().value + '"')
buffer.pop_next_token()
Expand Down

0 comments on commit cd0787f

Please sign in to comment.