More weird stuff . . .
Code:char c = '\'';That last one compiles under gcc.Code:// End of file \
More weird stuff . . .
Code:char c = '\'';That last one compiles under gcc.Code:// End of file \
Last edited by dwks; 08-21-2005 at 11:54 AM.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Or this . . .
(the L means it's a unicode string.)Code:strcpy(s, L"hippo");
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Code:#define SQUARE(x) \ ((x)*(x))
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
that good useful stuff keep up your post, but may i recommend use of the edit button
ok im revising my entire code with an entirly new concept that
going extremely well at this point. however what takes priority
strings or comments?
because im my compiler if i have "*/" in a string somewhere
but just in the open code i put /* somewhere, it will comment
out in the green color from there to the one in the string.
but if i have "/*" and then somewhere later i have "*/"
nothing happens?
right now with only string being developed my current solution
will out put the following with this code :
i do realize half that code is not valid code,Code:// multi-line single-line comment \ this is a continuation of the comment char ch = '\\'; const char *str = "\" \ blah"; const char *str2 = "\"", str3 = "\""; /*/ /*/ char c = '\''; char c1 = '\'\'\'\'\'\'\\\\'; char c2 = '\'\'\'\'\'\'\\';
but i just messed around to see how it would handle it.
Strings and comments have equal priority. For example,
I can show you my parser if you like. It employs modes, normal mode, string mode, and comment mode.Code:char s[] = "hippo /* hippo */ hippo"; /* sets string to "hippo ... " */
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
It isn't necessarily a matter of priority. It is a matter of state. If you are in the middle of a multi-line comment and a quotation mark is encountered, it should be treated just like any other character. The only thing that changes your state is an occurence of */. Likewise, the same may be said of strings. If you're in a string and you encounter a /* it makes no difference because everything is part of the string up to the next (un-escaped) ".
update on newest version im not posting the code yet,
because it doesnt highlight keywords yet, im
just working on comments and strings for now.
later today after work ill be working on single line
comments, and the \ slash thingy that you guys mentioned.
Code:// multi-line single-line comment \ this is a /* a midline comment */ continuation of the comment /* a mutli lined comment which doesnt end till here */ char ch = '\\'; const char *str = "\" \ blah"; const char *str2 = "\"", str3 = "\""; /*/ there is stuff in between here /*/ /*/stuff inbetween here as well/*/ /*//*/ /*/ /*/ /* another comment */ char c = '\''; char c1 = '\'\'\'\'\'\'\\\\'; char c1 = '\'\'\'\'\'\'\\';
Heres what I came up with so far. Sorry if formatting is off my bros comp might have messed up the tabs and spaces.
The Numbers function is still under debug, I'm mainly working on the basic design right now and tweaking it later but this is what I have working and its the code I am debugging right now.
Note: Rename the hightlight.txt to highlight.ini
Last edited by JoshR; 08-23-2005 at 12:12 PM.
Okay, how about this:
Code:int i = (int)int_num;
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Some IDE's dont recognize the "multiline backslash comment":
[edit]Code:// multi-line single-line comment \ another line
oops my mistake
[/edit]
Last edited by JoshR; 08-25-2005 at 06:08 PM.
Really? I've got VS .NET 2003 and that works just fine...
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
Accidently had the other slash, but it still doesnt work under dev-c++
Although VS .net 2003 does work.
ok this is my newest update, ive completed all but one section of
the program and thsi is my current output
yes i knew some of that code not standard, or even compile.Code:#include <iostream> #include<iostream> #define #define other stuff #define masturabation("woot") // multi-line single-line comment \ this is a /* a midline comment */ continuation of the comment /* a mutli lined comment which doesnt end till here */ char ch = '\\'; const char *str = "\" \ blah"; const char *str2 = "\"", str3 = "\""; // and this is another comment /*/ there is stuff in between here /*/ /*/stuff inbetween here as well/*/ /*//*/ /*/ /*/ /* "a comment within a quote" */ /* another comment */ char c = '\''; char c1 = '\'\'\'\'\'\'\\\\'; char c1 = '\'\'\'\'\'\'\\';
but i wanted to test it on the werid stuff that could coem up.
And how many lines of code is yours? mines totaling about 500 and it works liek a charm, just have to get the keywords function coded and im all done.
also a couple things that dev and my other compiler do:
the second line "blah";" would not be red.Code:"\" \ blah";
and...
I personally like it when the whole line is blue atleast thats what my compilers do except vs .net 2003Code:#include<iostream>