Skip to content

Commit fc05e5a

Browse files
author
Matthias Kastner
committed
enhanced constant parsing
explicitly match the Constant Name without white spaces, allow comments, match content of constant and any comments to it. ```igorpro StrConstant REQUIRE_MODE1 = "a\\\"bc" // == OUTPUT_MESSAGE | INCREASE_ERROR | ABORT_FUNCTION static Constant REQUIRE_MODE2 = 0x3B // == OUTPUT_MESSAGE | INCREASE_ERROR | ABORT_FUNCTION static Constant REQUIRE_MODE3 = 7 // == OUTPUT_MESSAGE | INCREASE_ERROR | ABORT_FUNCTION static Constant REQUIRE_MODE4 = 7 Constant a=1 Constant c=5 ```
1 parent 8b7b72e commit fc05e5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

procedures/CodeBrowser.ipf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ Function addDecoratedConstants(module, procedureWithoutModule, declWave, lineWav
341341

342342
// search code and return wavLineNumber
343343
Make/FREE/N=(numLines)/T text = StringFromList(p, procText, "\r")
344-
re = "^(?i)[[:space:]]*((?:override)?(?:static)?[[:space:]]*(?:Str)?Constant)[[:space:]]+([^=]*)=.*"
344+
// help for regex on https://regex101.com/
345+
re = "^(?i)[[:space:]]*((?:override\s+)?(?:static)?[[:space:]]*(?:Str)?Constant)[[:space:]]+([^=\s]*)\s*=\s*(?:\"(?:[^\"\\\\]|\\\\.)+\"|0[xX][0-9a-fA-F]+|[0-9]+)\s*(?:[\/]{2}.*)?"
345346
Grep/Q/INDX/E=re text
346347
Wave W_Index
347348
Duplicate/FREE W_Index wavLineNumber

0 commit comments

Comments
 (0)