Skip to content

Commit

Permalink
Report parse error location (#71)
Browse files Browse the repository at this point in the history
* Added missing module declarations. #37

* Process only those modules that are reachable from exposed ones. Remove package path from module names. #21

* Renaming concepts based on review feedback. #41

* Moved Advanced module up a level. #43

* Removed unused unindent function.

* Moved name to SDK.

* Added missing module to SDK.

* Partial implementation of value mapping.

* Ignore all generated JS.

* Change extra arg position and naming. #46, #25

* Change extra arg position and naming. #46, #25

* Removed remaining references to extra. #5

* Change extra arg position. #46, #25, #5

* Added more coverage. #46, #25, #5

* Changes suggested in the PR. #46, #25, #5

* Use more explicit names.

* All patterns supported.

* Pattern-match supported.

* Added support for SDK operators. #52

* Fix compile errors.

* Prepare Elm module publishing. #2

* Fix repo name. #2

* Support for let expressions. #54

* Simple join implementations. #64

* Refactoring to make the code more organized.

* Refactoring to make the code more organized.

* Prepare value mapping utils. #53

* More descriptive naming.

* More descriptive naming.

* Removed unused function

* Better naming

* Added utility function and removed unused one.

* Added variable resolution.

* Hooked up variable resolution and updated tests. #53

* Completed reference resolution. #53

* Added missing docs and refactored. #68

* Document and refactor driven by the goal to process Morphir using Morphir. #68

* Various fixes. #68

* Report parse errors.
  • Loading branch information
AttilaMihaly authored Apr 28, 2020
1 parent 1cfad11 commit b29d1ea
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Morphir/Elm/Frontend.elm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import Morphir.IR.Value as Value exposing (Value)
import Morphir.JsonExtra as JsonExtra
import Morphir.ListOfResults as ListOfResults
import Morphir.Rewrite as Rewrite
import Parser
import Parser exposing (DeadEnd)
import Set exposing (Set)


Expand Down Expand Up @@ -148,11 +148,22 @@ type Error
| VariableShadowing Name SourceLocation SourceLocation


encodeDeadEnd : DeadEnd -> Encode.Value
encodeDeadEnd deadEnd =
Encode.list identity
[ Encode.int deadEnd.row
, Encode.int deadEnd.col
]


encodeError : Error -> Encode.Value
encodeError error =
case error of
ParseError _ _ ->
JsonExtra.encodeConstructor "ParseError" []
ParseError sourcePath deadEnds ->
JsonExtra.encodeConstructor "ParseError"
[ Encode.string sourcePath
, Encode.list encodeDeadEnd deadEnds
]

CyclicModules _ ->
JsonExtra.encodeConstructor "CyclicModules" []
Expand Down

0 comments on commit b29d1ea

Please sign in to comment.