Update parser.js

Changed functions for rules matching