.NAME Literal suffixes

.DESCRIPTION
	Literal suffixes shall be upper case. 

.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
  # Look for integer and float definitions containing lowercase suffixes
  utilities::filterTree $tree [list [namespace current]::check]
}

proc check { node } {

	    set curOperator [::logiscope::treeOperator $node]
		set curOperatorName [::logiscope::opName $curOperator]

		# Look for integers with lowercase suffixes
	    if {[string equal $curOperatorName integer]} {
		  set curAtom [::logiscope::treeAtomValue $node]
		  set stringToCheck [::logiscope::stringValue $curAtom]
		  if {[regexp {.*[flu]} $stringToCheck]} {
		    ::logiscope::addViolation [::logiscope::treeParent $node]
	        return 0
		  }
		}
		
		# Look for floats with lowercase suffixes
	    if {[string equal $curOperatorName float]} {
		  set curAtom [::logiscope::treeAtomValue $node]
		  set stringToCheck [::logiscope::stringValue $curAtom]
		  if {[regexp {.*[fl]} $stringToCheck]} {
		    ::logiscope::addViolation [::logiscope::treeParent $node]
	        return 0
		  }
		}
		
  return 1
}
