Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit afde447

Browse files
committed
Applied new CMake 'newline' cache policy to some regexes
1 parent 0d044a8 commit afde447

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

cmake/Platform/Project/ProjectSetup.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@ function(arduino_cmake_project _project_name)
1111

1212
setup_project_core_lib(${_project_name})
1313

14+
set(ARDUINO_CMAKE_FUNCTION_DEFINITION_REGEX_PATTERN
15+
"^([A-Za-z0-9_][ \t\r\n]*)+\\(.*\\)$" PARENT_SCOPE)
16+
set(ARDUINO_CMAKE_FUNCTION_DECLARATION_REGEX_PATTERN
17+
"^([A-Za-z0-9_])+.+([A-Za-z0-9_])+[ \t\r\n]*\\((.*)\\);$" PARENT_SCOPE)
18+
set(ARDUINO_CMAKE_FUNCTION_NAME_REGEX_PATTERN "(([A-Za-z0-9_])+)[ \t\r\n]*\\(.*\\)" PARENT_SCOPE)
19+
set(ARDUINO_CMAKE_FUNCTION_ARGS_REGEX_PATTERN "\\((.*)\\)" PARENT_SCOPE)
20+
set(ARDUINO_CMAKE_FUNCTION_SINGLE_ARG_REGEX_PATTERN "([A-Za-z0-9_]+)[^,]*" PARENT_SCOPE)
21+
set(ARDUINO_CMAKE_FUNCTION_ARG_TYPE_REGEX_PATTERN "[A-Za-z0-9_]+.*[ \t\r\n]+" PARENT_SCOPE)
22+
1423
endfunction()

cmake/Platform/System/DefaultsManager.cmake

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,27 @@ function(set_internal_search_patterns)
1919
set(ARDUINO_CMAKE_NAME_WE_REGEX_PATTERN "([^\\/]+)\\." CACHE STRING
2020
"Regex pattern matching name without file extension")
2121

22-
set(ARDUINO_CMAKE_FUNCTION_REGEX_PATTERN "^([a-z]|[A-Z])+.*\(([a-z]|[A-Z])*\)" CACHE STRING
23-
"Regex pattern matching a function signature in a source file")
22+
#[[set(ARDUINO_CMAKE_FUNCTION_DECLARATION_REGEX_PATTERN "^([A-Za-z0-9_])+.+([A-Za-z0-9_])+[ \t\r\\n]*\((.*)\);$"
23+
CACHE STRING "Regex pattern matching a function signature definition in a source file")
24+
25+
set(ARDUINO_CMAKE_FUNCTION_DEFINITION_REGEX_PATTERN "^([A-Za-z0-9_])+[ \t\r\n]*\(([A-Za-z0-9_])*\)$"
26+
CACHE STRING "Regex pattern matching a function signature definition in a source file")
27+
28+
set(ARDUINO_CMAKE_FUNCTION_NAME_REGEX_PATTERN "(([A-Za-z0-9_])+)[ \t\r\\n]*\(.*\)"
29+
CACHE STRING
30+
"Regex pattern matching a function's name (and everything following it), can be retrieved by the 1st group")
31+
32+
set(ARDUINO_CMAKE_FUNCTION_ARGS_REGEX_PATTERN "\((.*)\)"
33+
CACHE STRING
34+
"Regex pattern matching a function's argument list, i.e. What's inside the parentheses")
35+
36+
set(ARDUINO_CMAKE_FUNCTION_SINGLE_ARG_REGEX_PATTERN "([A-Za-z0-9_]+)[^,]*"
37+
CACHE STRING
38+
"Regex pattern matching a function's argument, requiring maximum matches to get all arguments")
39+
40+
set(ARDUINO_CMAKE_FUNCTION_ARG_TYPE_REGEX_PATTERN "[A-Za-z0-9_]+.*[ \t\r\\n]+"
41+
CACHE STRING
42+
"Regex pattern matching a function argument type, ommiting it's name")]]
2443

2544
endfunction()
2645

0 commit comments

Comments
 (0)