.NAME occurences of # and ##

.DESCRIPTION
 There shall be at most one occurrence of the # or ## 
operators in a single macro definition. 
[Unspecified 16.3.2(2), 16.3.3(3), Undefined 16.3.2(2), 16.3.3(3)] 

.COMMENT V7.0

.SEVERITY Required

.COMMENT
Please refer to the MISRA C++:2008 document for further details (www.misra-cpp.com)

.COMMAND tcl

.CODE

::logiscope::include -once common utilities.tcl

proc compute {standardName tree} {
  variable CurrentParameterList
  # Check all #define nodes
  utilities::filterTree $tree [list [namespace current]::check]
}

proc check { node } {
	if { [::utilities::isTreeOperator $node pp_define] } {
		set pp_text [::logiscope::treeDown $node 2]	
		set content ""
		::logiscope::forobj l $pp_text treeChild {
			set content $content[::utilities::treeAtomString $l]
		}
		set content [::utilities::suppressComments $content]
		if { [regexp {\#[^\#]+\#} $content] } {
			::logiscope::addViolation $node
		}
	}
	return 1
}
