Refactor some syntax parsing