CordyJ / OpenTxl

TXL programming language compiler/interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug in output spacing

CordyJ opened this issue · comments

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.)