Skip to content

Commit f7ad7e9

Browse files
committed
Slight code simplification.
1 parent 7884ab3 commit f7ad7e9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

parsley.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import functools
2+
13
from ometa.grammar import OMeta
24
from ometa.protocol import ParserProtocol
35
from ometa.runtime import ParseError, EOFError, OMetaBase, expected
@@ -60,9 +62,8 @@ def makeProtocol(source, senderFactory, stateFactory, bindings=None,
6062
if bindings is None:
6163
bindings = {}
6264
grammar = OMeta(source).parseGrammar(name)
63-
def protocolFactory():
64-
return ParserProtocol(grammar, senderFactory, stateFactory, bindings)
65-
return protocolFactory
65+
return functools.partial(
66+
ParserProtocol, grammar, senderFactory, stateFactory, bindings)
6667

6768

6869
def unwrapGrammar(w):

0 commit comments

Comments
 (0)