ES4 draft last call: line continuation in string and regex literals

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

ES4 draft last call: line continuation in string and regex literals

Lars Hansen-3
Last call for the line continuation spec:

http://wiki.ecmascript.org/doku.php?id=spec:line_continuation_in_strings

("Last call" = it will be taken into the language spec within a week or
so unless there's opposition now.)

--lars
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: ES4 draft last call: line continuation in string and regex literals

Maciej Stachowiak

On Mar 8, 2008, at 8:20 AM, Lars Hansen wrote:

> Last call for the line continuation spec:
>
> http://wiki.ecmascript.org/doku.php?id=spec:line_continuation_in_strings
>
> ("Last call" = it will be taken into the language spec within a week  
> or
> so unless there's opposition now.)

This (and the line terminator normalization draft) seem to be in  
restricted parts of the wiki. Could they go somewhere public?

  - Maciej

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: ES4 draft last call: line continuation in string and regex literals

Waldemar Horwat
In reply to this post by Lars Hansen-3
> The character sequence BACKSLASH <lineterminator> (where <lineterminator> will be one of the characters LF, LS, or PS) is removed from string literals delimited by either single or triple SINGLEQUOTE or DOUBLEQUOTE characters. (Triple-quoting is defined in [5].)

This states that:

"abc\\
tde"

evaluates to the string "abc<tab>de".

Is this really what we want?  I'd find such nested escape sequences really strange.

    Waldemar
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: ES4 draft last call: line continuation in string and regex literals

Lars Hansen-3
> -----Original Message-----
> From: Waldemar Horwat [mailto:[hidden email]]
> Sent: 10. mars 2008 18:59
> To: Lars Hansen
> Cc: es4-discuss Discuss
> Subject: Re: ES4 draft last call: line continuation in string
> and regex literals
>
> > The character sequence BACKSLASH <lineterminator> (where
> > <lineterminator> will be one of the characters LF, LS, or PS) is
> > removed from string literals delimited by either single or triple
> > SINGLEQUOTE or DOUBLEQUOTE characters. (Triple-quoting is
> defined in
> > [5].)
>
> This states that:
>
> "abc\\
> tde"
>
> evaluates to the string "abc<tab>de".
>
> Is this really what we want?  I'd find such nested escape
> sequences really strange.

That looks like an illegal token to me, since the lexer will read "a"
"b" "c" "\" and then see an unescaped linefeed.

Since the speclet states nothing about changing the way strings are
lexed, normal escape character processing should be in effect, and that
dictates that \\ is processed into \ independently of what follows.

--lars
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: ES4 draft last call: line continuation in string and regex literals

Waldemar Horwat
Lars Hansen wrote:

>>> The character sequence BACKSLASH <lineterminator> (where
>>> <lineterminator> will be one of the characters LF, LS, or PS) is
>>> removed from string literals delimited by either single or triple
>>> SINGLEQUOTE or DOUBLEQUOTE characters. (Triple-quoting is
>> defined in
>>> [5].)
>> This states that:
>>
>> "abc\\
>> tde"
>>
>> evaluates to the string "abc<tab>de".
>>
>> Is this really what we want?  I'd find such nested escape
>> sequences really strange.
>
> That looks like an illegal token to me, since the lexer will read "a"
> "b" "c" "\" and then see an unescaped linefeed.
>
> Since the speclet states nothing about changing the way strings are
> lexed, normal escape character processing should be in effect, and that
> dictates that \\ is processed into \ independently of what follows.

It's what we all want.  As written, that's not what it states.  This isn't ready to go in until this bug is corrected.

    Waldemar
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: ES4 draft last call: line continuation in string and regexliterals

Jeff Dyer


> -----Original Message-----
> From: [hidden email] [mailto:es4-discuss-
> [hidden email]] On Behalf Of Waldemar Horwat
> Sent: Monday, March 10, 2008 6:29 PM
> To: Lars Hansen
> Cc: es4-discuss Discuss
> Subject: Re: ES4 draft last call: line continuation in string and
> regexliterals
>
> Lars Hansen wrote:
> >>> The character sequence BACKSLASH <lineterminator> (where
> >>> <lineterminator> will be one of the characters LF, LS, or PS) is
> >>> removed from string literals delimited by either single or triple
> >>> SINGLEQUOTE or DOUBLEQUOTE characters. (Triple-quoting is
> >> defined in
> >>> [5].)
> >> This states that:
> >>
> >> "abc\\
> >> tde"
> >>
> >> evaluates to the string "abc<tab>de".
> >>
> >> Is this really what we want?  I'd find such nested escape
> >> sequences really strange.
> >
> > That looks like an illegal token to me, since the lexer will read
"a"
> > "b" "c" "\" and then see an unescaped linefeed.
> >
> > Since the speclet states nothing about changing the way strings are
> > lexed, normal escape character processing should be in effect, and
that
> > dictates that \\ is processed into \ independently of what follows.
>
> It's what we all want.  As written, that's not what it states.  This
isn't
> ready to go in until this bug is corrected.

Waldemar, can you suggest a fix?

Jd

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: ES4 draft last call: line continuation in string and regexliterals

Waldemar Horwat
Jeff Dyer wrote:
> Waldemar, can you suggest a fix?

The correct fix is to add the relevant productions to the lexer grammar.  It's fairly straightforward in the string literal grammar.  It's painful in the regexp grammar.

    Waldemar
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: ES4 draft last call: line continuation in string and regexliterals

Lars Hansen-3
OK.  I'll make a brief annotation on the proposal page about
left-to-right interpretation so that we can move on and say that we've
accepted the proposal; when the grammar is later written up there should
be no room for confusion about what the intent of this proposal was.

--lars

> -----Original Message-----
> From: Waldemar Horwat [mailto:[hidden email]]
> Sent: 12. mars 2008 18:57
> To: Jeff Dyer
> Cc: Lars Hansen; es4-discuss Discuss
> Subject: Re: ES4 draft last call: line continuation in string
> and regexliterals
>
> Jeff Dyer wrote:
> > Waldemar, can you suggest a fix?
>
> The correct fix is to add the relevant productions to the
> lexer grammar.  It's fairly straightforward in the string
> literal grammar.  It's painful in the regexp grammar.
>
>     Waldemar
>
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss