add #_ discard syntax

This commit is contained in:
gilch 2017-08-02 15:53:46 -06:00
parent d9a5acbcc9
commit 203965d0fa
2 changed files with 17 additions and 0 deletions

View File

@ -25,6 +25,7 @@ lg.add('QUOTE', r'\'%s' % end_quote)
lg.add('QUASIQUOTE', r'`%s' % end_quote)
lg.add('UNQUOTESPLICE', r'~@%s' % end_quote)
lg.add('UNQUOTE', r'~%s' % end_quote)
lg.add('DISCARD', r'#_')
lg.add('HASHSTARS', r'#\*+')
lg.add('HASHOTHER', r'#%s' % identifier)

View File

@ -153,6 +153,17 @@ def list_contents_single(p):
return [p[0]]
@pg.production("list_contents : DISCARD term discarded_list_contents")
def list_contents_empty(p):
return []
@pg.production("discarded_list_contents : DISCARD term discarded_list_contents")
@pg.production("discarded_list_contents :")
def discarded_list_contents(p):
pass
@pg.production("term : identifier")
@pg.production("term : paren")
@pg.production("term : dict")
@ -163,6 +174,11 @@ def term(p):
return p[0]
@pg.production("term : DISCARD term term")
def term_discard(p):
return p[2]
@pg.production("term : QUOTE term")
@set_quote_boundaries
def term_quote(p):