Skip to content

Commit

Permalink
Disallow newlines between fn idn and opening paren
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Jan 22, 2024
1 parent c0dd2c8 commit 9b4a646
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/viper/silver/parser/FastParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,11 @@ class FastParser {

def newExpFields[$: P]: P[Option[Seq[PIdnUse]]] = P(P("*").map(_ => None) | P(idnuse.rep(sep = ","./)).map(Some(_)))

def funcApp[$: P]: P[PCall] = FP(idnuse ~ parens(actualArgList)).map {
case (pos, (func, args)) =>
def funcApp[$: P]: P[PCall] = FP(idnuse ~~ FP(" ".repX(1)).? ~~ parens(actualArgList)).map {
case (pos, (func, Some((space, _)), args)) =>
_warnings = _warnings :+ ParseWarning("Whitespace between a function identifier and the opening paren is deprecated, remove the spaces", SourcePosition(_file, space._1, space._2))
PCall(func, args, None)(pos)
case (pos, (func, None, args)) => PCall(func, args, None)(pos)
}

def maybeTypedFuncApp[$: P](bracketed: Boolean): P[PCall] = P(if (!bracketed) funcApp else FP(funcApp ~~~ (":" ~/ typ).lw.?).map {
Expand Down
7 changes: 7 additions & 0 deletions src/test/resources/all/parsing/assign_ambig.vpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
field f: Bool
method bar(a: Bool, b: Seq[Ref])
requires |b| > 0 && acc(b[0].f)
{
assume a()
(b[..1][0]).f := a
}

0 comments on commit 9b4a646

Please sign in to comment.