Please make constants instead of comments and 
BIT_LINE_ALLOWED = 1;
BIT_LINE_STRAIGHT_ALLOWED = 1 << 3;
BIT_LINE_SLIGHT_RIGHT = 1 << 4;

And please use these constant in code where your parse. The idea is to not have constants at all in the code and it should increase readability. One of thing that I read the code 3 times and I'm not sure I caught all details. I believe it is working and tested, but I'm afraid if something goes wrong, I will need to find you or completely rewrite.