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

character - (dash) is a word separator #10

Closed evanescente-ondine closed 6 years ago

evanescente-ondine commented 6 years ago

Currently the dash or (soft ?) hyphen - is considered at least in some situation, as a word separator by the interpretor. Even without space. Names of commands not enclosed in " " can't be interpreted rightly. If that space could be the only word separator, it would make sparforte more usable, for more users.

kburtch commented 6 years ago

This concern has been noted.

This issue is complex. If a space was the only word separator, it would have implications for the rest of the language, affecting software reliability and interpretation of other features. Semi-colon, for example, would require a space in front of it. e.g. "ls -l ;" not "ls -l;" Spacing like this causes problems in other languages, notably Ruby.

I've done some work over Christmas to make SparForte treat the first word of a statement differently. The first word of a statement is a special case, because it could be an AdaScript word, an SQL word or a Bourne shell command path. Now SparForte attempts to determine if it is an AdaScript or not, and marks the command as a Bourne shell command if it contains character that cannot be in an AdaScript identifier. Specifically, it is allowing periods and slashes for a command path. e.g /bin/ls, bin/ls ../bin/ls, etc. should work without quotations.

I tried to relax the restrictions even further, using word separators space, tab, colon, equals and a couple of other characters, but the language regression tests raising exceptions and failing. I will continue to look into this.

Ultimately, there will always be some characters that will require escaping with double-quotes. (And, personally, I think it's a reliability/quality problem to use expression symbols like minus sign, plus, star or slash in file names. Unfortunately, we have to live with it.)

Command type aliases may also help. e.g. dbc : constant command := "/usr/bin/db-config";

I am going to close this issue since it's not a bug but an enhancement. It's been noted in the TODO file.