Menu

#388 Code completition doesn't work if used C++11 raw string literal

Undefined
open
nobody
Bug_Report
2016-08-03
2016-08-02
iassasin
No
#include <sstream>
using namespace std;
class A {
    public:
        int get(){ return 1; }
};

int main(){
    stringstream str;
    str << "id := test;";
    str << R"(lala := \"123 \"";)";

    A a;
    a.get(); // code completition doesn't work here
}

In example when I type "a." and waiting for available fields and methods list of A class - code completition doesn't work. Bug always appears with user-defined types, but for some classes from stl may work (in example completition works for variable "str").

IDE version (installed from ppa):
Code::Blocks Release 16.01 rev 10760 Feb 2 2016, 03:15:41 - wx2.8.12 (Linux, unicode) - 64 bit

Discussion

  • ollydbg

    ollydbg - 2016-08-03
    • labels: --> CodeCompletion
     
  • ollydbg

    ollydbg - 2016-08-03

    Some reference about raw strings:
    c++ - What is the rationale for parenthesis in C++11's raw string literals R"(...)"? - Stack Overflow and string literal - cppreference.com

    Currently, our Tokenizer class should be enhanced.
    Right now, we only handle "xxxx" like string, and in the high level class(the parser), we get a token from the Tokenizer class. But the token is just a wxString, and we now check if the

    token[0]=='\"'
    

    To see whether this is a string or other type of the tokens. The method to solve this issue is:
    First, let the Tokenizer return a structure, such as

    class token
    {
        wxString literal;
        token_type type;
    }
    

    Then, we can use the "type" to distingush the tokens types(whether it is a string, an identifier....). This is not quite easy, because we need to change a lot of code in our CodeCompletion plugins.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.