Project

General

Profile

Bug #670

Error column indicator misaligned with non-printing (unprintable) characters

Added by John Abbott about 9 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
enhancing/improving
Target version:
Start date:
06 Mar 2015
Due date:
% Done:

100%

Estimated time:
1.80 h
Spent time:

Description

While doing some "fuzz" testing with CoCoA-5 I noticed that error messages seemed to indicate the wrong columns; then I realised that non-printing characters in EMACS are displayed using an escape sequence which is much wider than a single character.

Find a way to make the column indication correct even in the presence of unprintable characters.
Implement!

History

#1 Updated by John Abbott about 9 years ago

A very simple idea would be to replace unprintable characters by a single printable character (e.g. ?) this would make the column alignment work fine (with all interfaces, I imagine). The only catch is that the printed section of source code will not look like the true original source code; but perhaps that's what you deserve if you put unprintable characters in your input?

The problem could be more serious if there are multibyte glyphs, but that might be resolved by changing the CoCoA-5 interpreter so that it uses wchar and wstring.

#2 Updated by Anna Maria Bigatti about 9 years ago

John Abbott wrote:

A very simple idea would be to replace unprintable characters by a single printable character (e.g. ?) this would make the column alignment work fine (with all interfaces, I imagine).

That might be a good idea (especially when an unprintable character is not printed).

But how do we know that a character is unprintable? I do have a cocoa file with strings in many languages...

#3 Updated by John Abbott about 9 years ago

  • Status changed from New to In Progress

I was thinking that the substitution for unprintable chars would occur only when printing out source code for the purpose of locating the error. If you ask CoCoA-5 to print a string containing "unprintable characters" then no substitution occurs -- what the final result looks like will depend on the device the string was printed to (or viewed with).

It does not matter much if unprinted chars are replaced in the error message; indeed the location/context information is simply there to help the programmer locate the bug. it's not essential (e.g. CoCoA-4 did not have it).

#4 Updated by John Abbott about 9 years ago

Relevant source code is Lexer.C:615 and following lines.

Already have a prototype; currently prints out # instead of an unprintable char.
Not yet checked in.

#5 Updated by John Abbott almost 7 years ago

  • Status changed from In Progress to Feedback
  • Assignee set to John Abbott
  • Target version changed from CoCoA-5.?.? to CoCoA-5.2.2
  • % Done changed from 0 to 90

This has already been done (ages ago?).
Moving to "feedback".

#6 Updated by John Abbott over 6 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 90 to 100
  • Estimated time set to 1.80 h

Also available in: Atom PDF