From b9591fad29082250c0e688603c0400483f016dd0 Mon Sep 17 00:00:00 2001 From: Miro <200482516+Mirochill@users.noreply.github.com> Date: Mon, 25 May 2026 20:33:05 +0200 Subject: [PATCH] docs: clarify ignored terminals with LALR --- docs/grammar.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/grammar.md b/docs/grammar.md index b136bd2f5..11ad4f546 100644 --- a/docs/grammar.md +++ b/docs/grammar.md @@ -272,6 +272,10 @@ Using the `%ignore` directive results in a cleaner grammar. It's especially important for the LALR(1) algorithm, because adding whitespace (or comments, or other extraneous elements) explicitly in the grammar, harms its predictive abilities, which are based on a lookahead of 1. +When using LALR, ignored terminals are skipped by the lexer before parsing. +Because of that, ignored terminals should not be referenced from LALR rules when their position matters. +Earley can still use such a reference to require an ignored terminal at a specific position, but that behavior is currently a missing feature in LALR. + **Syntax:** ```html %ignore