Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support for parsing escaped #line tags #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented May 11, 2023

Previously #line tags were not correctly parsed if they contained escaped chars like \"

$ cat /tmp/test.cpp
# 1 "/home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/PathWith\"Quotes/Sketch/Sketch.ino"
void setup() {
  foo();
}
void loop() {}
void foo() {}
$ ./ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/test.cpp
$

after this patch the line directives are parsed correctly:

$ cat /tmp/test.cpp
# 1 "/home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/PathWith\"Quotes/Sketch/Sketch.ino"
void setup() {
  foo();
}
void loop() {}
void foo() {}
$ ./ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/test.cpp
setup	/home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/PathWith"Quotes/Sketch/Sketch.ino	/^void setup() {$/;"	kind:function	line:1	signature:()	returntype:void
loop	/home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/PathWith"Quotes/Sketch/Sketch.ino	/^void loop() {}$/;"	kind:function	line:4	signature:()	returntype:void
foo	/home/megabug/Workspace/arduino-cli/internal/integrationtest/testdata/PathWith"Quotes/Sketch/Sketch.ino	/^void foo() {}$/;"	kind:function	line:5	signature:()	returntype:void
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant