Stringing together contextual alternates

I don’t have to create rules for contextual alternates very often, so I’m not well-versed in setting up more complex systems.

For example, in screenshot 1 I have a standard A (line 1). I have a rule written that switches to an A with a left serif when it follows an L (see LA combination on line 2), and I have an alternate with a right serif if it precedes a letter with round shoulders (see AS combination on line 2). I also created an alternate with both the left and right serifs in case the A falls between an L and a letter with round shoulders (line 3).

As you can see in line 2 of screenshot 1, the LA substitution works fine, and the AS substitution works fine, but when I string all three together (line 4), it’s not activating that third alternate to satisfy both rules.

The last time I created contextual alternate functionality, I used lookups to create positional alternates, but I’m having trouble figuring out how to translate that tutorial to this example. I’ve attached what i’ve written so far for this particular example (screenshot 2).

The problem is, that when you reach the third rule, The A is not an A anymore, but has already been substituted in one of the previous rules. So you would have to substitute the version that has been substituted already, or, alternatively, you could put the longest contextual run into a separate lookup that comes before the other two.

Thanks so much for the tip. I suspected the problem was along that line of thought, I’m just slow organizing it in my head. I’ll keep playing with it.