Martin Bjorklund <m...@tail-f.com> writes:
>> > > > > It is worth noting (either here or in 6.1.3) how line-breaks inside
>> > > > > quoted strings are transcribed into the string's value.  As now
>> > > > > written, it seems that the line-break is transcribed identically to
>> > > > > how it is represented in the source.  That means (1) If the source is
>> > > > > recoded with the other type of line break, the semantics of the Yang
>> > > > > code change; and (2) if the source uses line-breaks of one type (CRLF
>> > > > > or LF), only that type can be directly transcribed into string 
>> > > > > values.
>> > > > > (But regardless of the source line-breaks, an LF can be transcribed
>> > > > > into a double-quoted string with "\n".  But a CRLF cannot be
>> > > > > transcribed into a double-quoted string with escape sequences.  Was
>> > > > > that intended, or was "\r" intended to be legal?)
>> > > 
>> > > Don't forget this.
>> 
>> I was wondering that (as the text is written) the value of a quoted
>> string that includes a line end will change if the line ends are
>> changed (say, by moving the Yang file to a different host).  Normally
>> computer languages are defined so that changing how the program is
>> "represented", e.g., by transforming it into a form with different
>> line-ends, won't change the semantics of the program.
>> 
>> But if it's true, I seems desirable to provide an explicit warning
>> about it.

It still seems to me to be valuable to warn about this.

>> > You can always get the same effect by using single quoted strings.
>> 
>> I don't see how you can get a single CR using single-quoted strings,
>> because line ends are only allowed to be LF and CR-LF; writing a CR
>> without an LF following it isn't allowed.  Or is it that in practice,
>> Yang 1 allows people to use CR alone, and it is not interpreted as a
>> line-end?
>
> If the module has a string like this:
>
>    0x27 0x0d 0x27
>
> it is a string with a single CR.

I see in the grammar:

   line-break          = CRLF / LF

So you can't write an isolated CR in most of a Yang module.  But am I
correct in understanding that you *can* write an isolated CR inside a
single-quoted string (and presumably, a double-quoted string)?

Dale

_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to