# Lezer

**URL:** https://discuss.codemirror.net/c/lezer/6.md

[Latest](https://discuss.codemirror.net/latest.md) · [Categories](https://discuss.codemirror.net/categories.md)

---

## [Discussion around the Lezer parser system](https://discuss.codemirror.net/t/discussion-around-the-lezer-parser-system/2105)

<div class="topic-metadata">

**Author:** [@marijn](https://discuss.codemirror.net/u/marijn)\
**Replies:** 0

</div>

This category is for discussion of the Lezer parser. Bug reports should go on GitHub.

---

## [Lezer/markdown GFM task not parsing paragraphs](https://discuss.codemirror.net/t/lezer-markdown-gfm-task-not-parsing-paragraphs/9915)

<div class="topic-metadata">

**Author:** [@superle3](https://discuss.codemirror.net/u/superle3)\
**Replies:** 2\
**Last updated:** [October 19, 2026, 3:27pm UTC](https://discuss.codemirror.net/t/lezer-markdown-gfm-task-not-parsing-paragraphs/9915 "2026-10-19T15:27:54Z")

</div>

from the spec GitHub Flavored Markdown Spec I didn’t see any adjustment to a task item such that they should be parsed differently than normal list items besides the initial task marker. but @lezer/markdown does parse i…

---

## [Supporting CJK-friendly emphasis in @lezer/markdown](https://discuss.codemirror.net/t/supporting-cjk-friendly-emphasis-in-lezer-markdown/9904)

<div class="topic-metadata">

**Author:** [@isunjn](https://discuss.codemirror.net/u/isunjn)\
**Replies:** 5\
**Last updated:** [October 7, 2026, 11:29am UTC](https://discuss.codemirror.net/t/supporting-cjk-friendly-emphasis-in-lezer-markdown/9904 "2026-10-07T11:29:58Z")

</div>

CommonMark’s flanking rules work poorly for Chinese, Japanese and Korean text. These languages don’t put spaces between words, so emphasis often ends with punctuation that is directly followed by a letter. The closing de…

---

## [always-reduce vs @skip](https://discuss.codemirror.net/t/always-reduce-vs-skip/9901)

<div class="topic-metadata">

**Author:** [@comments-are-importa](https://discuss.codemirror.net/u/comments-are-importa)\
**Replies:** 3\
**Last updated:** [September 29, 2026, 11:29pm UTC](https://discuss.codemirror.net/t/always-reduce-vs-skip/9901 "2026-09-29T23:29:23Z")

</div>

I started with the indentation example, but scaled back @skip considerably. my external margin token is the only thing left: @external tokens xt from "./support.ts" { dedent indent margin } @skip { margin } this seeme…

---

## [Proposal: use IELR(1) to speed up build of large parse tables](https://discuss.codemirror.net/t/proposal-use-ielr-1-to-speed-up-build-of-large-parse-tables/9898)

<div class="topic-metadata">

**Author:** [@Amarko](https://discuss.codemirror.net/u/Amarko)\
**Replies:** 1\
**Last updated:** [September 29, 2026, 9:00am UTC](https://discuss.codemirror.net/t/proposal-use-ielr-1-to-speed-up-build-of-large-parse-tables/9898 "2026-09-29T09:00:34Z")

</div>

IELR(1) is a straightfoward optimisation for building a LR(1) parser. Instead of building the canonical LR(1) automaton by copying every LR(0) state with every possible lookahead, we only copy the state when the lookahea…

---

## [Ignoring document portion during parsing](https://discuss.codemirror.net/t/ignoring-document-portion-during-parsing/9864)

<div class="topic-metadata">

**Author:** [@hrjakobsen](https://discuss.codemirror.net/u/hrjakobsen)\
**Replies:** 1\
**Last updated:** [August 14, 2026, 11:06am UTC](https://discuss.codemirror.net/t/ignoring-document-portion-during-parsing/9864 "2026-08-14T11:06:46Z")

</div>

Hi! We have a document that contains inline suggested-deletions. Something like “foo̶b̶a̶r̶baz”. In our editor we hide the deleted range completely, so it just looks like “foobaz”. This avoids awkward position mapping f…

---

## [ChordPro Environment grammar question](https://discuss.codemirror.net/t/chordpro-environment-grammar-question/9851)

<div class="topic-metadata">

**Author:** [@OTheNonE](https://discuss.codemirror.net/u/OTheNonE)\
**Replies:** 2\
**Last updated:** [August 6, 2026, 1:49pm UTC](https://discuss.codemirror.net/t/chordpro-environment-grammar-question/9851 "2026-08-06T13:49:58Z")

</div>

I am creating a lezer grammar for the ChordPro format. I am currently working on the Environment Directive. A start to an environment with label can be described in the following two ways: {start\_of\_verse: Verse 1} // …

---

## [Ambiguity problem in ChordPro (new question created)](https://discuss.codemirror.net/t/ambiguity-problem-in-chordpro-new-question-created/9850)

<div class="topic-metadata">

**Author:** [@OTheNonE](https://discuss.codemirror.net/u/OTheNonE)\
**Replies:** 0\
**Last updated:** [August 5, 2026, 11:49am UTC](https://discuss.codemirror.net/t/ambiguity-problem-in-chordpro-new-question-created/9850 "2026-08-05T11:49:54Z")

</div>

Ops! I created a new question as this was poorly described, and i described it way better in the new question. I am trying to create a parser for the ChordPro format. Currently i am struggling with ambiguity with envir…

---

## [FencedCode like structures and composite elements](https://discuss.codemirror.net/t/fencedcode-like-structures-and-composite-elements/9824)

<div class="topic-metadata">

**Author:** [@superle3](https://discuss.codemirror.net/u/superle3)\
**Replies:** 11\
**Last updated:** [July 8, 2026, 8:35am UTC](https://discuss.codemirror.net/t/fencedcode-like-structures-and-composite-elements/9824 "2026-07-08T08:35:59Z")

</div>

I am trying to add math parser to @lezer/markdown and use the latex parser with parseMixed to parse it afterwards just like is done with FencedCode. In particular the block display math that spans multiple lines and beh…

---

## [parseMixed with existing packages](https://discuss.codemirror.net/t/parsemixed-with-existing-packages/9797)

<div class="topic-metadata">

**Author:** [@slashinfty](https://discuss.codemirror.net/u/slashinfty)\
**Replies:** 6\
**Last updated:** [June 16, 2026, 1:01pm UTC](https://discuss.codemirror.net/t/parsemixed-with-existing-packages/9797 "2026-06-16T13:01:35Z")

</div>

I would like to use CodeMirror’s markdown language as the main language of the editor, but implement parseMixed with TeXlyre’s LaTeX language, which has its own existing grammar. The goal (and assumption) is that LaTeX w…

---

## [Create autocomplete from grammar terms](https://discuss.codemirror.net/t/create-autocomplete-from-grammar-terms/9774)

<div class="topic-metadata">

**Author:** [@LucasWijk](https://discuss.codemirror.net/u/LucasWijk)\
**Replies:** 2\
**Last updated:** [June 4, 2026, 9:15am UTC](https://discuss.codemirror.net/t/create-autocomplete-from-grammar-terms/9774 "2026-06-04T09:15:06Z")

</div>

The grammar already contains the syntactic structure of the language. And when you create a parser from the grammar, a list of terms is also created. These terms appear in the syntax tree that the parser produces. I was…

---

## [How to fix shift/reduce conflict using GLR](https://discuss.codemirror.net/t/how-to-fix-shift-reduce-conflict-using-glr/9756)

<div class="topic-metadata">

**Author:** [@LucasWijk](https://discuss.codemirror.net/u/LucasWijk)\
**Replies:** 1\
**Last updated:** [May 22, 2026, 9:43pm UTC](https://discuss.codemirror.net/t/how-to-fix-shift-reduce-conflict-using-glr/9756 "2026-05-22T21:43:46Z")

</div>

@top Program { line\* } line { DerivativeLine | AssignmentLine | Newline } DerivativeLine { DPrefix NumeratorVar Slash DPrefix DenominatorVar Equals Expression } AssignmentLine { AssignmentVar Equals Expression …

---

## [How to get access to tokens that were consumed when a specific grammar production matched?](https://discuss.codemirror.net/t/how-to-get-access-to-tokens-that-were-consumed-when-a-specific-grammar-production-matched/9723)

<div class="topic-metadata">

**Author:** [@shche](https://discuss.codemirror.net/u/shche)\
**Replies:** 2\
**Last updated:** [May 4, 2026, 9:14am UTC](https://discuss.codemirror.net/t/how-to-get-access-to-tokens-that-were-consumed-when-a-specific-grammar-production-matched/9723 "2026-05-04T09:14:46Z")

</div>

I am working on a parser for Wolfram language. It has Out operator (Out—Wolfram Documentation), which can take different forms, including %%…% (% repeated arbitrary number of times). I can write %, or %1, %%%, etc. I ha…

---

## [GraphQL grammar](https://discuss.codemirror.net/t/graphql-grammar/2323)

<div class="topic-metadata">

**Author:** [@NetOperatorWibby](https://discuss.codemirror.net/u/NetOperatorWibby)\
**Replies:** 3\
**Last updated:** [April 28, 2026, 12:54am UTC](https://discuss.codemirror.net/t/graphql-grammar/2323 "2026-04-28T00:54:27Z")

</div>

Hi there! I am currently working on a GraphiQL alternative that trades React for Svelte and also uses CodeMirror 6. The variables and results panes are rendering just fine but the query pane needs a bit more work, mainl…

---

## [parsing error when production uses repetition operator](https://discuss.codemirror.net/t/parsing-error-when-production-uses-repetition-operator/9720)

<div class="topic-metadata">

**Author:** [@shche](https://discuss.codemirror.net/u/shche)\
**Replies:** 7\
**Last updated:** [April 23, 2026, 11:48am UTC](https://discuss.codemirror.net/t/parsing-error-when-production-uses-repetition-operator/9720 "2026-04-23T11:48:38Z")

</div>

I have a grammar that skips \`\\n\` tokens: @skip { newline } But I need to recognize expressions separated by newlines: implicitCompoundExpression\[@name="CompoundExpression"\] { expr eLineBreakCharSeparator implicitC…

---

## [The same code yields different parsing results.](https://discuss.codemirror.net/t/the-same-code-yields-different-parsing-results/9710)

<div class="topic-metadata">

**Author:** [@Toly](https://discuss.codemirror.net/u/Toly)\
**Replies:** 6\
**Last updated:** [April 8, 2026, 2:46am UTC](https://discuss.codemirror.net/t/the-same-code-yields-different-parsing-results/9710 "2026-04-08T02:46:12Z")

</div>

I am writing unit tests for my grammar file. import { parser } from ‘../src-gen/LanguageParser’; describe(‘Grammar Tests’, () =\> { it(‘Single test’, () =\> { const code = \`&ACCESS RVP &REL 427 &COMMENT DAUERLAUF TEST…

---

## [Lezer testing for error nodes](https://discuss.codemirror.net/t/lezer-testing-for-error-nodes/9651)

<div class="topic-metadata">

**Author:** [@jnavb](https://discuss.codemirror.net/u/jnavb)\
**Replies:** 5\
**Last updated:** [April 7, 2026, 8:15am UTC](https://discuss.codemirror.net/t/lezer-testing-for-error-nodes/9651 "2026-04-07T08:15:46Z")

</div>

This is an example of code and the Ast from my lezer parser: code: foo. Ast: ObjectCreationExpression(Identifier,".",⚠) Is there a way to test this case with fileTests from @lezer/generator/dist/test ? I understand t…

---

## [Examples of using an External Tokenizer](https://discuss.codemirror.net/t/examples-of-using-an-external-tokenizer/9690)

<div class="topic-metadata">

**Author:** [@DougCube](https://discuss.codemirror.net/u/DougCube)\
**Replies:** 2\
**Last updated:** [February 28, 2026, 7:51pm UTC](https://discuss.codemirror.net/t/examples-of-using-an-external-tokenizer/9690 "2026-02-28T19:51:31Z")

</div>

I’m a very new user (to CodeMirror 6), so forgive my ignorance. Tho I do have experience with ANTLR and Flex/Bison/Yacc. Are there plenty of examples of creating and hooking up an external tokenizer somewhere? So far, w…

---

## [Question on disambiguation with undelimited sequences](https://discuss.codemirror.net/t/question-on-disambiguation-with-undelimited-sequences/9676)

<div class="topic-metadata">

**Author:** [@tiredstudent](https://discuss.codemirror.net/u/tiredstudent)\
**Replies:** 6\
**Last updated:** [February 15, 2026, 3:08pm UTC](https://discuss.codemirror.net/t/question-on-disambiguation-with-undelimited-sequences/9676 "2026-02-15T15:08:03Z")

</div>

Hi! I am working on a personal language project with Lezer. While I’ve gotten something to work, it’s hacky and I was wondering about the preferred approach for expressing something like below. variable : type = "value…

---

## [Lezer - GLR split not working](https://discuss.codemirror.net/t/lezer-glr-split-not-working/9663)

<div class="topic-metadata">

**Author:** [@fonsp](https://discuss.codemirror.net/u/fonsp)\
**Replies:** 1\
**Last updated:** [February 3, 2026, 6:18pm UTC](https://discuss.codemirror.net/t/lezer-glr-split-not-working/9663 "2026-02-03T18:18:07Z")

</div>

Hi! I am working on the Julia grammar: GitHub - JuliaPluto/lezer-julia: Julia parser for Lezer :slight\_smile: Problem I am struggling to get an ambiguity to work. There are two syntax patterns that I want to support: #…

---

## [syntaxTree update behavior when editing paragraphs under lists](https://discuss.codemirror.net/t/syntaxtree-update-behavior-when-editing-paragraphs-under-lists/9643)

<div class="topic-metadata">

**Author:** [@tiredstudent](https://discuss.codemirror.net/u/tiredstudent)\
**Replies:** 6\
**Last updated:** [January 6, 2026, 6:07pm UTC](https://discuss.codemirror.net/t/syntaxtree-update-behavior-when-editing-paragraphs-under-lists/9643 "2026-01-06T18:07:31Z")

</div>

Hi! I was encountering a codemirror view issue that only happened with block wrappers + syntax tree not being available on the current position, but the view issue was resolved by this recent patch, so thank you again t…

---

## [Lezer grammar support](https://discuss.codemirror.net/t/lezer-grammar-support/9626)

<div class="topic-metadata">

**Author:** [@ezntek](https://discuss.codemirror.net/u/ezntek)\
**Replies:** 5\
**Last updated:** [December 25, 2025, 1:36pm UTC](https://discuss.codemirror.net/t/lezer-grammar-support/9626 "2025-12-25T13:36:20Z")

</div>

@precedence { statement, assign, traceParams @cut, member @left, pow @right, times @left, plus @left, compare @left, equal @left, and @left, or @left } ArrayLiteral { "{" …

---

## [How to get input change ranges in \`createParse\`?](https://discuss.codemirror.net/t/how-to-get-input-change-ranges-in-createparse/9599)

<div class="topic-metadata">

**Author:** [@kxxt](https://discuss.codemirror.net/u/kxxt)\
**Replies:** 5\
**Last updated:** [December 7, 2025, 4:00pm UTC](https://discuss.codemirror.net/t/how-to-get-input-change-ranges-in-createparse/9599 "2025-12-07T16:00:52Z")

</div>

I have implemented a Parser for typst language not by writing lezer grammar but by modifying the official typst-syntax rust library and compile it to WebAssembly: GitHub - kxxt/codemirror-lang-typst: (Experimental) Typst…

---

## [Best way to find position where sub-language tree begins?](https://discuss.codemirror.net/t/best-way-to-find-position-where-sub-language-tree-begins/9563)

<div class="topic-metadata">

**Author:** [@paxfeline](https://discuss.codemirror.net/u/paxfeline)\
**Replies:** 2\
**Last updated:** [November 11, 2025, 5:32am UTC](https://discuss.codemirror.net/t/best-way-to-find-position-where-sub-language-tree-begins/9563 "2025-11-11T05:32:34Z")

</div>

Hello. I don’t have much experience with CodeMirror yet, but I love it. I am using CM as part of a simple online IDE. I would like to access the syntax trees generated by Lezer. For example, I want to access the syntax …

---

## [Indentation in Lezer](https://discuss.codemirror.net/t/indentation-in-lezer/9533)

<div class="topic-metadata">

**Author:** [@sirganya](https://discuss.codemirror.net/u/sirganya)\
**Replies:** 3\
**Last updated:** [October 13, 2025, 1:26pm UTC](https://discuss.codemirror.net/t/indentation-in-lezer/9533 "2025-10-13T13:26:26Z")

</div>

I have a Lezer grammar that is working. Is recognizes these expressions: expression { Modifier | StackModifier | Keyword | NotText } There is one word “background:” that can be a Modifier when indented and a keyw…

---

## [External tokenizer getting invoked too late](https://discuss.codemirror.net/t/external-tokenizer-getting-invoked-too-late/9423)

<div class="topic-metadata">

**Author:** [@dhrubomoy](https://discuss.codemirror.net/u/dhrubomoy)\
**Replies:** 5\
**Last updated:** [September 4, 2025, 9:22am UTC](https://discuss.codemirror.net/t/external-tokenizer-getting-invoked-too-late/9423 "2025-09-04T09:22:26Z")

</div>

I’m trying to match a string using an external tokenizer, but the function is being invoked too late. The Identifier token attempts to match first, which is expected behavior. However, the external tokenizer matches too …

---

## [\`lezer-generator\` errors/warnings contain 1-based lines and 0-based columns](https://discuss.codemirror.net/t/lezer-generator-errors-warnings-contain-1-based-lines-and-0-based-columns/9409)

<div class="topic-metadata">

**Author:** [@martijnwalraven](https://discuss.codemirror.net/u/martijnwalraven)\
**Replies:** 1\
**Last updated:** [September 1, 2025, 3:34pm UTC](https://discuss.codemirror.net/t/lezer-generator-errors-warnings-contain-1-based-lines-and-0-based-columns/9409 "2025-09-01T15:34:49Z")

</div>

I’m not sure whether this is an oversight or expected behavior, but the errors/warnings from lezer-generator seem to contain 1-based lines and 0-based columns as part of their message. This can lead to misleading context…

---

## [how to match special chars in external tokenizers](https://discuss.codemirror.net/t/how-to-match-special-chars-in-external-tokenizers/9407)

<div class="topic-metadata">

**Author:** [@dhrubomoy](https://discuss.codemirror.net/u/dhrubomoy)\
**Replies:** 2\
**Last updated:** [August 27, 2025, 9:04pm UTC](https://discuss.codemirror.net/t/how-to-match-special-chars-in-external-tokenizers/9407 "2025-08-27T21:04:33Z")

</div>

I am writing lezer grammar for a language where all keywords are case insensitive. I am following php style external tokenizer for that. However the problem arises when some keywords contain “#”, others contain “.”. I ge…

---

## [Guiding error recovery to better match brackets](https://discuss.codemirror.net/t/guiding-error-recovery-to-better-match-brackets/9402)

<div class="topic-metadata">

**Author:** [@jade-guiton](https://discuss.codemirror.net/u/jade-guiton)\
**Replies:** 1\
**Last updated:** [August 24, 2025, 9:01am UTC](https://discuss.codemirror.net/t/guiding-error-recovery-to-better-match-brackets/9402 "2025-08-24T09:01:15Z")

</div>

Hello! I’m trying to write a Lezer parser for a simple Lisp-like language, with the goal of using it for syntax highlighting in CodeMirror. I currently have the following grammar: @top Program { expression } expression …

---

## [Heap out of memory error when adding support for case insensitive keywords (lots of them)](https://discuss.codemirror.net/t/heap-out-of-memory-error-when-adding-support-for-case-insensitive-keywords-lots-of-them/9376)

<div class="topic-metadata">

**Author:** [@dhrubomoy](https://discuss.codemirror.net/u/dhrubomoy)\
**Replies:** 6\
**Last updated:** [August 22, 2025, 3:46pm UTC](https://discuss.codemirror.net/t/heap-out-of-memory-error-when-adding-support-for-case-insensitive-keywords-lots-of-them/9376 "2025-08-22T15:46:08Z")

</div>

Getting error “reached heap limit allocation failed - javascript heap out of memory” after running lezer-generator for a grammar where I needed to add lots of keywords (nearly a thousand). I have followed advice in this…

[Next page](https://discuss.codemirror.net/c/lezer/6.md?page=1)
