From fcb72f5c5448a7d2105cb16a4e7d67a4f7299633 Mon Sep 17 00:00:00 2001 From: johnvg Date: Thu, 4 Apr 2013 13:08:37 +0000 Subject: add type StringPos (from iTask branch) git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2223 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- frontend/checksupport.icl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'frontend/checksupport.icl') diff --git a/frontend/checksupport.icl b/frontend/checksupport.icl index 4a439d7..5ae31d2 100644 --- a/frontend/checksupport.icl +++ b/frontend/checksupport.icl @@ -56,6 +56,16 @@ newPosition id (PreDefPos file_name) newPosition id NoPos = { ip_ident = id, ip_line = cNotALineNumber, ip_file = "???" } +stringPosition :: !String !Position -> StringPos +stringPosition id (FunPos file_name line_nr _) + = { sp_name = id, sp_line = line_nr, sp_file = file_name } +stringPosition id (LinePos file_name line_nr) + = { sp_name = id, sp_line = line_nr, sp_file = file_name } +stringPosition id (PreDefPos file_name) + = { sp_name = id, sp_line = cNotALineNumber, sp_file = file_name.id_name } +stringPosition id NoPos + = { sp_name = id, sp_line = cNotALineNumber, sp_file = "???" } + checkError :: !a !b !*ErrorAdmin -> *ErrorAdmin | <<< a & <<< b // PK checkError id mess error=:{ea_file,ea_loc=[]} = { error & ea_file = ea_file <<< "Error " <<< " " <<< id <<< " " <<< mess <<< '\n', ea_ok = False } @@ -504,6 +514,12 @@ where = file <<< '[' <<< ip_file <<< ',' <<< ip_ident <<< ']' = file <<< '[' <<< ip_file <<< ',' <<< ip_line <<< ',' <<< ip_ident <<< ']' +instance <<< StringPos where + (<<<) file {sp_file,sp_line,sp_name} + | sp_line == cNotALineNumber + = file <<< '[' <<< sp_file <<< ',' <<< sp_name <<< ']' + = file <<< '[' <<< sp_file <<< ',' <<< sp_line <<< ',' <<< sp_name <<< ']' + instance <<< ExplImpInfo where (<<<) file (ExplImpInfo eii_ident eii_declaring_modules) -- cgit v1.2.3