kburtch / SparForte

Bourne shell, template engine, scripting language reliable, scalable projects. Based a ISO standard proven effective for large, mission-critical projects, SparForte is designed for fast development while, at the same time, providing easier designing, maintenance and bug removal. About 130.000 lines of code.
https://www.sparforte.com
GNU General Public License v2.0
50 stars 6 forks source link

A collection of errors and other issues #9

Closed Earnestly closed 6 years ago

Earnestly commented 6 years ago

Hi,

Sorry if this is a bit of a laundry list but these are a small collection of issues I've encountered early on when using sparforte.

Picture layout exception

#!/bin/spar

put(123.45, "##9.99");
% spar picture_string_exception.spar
raised ADA.IO_EXCEPTIONS.LAYOUT_ERROR : a-teioed.adb:300

This also crashes the shell when used directly which wouldn't be ideal if spar was being used as the user's main shell.

Range Check Failure

#!/bin/spar

ragma annotate(summary, "range check error");

procedure range_check_error is
  procedure usage is
  begin
     put("usage: ") @ (source_info.file);
     command_line.set_exit_status(0);
  end usage;

begin
  if $# /= 0 then
     usage;
     return;
  end if;
end range_check_error;
% spar range_check_error.spar
raised CONSTRAINT_ERROR : scanner.adb:1992 range check failed

This issue was discovered when trying to elaborate on how spar -gc handles various errors and warnings. It turned out that simply running the script with spar resulted in the same error.

Inconsistent Error Format

#!/bin/spar

procedure wrong_error_style is
  error: string;
begin
  loop
    error := get_line
    exit when error = ";
end wrong_error_style;
% spar -gc wrong_error_style.spar
wrong_error_style.spar:8:1:[11/19 11:29:13] missing double quote

I would have expected:

wrong_error_style.spar:8:1: missing double quote

If I wanted to add timestamps I could use ts from moreutils or svlogd -tt from runit.

Error Reported for the Wrong Line

#!/bin/spar

procedure misleading_line_match is
  error: string
begin
  loop
    error := get_line
    exit when error = "";
end misleading_line_match;
% spar -gc misleading_line_match.spar
misleading_line_match.sp:5:1: ';' expected

The missing ';' should be reported on line 2, column 16, but it is being reported on the line containing begin.

Documentation Misleading

For any example which delcare commands as such:

ls : constant command := "/bin/ls";

I get the following error:

ls : constant command := "/bin/ls";
                      ^^ command variables must be limited

Thanks

kburtch commented 6 years ago

These issues addressed as mentioned in my previous email to ticket opener. Error reported on wrong line is correct behavior.