on master help sign in
Correctly parse when .x is an argument
220df1eEvan Czaplicki
src/Parse/Expression.hs+10−10
@@ -270,7 +270,16 @@ data State =
270exprHelp :: R.Position -> State -> ExprParser
270exprHelp :: R.Position -> State -> ExprParser
271exprHelp start (State ops lastExpr end pos) =
271exprHelp start (State ops lastExpr end pos) =
272 oneOf
272 oneOf
273+ [ -- argument
274+ hint E.Arg $
275+ do checkSpace pos
276+ arg <- term
277+ newEnd <- getPosition
278+ newPos <- whitespace
279+ let newLast = A.merge lastExpr arg (Src.App lastExpr arg)
280+ exprHelp start (State ops newLast newEnd newPos)
281+
273− [ -- infix operator
282+ , -- infix operator
274 do checkSpace pos
283 do checkSpace pos
275 opStart <- getPosition
284 opStart <- getPosition
276 opName <- infixOp
285 opName <- infixOp
@@ -312,15 +321,6 @@ exprHelp start (State ops lastExpr end pos) =
312 return ( finalExpr, newEnd, newPos )
321 return ( finalExpr, newEnd, newPos )
313 ]
322 ]
314
323
315− , -- argument
316− hint E.Arg $
317− do checkSpace pos
318− arg <- term
319− newEnd <- getPosition
320− newPos <- whitespace
321− let newLast = A.merge lastExpr arg (Src.App lastExpr arg)
322− exprHelp start (State ops newLast newEnd newPos)
323−
324 , -- done
324 , -- done
325 case ops of
325 case ops of
326 [] ->
326 [] ->