private void checkCaseInsensitiveOption(Token optionID, GrammarAST valueAST, int parentType) {
		String optionName = optionID.getText();
		if (optionName.equals(Grammar.caseInsensitiveOptionName)) {
			String valueText = valueAST.getText();
			if (valueText.equals("true") || valueText.equals("false")) {
				boolean currentValue = Boolean.parseBoolean(valueText);
				if (parentType == ANTLRParser.GRAMMAR) {
					grammarCaseInsensitive = currentValue;
				}
				else {
					if (grammarCaseInsensitive == currentValue) {
						g.tool.errMgr.grammarError(ErrorType.REDUNDANT_CASE_INSENSITIVE_LEXER_RULE_OPTION,
								g.fileName, optionID, currentValue);
					}
				}
			}
			else {
				g.tool.errMgr.grammarError(ErrorType.ILLEGAL_OPTION_VALUE, g.fileName, valueAST.getToken(),
						optionName, valueText);
			}
		}
	}
Check option is appropriate for grammar, rule, subrule
tool/src/org/antlr/v4/semantics/BasicSemanticChecks.java