summary refs log tree commit diff stats
path: root/compiler/msgs.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/msgs.nim')
-rw-r--r--compiler/msgs.nim10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 944446624..7f4f81dd0 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -450,7 +450,7 @@ type
     projPath*: string          # This is relative to the project's root
     shortName*: string         # short name of the module
     quotedName*: PRope         # cached quoted short name for codegen
-                               # purpoes
+                               # purposes
     
     lines*: seq[PRope]         # the source code of the module
                                #   used for better error messages and
@@ -789,6 +789,14 @@ proc writeSurroundingSrc(info: TLineInfo) =
   msgWriteln(indent & info.sourceLine.ropeToStr)
   msgWriteln(indent & repeatChar(info.col, ' ') & '^')
 
+proc formatMsg*(info: TLineInfo, msg: TMsgKind, arg: string): string =
+  let frmt = case msg
+             of warnMin..warnMax: PosWarningFormat
+             of hintMin..hintMax: PosHintFormat
+             else: PosErrorFormat
+  result = frmt % [toMsgFilename(info), coordToStr(info.line),
+                   coordToStr(info.col), getMessageStr(msg, arg)]
+
 proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, 
                eh: TErrorHandling) =
   var frmt: string