Author |
Topic |
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - May 14 2013 : 09:01:20 AM
|
In VS2005 paste following code into CPP file:
// cppConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define TEST_MACRO
#if defined(TEST_MACRO)
#include <iostream>
#include <locale>
#endif
#if defined(TEST_MACRO)
static int haha_hoho()
{
return 0;
}
template< typename T >
struct is_int{
static const bool value = false;
};
template<>
struct is_int< int >{
static const bool value = true;
};
template<>
struct is_int< int* >{
static const bool value = true;
};
template <typename IVal>
IVal max_signed()
{
IVal new_val;
memset(&new_val, -1, sizeof(IVal));
return new_val / 2;
}
static int zz(const char *aa, const char *bb, int cc = 1, int dd = 1, const std::locale & loc = std::locale())
{
char pc, sc;
while (true)
{
pc = cc ? std::tolower(*bb, loc) : *bb;
if (
(pc == '\\0' && *aa != '\\0') ||
(*aa == '\\0' && pc != '%' ))
return 0;
if (pc == '%')
{
while (*bb == '%')
++bb;
pc = cc ? std::tolower(*bb, loc) : *bb;
if (pc == '\\0')
break;
while (true)
{
if (pc != '_' && pc != '\\\\')
{
while (*aa)
{
sc = cc ? std::tolower(*aa, loc) : *aa;
if (sc == pc)
break;
++aa;
}
}
if (zz(aa, bb, dd))
return 1;
if (*aa == '\\0')
return 0;
sc = cc ? std::tolower(*aa, loc) : *aa;
++aa;
}
}
if (pc == '_')
{
bb++;
aa++;
continue;
}
// osetrenie escape
if (
dd && pc == '\\\\' &&
(bb[1] == '\\\\' || bb[1] == '%' || bb[1] == '_'))
{
++bb;
pc = cc ? std::tolower(*bb, loc) : *bb;
}
sc = cc ? std::tolower(*aa++, loc) : *aa++;
++bb;
if (sc != pc)
return 0;
}
return -1;
}
int _tmain(int argc, _TCHAR* argv[])
{
// here must not be any statement!!!
std::string str; // try to add include for str
return 0;
}
#endif
Focus on function _tmain 1.) when cursor is in it, bracket highlighting ends on # in line with #endif ( I mean, does not end on closing bracket ) 2.) try to add include for std::string str; VAX adds it into _tmain body.
Seems like parsing error, code compiles...
|
Edited by - Dusan on May 14 2013 09:04:42 AM |
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - May 14 2013 : 1:38:23 PM
|
Thank you for the clear description, I am seeing the Add Include problem:
case=74288
So far no sign of the bracket highlighting problem though, the () and {} brackets on the _tmain function are being highlighted correctly for me. Which version of VA are you using? Which OS are you using? |
zen is the art of being at one with the two'ness |
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - May 15 2013 : 01:53:28 AM
|
Hmm... I have reopened the same project and now bracket highlighting works correctly... :( ...or... :)
OS: Windows Vista 64bit IDE: Visual Studio 2005 VAX: 10.7.1936.0 build 2013.04.22 |
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - May 15 2013 : 02:13:34 AM
|
One more issue... I have been playing with that code to regenerate bracket highlighting issue (successfully but can not reproduce it each time)..
..but I have found, that include for std::string can be added again and again (still into _tmain) even it is there already. |
Edited by - Dusan on May 15 2013 02:14:26 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - May 15 2013 : 9:02:59 PM
|
I am not sure what is going on with the bracket highlighting, normally this behaves in a consistent manor. If you can make this happen in a consistent manor I would be interested to see the code you used to do so.
I am seeing the same problem with Add Include working several times in a row, that is unexpected. I have added a note about this to the bug report, since this may well be related to the same problem that is causing the #include line to be placed into the function. |
zen is the art of being at one with the two'ness |
|
|
Dusan
Whole Tomato Software
Slovakia
177 Posts |
Posted - May 16 2013 : 12:57:07 AM
|
I have used the same code for bracket highlighting issue, but as I wrote, it is not as easy to reproduce it each time...
Regarding std::string include issue, it really depends on std::string statement position in code. For example if you remove one or more empty rows from _tmain method (or remove first comment in it), it causes that add include feature is working well. But how could empty row affect parsing? Perhaps highlighting issue and add include issue relates to the same parsing problem - hopefully.
|
|
|
feline
Whole Tomato Software
United Kingdom
19024 Posts |
Posted - May 16 2013 : 12:45:15 PM
|
Normally blank lines won't have any effect on how our parser behaves, but clearly this is an exception to that normal rule. Hopefully when this bug is fixed all of these issues will be resolved, since they do seem to be connected. |
zen is the art of being at one with the two'ness |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Jun 03 2013 : 2:10:59 PM
|
case=74288 is fixed in build 1940 |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Jun 03 2013 : 2:12:27 PM
|
The issue with Add Include being offered for std::string when #include <string> is already present is case=74343, and is fixed in build 1940 |
|
|
|
Topic |
|