Skip to content

OSS-275-Prompt-Generation #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Build And Test JVM Versions
run: |
sbt -v clean cJVM tJVM
sbt -v clean cJVM tJVM checkMimaCompatibility

- name: Build And Test Native Versions
run: |
Expand Down
59 changes: 41 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ Global / onChangedBuildSource := ReloadOnSourceChanges

enablePlugins(OssumIncPlugin)

lazy val startYear: Int = 2019
val mimaBase: String = "1.0.0"
val startYear: Int = 2019

def cpDep(cp: CrossProject): CrossClasspathDependency = cp % "compile->compile;test->test"
def pDep(p: Project): ClasspathDependency = p % "compile->compile;test->test"
def tkDep(cp: CrossProject): CrossClasspathDependency = cp % "compile->compile;test->test"

lazy val riddl: Project = Root("riddl", startYr = startYear, spdx ="Apache-2.0")
lazy val riddl: Project = Root("riddl", startYr = startYear, spdx = "Apache-2.0")
.configure(With.noPublishing, With.git, With.dynver, With.noMiMa)
.settings(concurrentRestrictions += Tags.limit(NativeTags.Link, 1))
.aggregate(
Expand Down Expand Up @@ -59,7 +60,7 @@ lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS, N
)
.jvmConfigure(With.coverage(70))
.jvmConfigure(With.build_info)
.jvmConfigure(With.MiMa("0.57.0", Seq("com.ossuminc.riddl.utils.RiddlBuildInfo")))
.jvmConfigure(With.MiMa(mimaBase, Seq("com.ossuminc.riddl.utils.RiddlBuildInfo")))
.jvmSettings(
buildInfoPackage := "com.ossuminc.riddl.utils",
buildInfoObject := "RiddlBuildInfo",
Expand Down Expand Up @@ -109,12 +110,14 @@ lazy val utils_cp: CrossProject = CrossModule("utils", "riddl-utils")(JVM, JS, N
Dep.scalactic_nojvm.value
)
)
.nativeConfigure(With.Native(
linkOptions = Seq(
"-I/usr/include",
"-I/usr/local/opt/curl/include",
"-I/opt/homebrew/opt/curl/include"
))
.nativeConfigure(
With.Native(
linkOptions = Seq(
"-I/usr/include",
"-I/usr/local/opt/curl/include",
"-I/opt/homebrew/opt/curl/include"
)
)
)
.nativeConfigure(
With.BuildInfo.withKeys(
Expand Down Expand Up @@ -147,7 +150,7 @@ lazy val language_cp: CrossProject = CrossModule("language", "riddl-language")(J
Test / parallelExecution := false
)
.jvmConfigure(With.coverage(65))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jvmSettings(
tastyMiMaConfig ~= { prevConfig =>
import java.util.Arrays.asList
Expand Down Expand Up @@ -213,7 +216,7 @@ lazy val passes_cp = CrossModule("passes", "riddl-passes")(JVM, JS, Native)
description := "AST Pass infrastructure and essential passes"
)
.jvmConfigure(With.coverage(30))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jvmSettings(
coverageExcludedPackages := "<empty>;$anon",
mimaBinaryIssueFilters ++= Seq(
Expand Down Expand Up @@ -254,7 +257,7 @@ lazy val testkit_cp = CrossModule("testkit", "riddl-testkit")(JVM, JS, Native)
Dep.scalactic_nojvm.value
)
)
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jsConfigure(With.Javascript("RIDDL: language", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
.jsSettings(
Expand Down Expand Up @@ -285,7 +288,7 @@ lazy val diagrams_cp: CrossProject = CrossModule("diagrams", "riddl-diagrams")(J
description := "Implementation of various AST diagrams passes other libraries may use"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jvmSettings(coverageExcludedFiles := """<empty>;$anon""")
.jsConfigure(With.Javascript("RIDDL: diagrams", withCommonJSModule = true))
.jsConfigure(With.noMiMa)
Expand All @@ -300,14 +303,15 @@ lazy val riddlLib_cp: CrossProject = CrossModule("riddlLib", "riddl-lib")(JS, JV
cpDep(utils_cp),
cpDep(language_cp),
cpDep(passes_cp),
cpDep(diagrams_cp)
cpDep(diagrams_cp),
cpDep(testkit_cp)
)
.configure(With.typical, With.GithubPublishing)
.settings(
description := "Bundling of essential RIDDL libraries"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jvmConfigure(
With.Packaging.universal(
maintainerEmail = "reid@ossuminc.com",
Expand All @@ -329,14 +333,20 @@ val riddlLibNative = riddlLib_cp.native

val Commands = config("commands")
lazy val commands_cp: CrossProject = CrossModule("commands", "riddl-commands")(JVM, Native)
.dependsOn(cpDep(utils_cp), cpDep(language_cp), cpDep(passes_cp), cpDep(diagrams_cp))
.dependsOn(
cpDep(utils_cp),
cpDep(language_cp),
cpDep(passes_cp),
cpDep(diagrams_cp),
cpDep(riddlLib_cp)
)
.configure(With.typical, With.GithubPublishing)
.settings(
scalacOptions ++= Seq("-explain", "--explain-types", "--explain-cyclic", "--no-warnings"),
description := "RIDDL Command Infrastructure and command definitions"
)
.jvmConfigure(With.coverage(50))
.jvmConfigure(With.MiMa("0.57.0"))
.jvmConfigure(With.MiMa(mimaBase))
.jvmSettings(
libraryDependencies ++= Seq(Dep.scopt, Dep.sconfig, Dep.scalajs_stubs),
coverageExcludedFiles := """<empty>;$anon"""
Expand Down Expand Up @@ -415,7 +425,8 @@ lazy val docsite = DocSite(
libraryDependencies ++= Dep.testing
)

lazy val plugin = OssumIncPlugin.autoImport.Plugin("sbt-riddl")
lazy val plugin = OssumIncPlugin.autoImport
.Plugin("sbt-riddl")
.configure(With.scala2, With.build_info, With.noMiMa, With.GithubPublishing)
.settings(
description := "An sbt plugin to embellish a project with riddlc usage",
Expand Down Expand Up @@ -465,3 +476,15 @@ addCommandAlias(
"; riddlLibNative/nativeLink" +
"; riddlLib/Universal/packageBin"
)
addCommandAlias(
"checkMimaCompatibility",
"; utils/mimaFindBinaryIssues ; language/mimaFindBinaryIssues ; passes/mimaFindBinaryIssues; " +
"testkit/mimaFindBinaryIssues ; diagrams/mimaFindBinaryIssues ; commands/mimaFindBinaryIssues ;" +
"riddlLib/mimaFindBinaryIssues"
)
addCommandAlias(
"checkTastyCompatibility",
"; utils/tastyMiMaReportIssues ; language/tastyMiMaReportIssues ; passes/tastyMiMaReportIssues; " +
"testkit/tastyMiMaReportIssues ; diagrams/tastyMiMaReportIssues ; " +
"commands/tastyMiMaReportIssues ; riddlLib/tastyMiMaReportIssues"
)
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ trait Readability {

def wants[u: P]: P[Unit] = readable("wants")

def `with`[u: P]: P[Unit] = readable("with")

def anyReadability[u: P]: P[Unit] = {
P(
Keywords.keywords(
Expand All @@ -61,8 +59,7 @@ trait Readability {
ReadabilityWords.so,
ReadabilityWords.that,
ReadabilityWords.to,
ReadabilityWords.wants,
ReadabilityWords.with_
ReadabilityWords.wants
)
)
)
Expand All @@ -84,7 +81,6 @@ object ReadabilityWords {
final val that = "that"
final val to = "to"
final val wants = "wants"
final val with_ = "with"

// NOTE: Keep this list in synch with the list in TokenParser
def allReadability: Seq[String] = Seq(
Expand All @@ -101,7 +97,6 @@ object ReadabilityWords {
so,
that,
to,
wants,
with_
wants
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import com.ossuminc.riddl.language.At
import fastparse.*
import fastparse.MultiLineWhitespace.*

/** StatementParser Define actions that various constructs can take for modelling behavior in a message-passing system
/** StatementParser Define actions that various constructs can take for modelling behavior in a
* message-passing system
*/
private[parsing] trait StatementParser {
this: ReferenceParser & CommonParser =>

private def arbitraryStatement[u: P]: P[ArbitraryStatement] = {
P(Index ~ literalString ~/ Index)./ map { case (start, str, end) => ArbitraryStatement(at(start, end), str) }
P(Index ~ literalString ~/ Index)./ map { case (start, str, end) =>
ArbitraryStatement(at(start, end), str)
}
}

private def errorStatement[u: P]: P[ErrorStatement] = {
Expand All @@ -35,7 +38,9 @@ private[parsing] trait StatementParser {
private def sendStatement[u: P]: P[SendStatement] = {
P(
Index ~ Keywords.send ~/ messageRef ~/ to ~ (outletRef | inletRef) ~/ Index
).map { case (start, messageRef, portlet, end) => SendStatement(at(start, end), messageRef, portlet) }
).map { case (start, messageRef, portlet, end) =>
SendStatement(at(start, end), messageRef, portlet)
}
}

private def tellStatement[u: P]: P[TellStatement] = {
Expand Down Expand Up @@ -97,8 +102,11 @@ private[parsing] trait StatementParser {

private def morphStatement[u: P]: P[MorphStatement] = {
P(
Index ~ Keywords.morph ~/ entityRef ~/ to ~ stateRef ~/ `with` ~ messageRef ~/ Index
)./.map { case (start, eRef, sRef, mRef, end) => MorphStatement(at(start, end), eRef, sRef, mRef) }
Index ~ Keywords.morph ~/ entityRef ~/ to ~ stateRef ~/ Keyword.with_ ~ messageRef ~/
Index
)./.map { case (start, eRef, sRef, mRef, end) =>
MorphStatement(at(start, end), eRef, sRef, mRef)
}
}

private def becomeStatement[u: P]: P[BecomeStatement] = {
Expand All @@ -114,8 +122,9 @@ private[parsing] trait StatementParser {
}

private def replyStatement[u: P]: P[ReplyStatement] = {
P(Index ~ Keywords.reply ~/ `with`.?./ ~ messageRef ~~ Index).map { case (start, ref, end) =>
ReplyStatement(at(start, end), ref)
P(Index ~ Keywords.reply ~/ Keyword.with_.?./ ~ messageRef ~~ Index).map {
case (start, ref, end) =>
ReplyStatement(at(start, end), ref)
}
}

Expand All @@ -136,7 +145,17 @@ private[parsing] trait StatementParser {

private def writeStatement[u: P]: P[WriteStatement] = {
P(
Index ~ StringIn("write", "put", "create", "update", "delete", "remove", "append", "insert", "modify").! ~
Index ~ StringIn(
"write",
"put",
"create",
"update",
"delete",
"remove",
"append",
"insert",
"modify"
).! ~
literalString ~ to ~ typeRef ~ Index
).map { case (start, keyword, what, to, end) =>
WriteStatement(at(start, end), keyword, what, to)
Expand All @@ -163,8 +182,9 @@ private[parsing] trait StatementParser {

def statement[u: P](set: StatementsSet): P[Statements] = {
set match {
case StatementsSet.AdaptorStatements => anyDefStatements(set) | replyStatement
case StatementsSet.ContextStatements => anyDefStatements(set) | replyStatement | focusStatement
case StatementsSet.AdaptorStatements => anyDefStatements(set) | replyStatement
case StatementsSet.ContextStatements =>
anyDefStatements(set) | replyStatement | focusStatement
case StatementsSet.EntityStatements =>
anyDefStatements(set) | morphStatement | becomeStatement | replyStatement
case StatementsSet.FunctionStatements => anyDefStatements(set) | returnStatement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class KeywordsTest extends AbstractTestingBasis {

"Punctuation" should {
"produce all punctuation marks" in {
Punctuation.allPunctuation.size must be (17)
Punctuation.allPunctuation.size must be(17)
}
}

"Readability" should {
"produce all readability words" in {
ReadabilityWords.allReadability.size must be(15)
ReadabilityWords.allReadability.size must be(14)
}
}
}
13 changes: 4 additions & 9 deletions passes/input/rbbq.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,11 @@ domain ReactiveBBQ is {
handler Input is { ??? }
} with {
option is kind("device")
briefly "A device for viewing Orders"
explained as {
|# brief
|This is an OrderViewer
|# details
|The OrderViewer is the device in the kitchen, probably a touch screen,
|that the cooks use to view the sequence of orders to cook
|# see
|* http://foo.com/
|that the cooks use to view the sequence of orders to cook and the items
|for that order.
}
}
} with {
Expand Down Expand Up @@ -161,10 +158,8 @@ domain ReactiveBBQ is {
}
}
} with {
briefly "Reactive BBQ Domain Definition"
explained as {
|# brief
| Reactive BBQ Domain Definition
|#details
|This domain definition is designed to be instructive in the RIDDL language.
|It uses the case study from the Lightbend Reactive Architecture course as
|the basis for defining the domain. The course uses a set of interviews with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class JVMAbstractValidatingTest extends AbstractValidatingTest {
val future = RiddlParserInput.fromURL(url).map { rpi =>
TopLevelParser.parseInput(rpi) match
case Left(errors) =>
val msgs = errors.format
val msgs = errors.justErrors.format
fail(s"In $label:\n$msgs")
case Right(root) =>
runStandardPasses(root, shouldFailOnErrors) match {
case Left(errors) =>
fail(errors.justErrors.format)
fail(s"In $label:\n${errors.justErrors.format}")
case Right(pr) =>
validation(root, pr)
}
Expand Down Expand Up @@ -79,15 +79,17 @@ class JVMAbstractValidatingTest extends AbstractValidatingTest {
def validateFile(
label: String,
fileName: String
)(validation: (PassRoot, Messages) => Assertion = (_, msgs) => fail(msgs.format)): Assertion = {
)(
validation: (PassesResult, Messages) => Assertion = (_, msgs) => fail(msgs.format)
): Assertion = {
val url = URL.fromCwdPath(passesTestCase + fileName)
val future = RiddlParserInput.fromURL(url).map { rpi =>
simpleParseAndValidate(rpi) match {
case Left(errors: Messages) =>
val msgs = errors.format
fail(s"In $label:\n$msgs")
case Right(result) =>
validation(result.root, result.messages)
validation(result, result.messages)
}
}
Await.result(future, 10.seconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package com.ossuminc.riddl.passes

import com.ossuminc.riddl
import com.ossuminc.riddl.language.AST.{Branch, Root, Token}
import com.ossuminc.riddl.language.AST.{Branch, PathIdentifier, Root, Token}
import com.ossuminc.riddl.language.Messages.*
import com.ossuminc.riddl.language.parsing.{RiddlParserInput, TopLevelParser}
import com.ossuminc.riddl.passes.*
Expand Down Expand Up @@ -101,8 +101,7 @@ object Riddl {
/** Convert a previously parsed Root to Tokens and corresponding string text */
def mapTextAndToken[T](
root: Branch[?]
)(f: (IndexedSeqView[Char],Token) => T)
(using pc: PlatformContext): Either[Messages, List[T]] =
)(f: (IndexedSeqView[Char], Token) => T)(using pc: PlatformContext): Either[Messages, List[T]] =
val text = toRiddlText(root)
val rpi = RiddlParserInput(text, "")
TopLevelParser.mapTextAndToken[T](rpi)(f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ case class SymbolsOutput(
/** Get all parents of a definition
*
* @param definition
* The defintiion whose parents are to be sought.
* The definition whose parents are to be sought.
* @return
* the sequence of ParentDefOf parents or empty if none.
*/
Expand Down
Loading
Loading