freepascal - Ignoring comment in Pascal -


i have made following program:

program test;  uses crt;  var   input: text;   line: string;   charcount: integer;  procedure findidentifiers(line: string); var   word: string;   wordfound: boolean;   numberfound: boolean;  begin   word := '';   wordfound := false;   numberfound := false;   charcount := 1 length(line)   begin     if line[charcount] in [' ', '.', ',', '+', '-', '''', '*', '=', '!', '?',       ':', ';', '(', ')', '/', '\', '[', ']', '^', '>', '<']     begin       if wordfound       begin         if not numberfound         begin              writeln(word);             end;         wordfound := false;         numberfound := false;         word := '';       end;     end     else     begin       if not wordfound       begin         if line[charcount] in ['0' .. '9']           numberfound := true         else           wordfound := true;       end;       word := word + line[charcount];     end;   end; end;  begin   assign(input, 't.pas');   reset(input);    while not eof(input)   begin     readln(input, line);      findidentifiers(line);   end;    repeat   until keypressed;     end. 

and input program is:

program p; var i:integer; { comment } begin end. 

it have ignore comments not delete ignore.. output have that:

program p var integer begin end 

the actual output is:

program p var integer end 


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -