summaryrefslogtreecommitdiff
path: root/compiler/parser/Lexer.x
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-01 20:03:54 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-02 13:45:16 +0300
commitf5fbe75ec2f85fabe34acea12d82ab8c7d66969e (patch)
treecc8c966c3bb1b514507a8bf2bc211dd46393f3b1 /compiler/parser/Lexer.x
parent04e65d289405563dc0f055973d689a2551bbbdbb (diff)
downloadhaskell-wip/exp-cmd-frame.tar.gz
WIP: ECFramewip/exp-cmd-frame
Diffstat (limited to 'compiler/parser/Lexer.x')
-rw-r--r--compiler/parser/Lexer.x13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x
index c4d0d4d127..0606c56297 100644
--- a/compiler/parser/Lexer.x
+++ b/compiler/parser/Lexer.x
@@ -57,7 +57,7 @@ module Lexer (
activeContext, nextIsEOF,
getLexState, popLexState, pushLexState,
ExtBits(..), getBit,
- addWarning,
+ addWarning, addError,
lexTokenStream,
addAnnotation,AddAnn,addAnnsAt,mkParensApiAnn,
commentToAnnotation
@@ -2479,6 +2479,17 @@ mkPStatePure options buf loc =
annotations_comments = []
}
+addError :: SrcSpan -> SDoc -> P ()
+addError srcspan msg
+ = P $ \s@PState{messages=m} ->
+ let
+ m' d =
+ let (ws, es) = m d
+ errormsg = mkErrMsg d srcspan alwaysQualify msg
+ es' = es `snocBag` errormsg
+ in (ws, es')
+ in POk s{messages=m'} ()
+
addWarning :: WarningFlag -> SrcSpan -> SDoc -> P ()
addWarning option srcspan warning
= P $ \s@PState{messages=m, options=o} ->