elliotchance / c2go

⚖️ A tool for transpiling C to Go.
MIT License
2.06k stars 151 forks source link

wide string literal not handled by regex #866

Closed kroppt closed 3 years ago

kroppt commented 3 years ago

Error from my own test:

panic: could not match regexp with string
^(?P<address>[0-9a-fx]+) <(?P<position>.*)> '(?P<type>.*)'(?P<lvalue> lvalue)? (?P<value>".*")[\s]*$
0x561f897201c8 <col:16> 'wchar_t [6]' L"tes\x115t"

Source found on https://c-testsuite.github.io/c2go_report.html:

// this file contains BMP chars encoded in UTF-8
#include <stdio.h>
#include <wchar.h>

int main()
{
    wchar_t s[] = L"hello$$你好¢¢世界€€world";
    wchar_t *p;
    for (p = s; *p; p++) printf("%04X ", (unsigned) *p);
    printf("\n");
    return 0;
}

Docs:

StringLiteral - This represents a string literal expression, e.g. "foo" or L"bar" (wide strings).

https://clang.llvm.org/doxygen/classclang_1_1StringLiteral.html