@@ -128,7 +128,9 @@ static ast* parseAtom (parserCtx* ctx) {
128128
129129static bool waiting_for_delim (parserCtx * ctx ) {
130130 bool seeLowPrecOp = see_kind (ctx , tokenOp )
131- && !(see (ctx , "(" ) || see (ctx , "[" ));
131+ && !see (ctx , "(" )
132+ && !see (ctx , "[" )
133+ && !see (ctx , "!" );
132134
133135 return waiting (ctx ) && !seeLowPrecOp ;
134136}
@@ -147,37 +149,39 @@ static ast* parseFnApp (parserCtx* ctx) {
147149 vector (ast * ) nodes = vectorInit (3 , malloc );
148150
149151 /*Require at least one expr*/
150- if (!see (ctx , "` " ))
152+ if (!see (ctx , "! " ))
151153 vectorPush (& nodes , parseAtom (ctx ));
152154
153155 while (waiting_for_delim (ctx )) {
154- if (try_match (ctx , "` " )) {
156+ if (try_match (ctx , "! " )) {
155157 if (fn ) {
156- error (ctx )("Multiple explicit functions in backticks : '%s'\n" , ctx -> current .buffer );
158+ error (ctx )("Multiple explicit functions: '%s'\n" , ctx -> current .buffer );
157159 vectorPush (& nodes , fn );
158160 }
159161
160162 fn = parseAtom (ctx );
161- match (ctx , "`" );
162163
163164 } else
164165 vectorPush (& nodes , parseAtom (ctx ));
165166 }
166167
167- if (nodes .length == 1 ) {
168+ if (fn )
169+ return astCreateFnApp (nodes , fn );
170+
171+ else if (nodes .length == 0 ) {
172+ /*Shouldn't happen due to the way it parses*/
173+ errprintf ("FnApp took no AST nodes" );
174+ return astCreateInvalid ();
175+
176+ } else if (nodes .length == 1 ) {
177+ /*No application*/
168178 ast * node = vectorPop (& nodes );
169179 vectorFree (& nodes );
170180 return node ;
171181
172- } else if (nodes .length == 0 && fn ) {
173- error (ctx )("No arguments provided to backtick-marked function" );
174- return fn ;
175-
176182 } else {
177- /*If not explicitly marked in backticks, the last expr was the fn*/
178- if (!fn )
179- fn = vectorPop (& nodes );
180-
183+ /*The last node is the fn*/
184+ fn = vectorPop (& nodes );
181185 return astCreateFnApp (nodes , fn );
182186 }
183187}
0 commit comments