fixes #735: add new, more efficient getTokens interfaces

This is a combination of 6 commits.
The first commit's message is:

add getTokensBefore and getTokensAfter interfaces (ref #735)

This is the 2nd commit message:

add getTokenBefore and getTokenAfter interfaces (ref #735)

This is the 3rd commit message:

add getFirstTokens and getLastTokens interfaces (ref #735)

This is the 4th commit message:

add getFirstToken and getLastToken interfaces (ref #735)

This is the 5th commit message:

expose new getTokens methods to rule context object

This is the 6th commit message:

make use of new getTokens methods in rules
Merge pull request #738 from michaelficarra/GH-735

fixes #735: add getTokensBefore, getTokensAfter, getTokensFirst, and getTokensLast interfaces