diff options
Diffstat (limited to 'frontend/scanner.icl')
-rw-r--r-- | frontend/scanner.icl | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/frontend/scanner.icl b/frontend/scanner.icl index a5df19b..7983ab3 100644 --- a/frontend/scanner.icl +++ b/frontend/scanner.icl @@ -1253,8 +1253,7 @@ ReadNormalChar {inp_stream = OldLine i line stream,inp_pos,inp_tabsize,inp_filen ) = ReadNormalChar {inp_filename=inp_filename,inp_tabsize=inp_tabsize,inp_pos=inp_pos,inp_stream = stream} ReadNormalChar {inp_stream = InFile file, inp_pos, inp_tabsize, inp_filename} -// MW8 was: #! (s, file) = freadline file - #! (s, file) = (SwitchPreprocessor freadPreprocessedLine freadline) file + #! (s, file) = freadline file | size s==0 # c = NewLineChar // pos = NextPos c inp_pos inp_tabsize @@ -1296,8 +1295,7 @@ ReadChar {inp_stream = OldLine i line stream,inp_pos,inp_tabsize,inp_filename} inp_stream = stream} //ReadChar input=:{inp_stream = InFile file, inp_pos, inp_tabsize} ReadChar {inp_stream = InFile file, inp_pos, inp_tabsize, inp_filename} -// MW8 was: #! (s, file) = freadline file - #! (s, file) = (SwitchPreprocessor freadPreprocessedLine freadline) file + #! (s, file) = freadline file | size s==0 # c = NewLineChar pos = NextPos c inp_pos inp_tabsize @@ -1326,8 +1324,7 @@ ReadLine input=:{inp_stream = OldLine i line oldfile, inp_pos} ReadLine input=:{inp_stream = InFile infile,inp_pos} # (eof, file) = fend infile | eof = ("", {input & inp_stream = InFile file}) -//MW8 was # (l, file ) = freadline file - # (l, file ) = (SwitchPreprocessor freadPreprocessedLine freadline) file + # (l, file ) = freadline file = (l, {input & inp_stream = InFile file, inp_pos = NextPos CRChar inp_pos 0}) ReadLine input = ("", input) @@ -1836,39 +1833,3 @@ where (-->>) val _ :== val //(-->>) val message :== val ---> ("Scanner",message) - -// MW8.. - //--------------------// - //--- Preprocessor ---// -//--------------------// - -freadPreprocessedLine :: !*File -> (!.{#Char},!*File) -freadPreprocessedLine file - #! (line, file) = freadline file - | begins_with "/*2.0" line - = (replace_beginning_with "/***/" line, file) - | begins_with "0.2*/" line - = (replace_beginning_with "/***/" line, file) - | begins_with "//1.3" line - = (replace_beginning_with "/*1.3" line, file) - | begins_with "//3.1" line - = (replace_beginning_with "3.1*/" line, file) - = (line, file) - where - begins_with :: !String !String -> Bool - begins_with pattern line - # size_pattern = size pattern - | size line<size_pattern - = False - = loop pattern line (size_pattern-1) - loop :: !String !String !Int -> Bool - loop pattern line i - | i<0 - = True - | line.[i]<>pattern.[i] - = False - = loop pattern line (i-1) - replace_beginning_with :: !String !*String -> .String - replace_beginning_with replacement string - = { string & [i] = replacement.[i] \\ i<-[0..size replacement-1] } -// ..MW8 |