dominicm00 / ham

A meaty Jam build tool replacement

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formalize and test treatment of whitespace

dominicm00 opened this issue · comments

Officially, Ham follows Jam's tokenization procedure where everything is separated by whitespace, except variables which are single tokens:

# valid Jam
if ! a && ( b = c ) {
  Echo [ on target return $(X:D) ] ;
}
# Removing/adding whitespace between _anything_ here changes the meaning of the program

Unofficially, Ham's parsing mechanism makes most whitespace optional, and can trivially enforce/remove whitespace requirements:

# (possibly) valid Ham
if !a&&(b=c){Echo[on target return $( X : D )];}
# Whitespace can be added/removed between semantic objects (except keywords) without consequence
# if they would not be interpreted as a single leaf

Currently, unit tests only cover the Jam-compatible language definition.

Ham should formalize its treatment of whitespace in the language specification, and then add unit tests to ensure compliance before users rely on this feature.

Ham v2 has been moved; closing issues not relevant for v1.