[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: End-of-line
Multi-line tokens is a problem that appears at several places. The message
of Vincent Prunet gives an answer for endling such things in the pretty-printing
context. There is another problem in the context of parsing.
If you have written you language definition using Metal, then a yacc file
has been generated, the compilation of which returns a parser. This parser is
suppose to run as a separate process and to communicate with Centaur via
a protocol (the oldest protocol ever in use in Centaur). This protocol assumes
that all atomic values will be printed on ONE line. Thus, there is no way
you can construct an atom with a value containing an end of line character.
Thus, either you arrange to have you data cut in a string of tokens, as Vincent
first suggested, or you mix the two other solutions: modify the lex specification
of your language so that the character `\` is replaced by `\\` and the
end-of-line character is replaced by `\n`, you will then have to do about
the same UGLY code as Vincent suggested, where printsubstring returns the
string between two occurrences of \n, where the occurrences of `\\` have been
unescaped.
Yves.