Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 10, 2004 [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Probably a minor issue: If you use a /+ +/ style comment, it will be terminated early if there's a contained string with the "+/" pattern. That is: the comment scanner doesn't know about strings. - Kris |
April 10, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c59jq1$1eb8$1@digitaldaemon.com... > Probably a minor issue: > > If you use a /+ +/ style comment, it will be terminated early if there's a > contained string with the "+/" pattern. > > That is: the comment scanner doesn't know about strings. That's consistent with /* and */ in D as well as in C++. |
April 10, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | But did you decide that this is how it _should_ be?
Being consistent with C/C++ should not be a design goal -- you are trying to
create a *better* language, right?
<snip>
>> If you use a /+ +/ style comment, it will be terminated early if there's
>a
>> contained string with the "+/" pattern.
>That's consistent with /* and */ in D as well as in C++.
</snip>
|
April 10, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | I figured so, but wasn't sure if that was the design goal. Would certainly make the parser faster in that particular area. I guess if we really want to avoid these kinds of gotcha's, then we should use version{} instead ... yes? If so, then perhaps /+ +/ is somewhat redundant? - Kris "Walter" <walter@digitalmars.com> wrote in message news:c59nvm$1k9a$1@digitaldaemon.com... > > "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c59jq1$1eb8$1@digitaldaemon.com... > > Probably a minor issue: > > > > If you use a /+ +/ style comment, it will be terminated early if there's > a > > contained string with the "+/" pattern. > > > > That is: the comment scanner doesn't know about strings. > > That's consistent with /* and */ in D as well as in C++. > > |
April 10, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | In article <c59qil$1o1d$1@digitaldaemon.com>, Kris says... > >I figured so, but wasn't sure if that was the design goal. Would certainly make the parser faster in that particular area. > >I guess if we really want to avoid these kinds of gotcha's, then we should use version{} instead ... yes? Yes, if you're worried about this issue, then use version(). >If so, then perhaps /+ +/ is somewhat >redundant? /+ +/ comes in real handy for me for quick trials when I'm trying to chase down a bug or thinking about making major changes. I don't have too many "/+" enclosed in strings in my code. I would comment-out that line with a "//" instead of nested comments in that situation. (Uncommon solutions are appropriate for uncommon situations.) If you don't find nested comments useful, then don't use them. JC > >- Kris > > >"Walter" <walter@digitalmars.com> wrote in message news:c59nvm$1k9a$1@digitaldaemon.com... >> >> "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote in message news:c59jq1$1eb8$1@digitaldaemon.com... >> > Probably a minor issue: >> > >> > If you use a /+ +/ style comment, it will be terminated early if >there's >> a >> > contained string with the "+/" pattern. >> > >> > That is: the comment scanner doesn't know about strings. >> >> That's consistent with /* and */ in D as well as in C++. |
April 11, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote: > Probably a minor issue: > > If you use a /+ +/ style comment, it will be terminated early if there's a contained string with the "+/" pattern. > > That is: the comment scanner doesn't know about strings. That behavior is in the spec, under "Lexical": "Comment processing conceptually happens before tokenization. This means that embedded strings and comments do not prevent recognition of comment openings and closings" Odd timing for your post -- I just implemented that behavior in my D lexer this morning :-) -- dave |
April 11, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave Sieber | I should learn to read :-) "Dave Sieber" <dsieber@spamnot.sbcglobal.net> wrote in message news:Xns94C7C76FD2F43dsiebersbc@63.105.9.61... > "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote: > > > Probably a minor issue: > > > > If you use a /+ +/ style comment, it will be terminated early if there's a contained string with the "+/" pattern. > > > > That is: the comment scanner doesn't know about strings. > > That behavior is in the spec, under "Lexical": > > "Comment processing conceptually happens before tokenization. This means that embedded strings and comments do not prevent recognition of comment openings and closings" > > > Odd timing for your post -- I just implemented that behavior in my D lexer this morning :-) > > -- > dave |
April 11, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juan C | "Juan C" <Juan_member@pathlink.com> wrote in message news:c59q9a$1nlv$1@digitaldaemon.com... > But did you decide that this is how it _should_ be? Yes. > Being consistent with C/C++ should not be a design goal -- you are trying to > create a *better* language, right? I've seen this particular issue on comments debated years ago, and the end result was neither side had a compelling argument. So I'll go with compatibility as the tipping factor. |
April 11, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote: > I should learn to read :-) I wouldn't sweat it -- there's a lot to learn :-) But I'm curious -- does your editor do syntax highlighting for D, and if so, did it highlight the comment correctly? -- dave |
April 11, 2004 Re: [BUG] minor: /+ +/ comment terminated by a string | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave Sieber | I'm using a combination of Epsilon (Emacs), and VC6.0. As you might expect, neither show any sign of doing anything with the D-specific comments, although they happily highlight D source as they would C++. I could probably rattle up some additional EEL code for Epsilon, but it'll never be quite as nifty as what you're working on ... - Kris "Dave Sieber" <dsieber@spamnot.sbcglobal.net> wrote in message news:Xns94C7DB2924634dsiebersbc@63.105.9.61... > "Kris" <someidiot@earthlink.dot.dot.dot.net> wrote: > > > I should learn to read :-) > > I wouldn't sweat it -- there's a lot to learn :-) > > But I'm curious -- does your editor do syntax highlighting for D, and if so, did it highlight the comment correctly? > > -- > dave |
Copyright © 1999-2021 by the D Language Foundation