factor out common rules
add AttributesParser
add test for AttributesParser