Table of Contents

Semantic Predicate / Guard Function

About

Semantic Predicate are boolean expressions that enable or disable the rule that follows.

They are written in the target language making the grammar language dependent

Example

RegularExpressionLiteral : {isRegexPossible()}? '/' RegularExpressionBody '/' RegularExpressionFlags ;

Python

TEXT : {self._input.LA(-1) == ord('[')}? ~[\])]+ ;

where:

Usage

Documentation / Reference