Skip to content

Commit 8d2eec4

Browse files
committed
CtagsFileSaver: Look for the hashtag as character, not string
TestCTagsRunner* use the #line directive generated file as source instead than # $linenumber. Searching fot the '#' as first char make tests passing Signed-off-by: Martino Facchin <[email protected]>
1 parent b79ed42 commit 8d2eec4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/arduino.cc/builder/ctags_target_file_saver.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ func saveLinesContainingDirectivesAndSketch(src string, tofind []string) string
7979
if saveLine || startsWithHashtag(line) {
8080
minimizedString += line + "\n"
8181
}
82-
if containsAny(line, tofind) && isPreprocessorLineMarker(line) {
82+
if containsAny(line, tofind) && isLineMarker(line) {
8383
saveLine = true
8484
}
85-
if saveLine && !containsAny(line, tofind) && isPreprocessorLineMarker(line) {
85+
if saveLine && !containsAny(line, tofind) && isLineMarker(line) {
8686
saveLine = false
8787
}
8888
}
@@ -106,10 +106,10 @@ func startsWithHashtag(src string) bool {
106106
return false
107107
}
108108

109-
func isPreprocessorLineMarker(src string) bool {
109+
func isLineMarker(src string) bool {
110110
trimmedStr := strings.TrimSpace(src)
111111
splittedStr := strings.Split(trimmedStr, " ")
112-
if len(splittedStr) > 2 && splittedStr[0] == "#" {
112+
if len(splittedStr) > 2 && splittedStr[0][0] == '#' {
113113
_, err := strconv.Atoi(splittedStr[1])
114114
if err == nil {
115115
return true

0 commit comments

Comments
 (0)