-
Notifications
You must be signed in to change notification settings - Fork 44
kore-parser: Print human-readable parse errors #2243
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
Changes from all commits
5f1c466
4197137
6e316ac
7d32a6f
583fa01
2167a30
1be1cf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{- | | ||
Copyright : (c) Runtime Verification, 2020 | ||
License : NCSA | ||
|
||
-} | ||
|
||
module Kore.Log.ErrorVerify | ||
( ErrorVerify (..) | ||
, errorVerify | ||
) where | ||
|
||
import Prelude.Kore | ||
|
||
import Control.Monad.Catch | ||
( Exception (..) | ||
, MonadThrow | ||
, throwM | ||
) | ||
import Pretty | ||
|
||
import Kore.ASTVerifier.Error | ||
( VerifyError | ||
) | ||
import qualified Kore.Error as Kore | ||
import Log | ||
|
||
newtype ErrorVerify = ErrorVerify { koreError :: Kore.Error VerifyError } | ||
deriving Show | ||
|
||
instance Exception ErrorVerify where | ||
toException = toException . SomeEntry | ||
fromException exn = fromException exn >>= fromEntry | ||
displayException = Kore.printError . koreError | ||
|
||
instance Pretty ErrorVerify where | ||
pretty ErrorVerify { koreError } = | ||
Pretty.pretty (Kore.printError koreError) | ||
|
||
instance Entry ErrorVerify where | ||
entrySeverity _ = Error | ||
|
||
errorVerify :: MonadThrow log => Kore.Error VerifyError -> log a | ||
errorVerify koreError = | ||
throwM ErrorVerify { koreError } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ifeq ($(origin TOP), undefined) | ||
TOP = $(shell git rev-parse --show-toplevel) | ||
endif | ||
|
||
include $(TOP)/include.mk | ||
|
||
DIFF = diff -u | ||
%.golden: DIFF = true | ||
|
||
FAILED = ( mv $@ [email protected] && false ) | ||
|
||
TESTS = $(wildcard *.kore) | ||
OUTS += $(foreach TEST, $(TESTS), $(TEST).out) | ||
GOLDEN += $(foreach TEST, $(TESTS), $(TEST).golden) | ||
|
||
%.kore.out : %.kore $(KORE_PARSER) | ||
$(KORE_PARSER) --no-print-definition $< 2>$@ || true | ||
$(DIFF) $*.kore.golden $@ || $(FAILED) | ||
|
||
%.golden: %.out | ||
cp $< $@ | ||
|
||
### TARGETS | ||
|
||
test: test-k | ||
|
||
test-k: $(OUTS) | ||
|
||
golden: $(GOLDEN) | ||
|
||
clean: | ||
rm -fr *.out *.fail | ||
|
||
.PHONY: test-k test golden clean |
Uh oh!
There was an error while loading. Please reload this page.