Skip to content

Commit a9b15b0

Browse files
committed
Accept classes with no argument.
1 parent 56466d1 commit a9b15b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/functions.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ named_args!(classdef(indent: usize, decorators: Vec<Decorator>) <StrSpan, Compou
7272
tag!("class") >>
7373
space_sep2 >>
7474
name: name >>
75-
arguments: ws2!(delimited!(char!('('), ws4!(call!(ExpressionParser::<NewlinesAreSpaces>::arglist)), char!(')'))) >>
75+
spaces >>
76+
arguments: opt!(ws2!(delimited!(char!('('), ws4!(call!(ExpressionParser::<NewlinesAreSpaces>::arglist)), char!(')')))) >>
7677
ws2!(char!(':')) >>
7778
code: call!(block, indent) >> (
7879
CompoundStatement::Classdef(Classdef {
79-
decorators, name, arguments, code
80+
decorators, name, arguments: arguments.unwrap_or_default(), code
8081
})
8182
)
8283
)

0 commit comments

Comments
 (0)