![]() |
Telelogic Lifecycle Solutions (steve huntington) | ![]() |
Topic Title: regex m{\*/} or m{/\*} Topic Summary: Logiscope perl checker doesn't recognize '/*' Created On: 2-Nov-2005 22:39 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Terrence As you are using C rulechecker, your rule is probably working on the (sort-of) preprocessed file available through the hash %TabPreprocessFile, in which case there are no c-style comments to detect. Look in the RuleCheckerC.pdf for the bit about @cList to get the raw source-file names so your perl rule can process these. Use @CList instead of %TabPreprocessFile. If your script starts like this: foreach $key (keys %TabPreprocessFile) { &lookForTab ($key, $TabPreprocessFile{$key}) ; } sub lookForTab { ... It should instead look like this: for $pathName (@cList) { print "Checking $pathName\n" open(C, "<$pathName") || warn "$pathName: cannot read: $!\n"; # Do something with the content of the file. ... close(F); } You can always put print statements in your rule to display what is being checked; the output will appear on the command line or on the Build tab of the GUI. HTH Ian | |
![]() |
|
I'm trying to write a rule for the perl checker and I need to check if a line in a C file has a comment. It recognizes c++ style, m{//}, OK but not C style, m{/\*}. If I try the regex with standalone perl it works OK. Can you suggest something to try?
How To Reproduce ---------------------- if ( $line =~ m#/\*# ) { do something; { Terry Carpenter ------------------------- Terry Carpenter |
|
![]() |
|
![]() |
|
Terrence
As you are using C rulechecker, your rule is probably working on the (sort-of) preprocessed file available through the hash %TabPreprocessFile, in which case there are no c-style comments to detect. Look in the RuleCheckerC.pdf for the bit about @cList to get the raw source-file names so your perl rule can process these. Use @CList instead of %TabPreprocessFile. If your script starts like this: foreach $key (keys %TabPreprocessFile) { &lookForTab ($key, $TabPreprocessFile{$key}) ; } sub lookForTab { ... It should instead look like this: for $pathName (@cList) { print "Checking $pathName\n" open(C, "<$pathName") || warn "$pathName: cannot read: $!\n"; # Do something with the content of the file. ... close(F); } You can always put print statements in your rule to display what is being checked; the output will appear on the command line or on the Build tab of the GUI. HTH Ian ------------------------- ============= Ian Barnard Principal Consultant Telelogic UK, an IBM company |
|
![]() |
Telelogic Lifecycle Solutions
» Logiscope
»
regex m{\*/} or m{/\*}
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.