-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: Mostly working * WIP: Implement NebulaParser * Can't test because no internet connection * Everything compiles --------- Signed-off-by: Reid Spencer <reid-spencer@users.noreply.github.com>
- Loading branch information
1 parent
18674ba
commit 4eeb698
Showing
19 changed files
with
208 additions
and
64 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
language/jvm/src/test/scala/com/ossuminc/riddl/language/parsing/NebulaTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.ossuminc.riddl.language.parsing | ||
|
||
import org.scalatest.TestData | ||
|
||
class NebulaTest extends ParsingTest { | ||
|
||
"Module" should { | ||
"be accepted at root scope" in { (td: TestData) => | ||
val input = RiddlParserInput( | ||
""" | ||
|nebula is { | ||
| domain blah is { ??? } | ||
|} | ||
|""".stripMargin, td | ||
) | ||
parseNebula(input) match | ||
case Left(messages) => fail(messages.justErrors.format) | ||
case Right(root) => succeed | ||
} | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
language/shared/src/main/scala/com/ossuminc/riddl/language/parsing/NebulaParser.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.ossuminc.riddl.language.parsing | ||
|
||
import com.ossuminc.riddl.language.AST.* | ||
import fastparse.* | ||
import fastparse.MultiLineWhitespace.* | ||
|
||
/** Parsing production rules for Modules | ||
* {{{ | ||
* Root = Comment | Domain | Module | Author | ||
* Module = Root | Context | User | Epic | Author | Application | Saga | ||
* Domain = VitalDefinition | Domain | Context | User | Epic | Author | Application | Saga | ||
* }}} | ||
*/ | ||
private[parsing] trait NebulaParser { | ||
this: ProcessorParser & DomainParser & AdaptorParser & ApplicationParser & ContextParser & EntityParser & | ||
EpicParser & FunctionParser & HandlerParser & ModuleParser & ProjectorParser & RepositoryParser & | ||
RootParser & SagaParser & StreamingParser & TypeParser & Readability & CommonParser => | ||
|
||
private def nebulaContent[u:P]: P[NebulaContents] = | ||
P(adaptor | application | author | connector | constant | containedGroup | context | domain | | ||
entity | enumerator | epic | field | function | group | handler(StatementsSet.AllStatements) | | ||
inlet | appInput | invariant | method | module | onClause(StatementsSet.AllStatements) | outlet | appOutput | | ||
projector | relationship | repository | root | saga | sagaStep | schema | state | streamlet | term | typeDef | | ||
useCase | user).map { (r: RiddlValue) => r.asInstanceOf[NebulaContents] } | ||
|
||
private def nebulaContents[u:P]: P[Seq[NebulaContents]] = | ||
P(nebulaContent).rep(0) | ||
|
||
def nebula[u: P]: P[Nebula] = { | ||
P(Start ~ Keywords.nebula ~ is ~ open ~ nebulaContents ~ close ~ End).map { | ||
(contents: Seq[NebulaContents]) => Nebula(contents.toContents) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.