mirror of
https://github.com/fluencelabs/aqua.git
synced 2025-06-25 04:21:35 +00:00
Module and Use expressions (#245)
* Module and Use expressions * UseFromExpr * ImportFromExpr * PubExpr * Export, declares * Collecting all the needed info WIP * Got all the needed data * Tests fixed * HeaderSem * HeaderSem wip * Everything except `export`/`declares` should be working * Compile bug fixed * Fix readme: cli/assembly * Handle declares, exports * Compile only exports in AquaRes * Call services imported from modules * Import consts, types, services from modules * Resolve arrows from modules * Bugfix
This commit is contained in:
@ -5,7 +5,7 @@ import aqua.files.FileModuleId
|
||||
import aqua.io.AquaFileError
|
||||
import aqua.parser.lift.FileSpan
|
||||
import aqua.parser.{BlockIndentError, FuncReturnError, LexerError}
|
||||
import aqua.semantics.{RulesViolated, WrongAST}
|
||||
import aqua.semantics.{HeaderError, RulesViolated, WrongAST}
|
||||
import cats.Show
|
||||
|
||||
object ErrorRendering {
|
||||
@ -61,6 +61,11 @@ object ErrorRendering {
|
||||
.focus(2)
|
||||
.map(_.toConsoleStr(message, Console.CYAN))
|
||||
.getOrElse("(Dup error, but offset is beyond the script)") + "\n"
|
||||
case HeaderError(token, message) =>
|
||||
token.unit._1
|
||||
.focus(2)
|
||||
.map(_.toConsoleStr(message, Console.CYAN))
|
||||
.getOrElse("(Dup error, but offset is beyond the script)") + "\n"
|
||||
case WrongAST(ast) =>
|
||||
s"Semantic error"
|
||||
|
||||
|
@ -1,11 +1,18 @@
|
||||
package aqua.files
|
||||
|
||||
import fs2.io.file.Path
|
||||
import cats.Order
|
||||
|
||||
case class FileModuleId private (file: Path)
|
||||
|
||||
object FileModuleId {
|
||||
|
||||
implicit object FileModuleIdOrder extends Order[FileModuleId] {
|
||||
|
||||
override def compare(x: FileModuleId, y: FileModuleId): Int =
|
||||
x.file.toString.compareTo(y.file.toString)
|
||||
}
|
||||
|
||||
def apply(file: Path): FileModuleId =
|
||||
new FileModuleId(file.absolute.normalize)
|
||||
}
|
||||
|
Reference in New Issue
Block a user