add utility function endswith
when processing rule list, only generate guard/body/update methods