Skip to content

Commit

Permalink
Parse sequences of words into one literal
Browse files Browse the repository at this point in the history
  • Loading branch information
mrob95 committed Nov 10, 2019
1 parent eba046b commit 320dc67
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dragonfly/parsing/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def optional(self, args):
return Optional(args[0])

def literal(self, args):
return Literal(args[0])
return Literal(" ".join(args))

def sequence(self, args):
return Sequence(args)
Expand Down
3 changes: 3 additions & 0 deletions dragonfly/test/test_lark_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class TestLarkParser(unittest.TestCase):
def test_literal(self):
check_parse_tree("test ", Literal(u"test"))

def test_multiple_literals(self):
check_parse_tree("test hello world ", Literal(u"test hello world"))

def test_parens(self):
check_parse_tree("(test ) ", Literal(u"test"))

Expand Down

0 comments on commit 320dc67

Please sign in to comment.