.NAME Trigraphs

.DESCRIPTION
 Trigraphs shall not be used. 

.COMMENT V7.0

.SEVERITY Required

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

.COMMAND r_tcl_checker

.CODE

#possibleCharsForTrigraphs  = ( / ) ' < ! > -

# reading all file and looking for trigraphs
proc compute {standardName filename} {
	set chan [open $filename]
	set numLine 0
	set pos 0
	while {[gets $chan line] >= 0} {
		incr numLine
		if { [regexp {\?\?([=(/)\'<!>-])} $line str] } {
			set start [string first $str $line]
			incr start $pos
			set end [expr $start + 3]
			Violation $filename $start $end $numLine $standardName "Trigraph not allowed in source code"
		}
		incr pos [string length $line]
		incr pos
	}
	close $chan
}
