public String[] getRuleNames() {
		String[] result = new String[rules.size()];
		Arrays.fill(result, INVALID_RULE_NAME);
		for (Rule rule : rules.values()) {
			result[rule.index] = rule.name;
		}

		return result;
	}
Gets an array of rule names for rules defined or imported by the
grammar. The array index is the rule index, and the value is the name of
the rule with the corresponding {@link Rule#index}.

<p>If no rule is defined with an index for an element of the resulting
array, the value of that element is {@link #INVALID_RULE_NAME}.</p>

@return The names of all rules defined in the grammar.
tool/src/org/antlr/v4/tool/Grammar.java