Skip to content

Commit

Permalink
Add the stop statement
Browse files Browse the repository at this point in the history
Signed-off-by: reidspencer <reid.spencer@yoppworks.com>
  • Loading branch information
reid-spencer committed Sep 15, 2023
1 parent 0fd2643 commit 0908f7b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,12 @@ trait Statements {
(if elses.nonEmpty then " else {\n" + elses.map(_.format).mkString(" ", "\n ", "\n}\n")
else "\n")}"
}

case class StopStatement(
loc: At,
) extends Statement {
override def kind: String = "Stop Statement"
def format: String = "scall ${func.format}"

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ private[parsing] trait StatementParser {
P(location ~ Keywords.call ~/ functionRef)./.map { tpl => (CallStatement.apply _).tupled(tpl) }
}

private def stopStatement[u: P]: P[StopStatement] = {
P(
location ~ Keywords.stop
)./.map { (loc: At) => StopStatement(loc) }
}

private def anyDefStatements[u: P](set: StatementsSet): P[Statement] = {
P(
sendStatement | arbitraryStatement | errorStatement | setStatement | tellStatement | callStatement |
ifThenElseStatement(set) | forEachStatement(set)
stopStatement | ifThenElseStatement(set) | forEachStatement(set)
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ object Terminals {

object Keywords {
final val acquires = "acquires"
final val user = "user"
final val adaptor = "adaptor"
final val all = "all"
final val any = "any"
Expand Down Expand Up @@ -192,6 +191,7 @@ object Terminals {
final val split = "split"
final val state = "state"
final val step = "step"
final val stop = "stop"
final val story = "story"
final val streamlet = "streamlet"
final val tell = "tell"
Expand All @@ -202,6 +202,7 @@ object Terminals {
final val true_ = "true"
final val `type` = "type"
final val url = "url"
final val user = "user"
final val value = "value"
final val view = "view"
final val void = "void"
Expand Down

0 comments on commit 0908f7b

Please sign in to comment.