##// END OF EJS Templates
Separate the initialization of the properties of the graph of the update of the units of the graph....
Separate the initialization of the properties of the graph of the update of the units of the graph. The initialization of the properties is carried out when adding a variable in the graph, the update of the units is carried out when loading the data of this variable

File last commit:

r2:451739a45362
r1308:41b7c6aab8be
Show More
IPSIS_C01.tcl
65 lines | 2.2 KiB | application/x-tcl | TclLexer
Ajout de vera++
r2 #!/usr/bin/tclsh
# The destructor of a class should be virtual
proc createMachine {initState} {
set machine [dict create state $initState bracesCounter 0]
return $machine
}
foreach fileName [getSourceFileNames] {
set machines [list]
set prev1 ""
set prev2 ""
foreach token [getTokens $fileName 1 0 -1 -1 {class struct leftbrace rightbrace virtual compl identifier semicolon}] {
set type [lindex $token 3]
set line [lindex $token 1]
if {$type == "class" || $type == "struct"} {
lappend machines [createMachine "beforeLeftBrace"]
}
set machinesToKeep [list]
foreach m $machines {
set keepMachine 1
dict with m {
if {$state == "beforeLeftBrace"} {
if {$type == "leftbrace"} {
set state "root"
} elseif {$type == "semicolon"} {
set keepMachine 0
}
} elseif {$state == "root"} {
if {$prev2 != "virtual" && $prev1 == "compl" && $type == "identifier"} {
set dtorName [lindex $token 0]
report $fileName $line "The destructor ~${dtorName}() of the class should be virtual"
}
if {$type == "leftbrace"} {
incr bracesCounter
set state "consumeBraces"
} elseif {$type == "rightbrace"} {
set keepMachine 0
}
} elseif {$state == "consumeBraces"} {
if {$type == "leftbrace"} {
incr bracesCounter
} elseif {$type == "rightbrace"} {
incr bracesCounter -1
if {$bracesCounter == 0} {
set state "root"
}
}
}
}
if {$keepMachine} {
lappend machinesToKeep $m
}
}
set machines $machinesToKeep
set prev2 $prev1
set prev1 $type
}
}