CordyJ / OpenTxl

TXL programming language compiler/interpreter
Other
18 stars 1 forks source link

Bug in output spacing #10

Closed CordyJ closed 10 months ago

CordyJ commented 10 months ago

If a token such as a [comment] or [id] is artificially programmed to be a null string, the output spacing rules for it should not apply. Rather, it should act as if it were [empty].

Example:

define program
    [token*]
end define

function main
    replace [program]
        P [program]
    by
        P [message "output should be: 'y y y'"]
          [replaceByNull 'x]
end function

rule replaceByNull Id [id]
    replace $ [id]
        Id
    construct NullId [id]
        _ [: 1 0]
    by
        NullId
end rule

Input:

x y x x y x x x y

Output:

output should be: 'y y y'
 y y y

(Note the space at the beginning of the line.)