Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

kometenstaub/lang-criticmarkup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Criticmarkup lezer grammar

This is a criticmarkup lezer grammar.

The characters for strings are taken from here.

Usage

It has Addition, Deletion, Comment, Highlight and Substitution nodes. Those are the full nodes. That means for working with the text, you need to parse the individual nodes.

  • Remove the 3 characters at the beginning and end
  • Substitutions have a DivideSubs in the middle which is part of the tree.
  • A Highlight is only a highlight. If the intention is to have a comment with it, you need to check whether a comment follows immediately.

The tests are passing.

Instructions

Things you'll need to do (see the language support example for a more detailed tutorial):

  • git grep EXAMPLE and replace all instances with your language name.

  • Rewrite the grammar in src/syntax.grammar to cover your language. See the Lezer system guide for information on this file format.

  • Adjust the metadata in src/index.ts to work with your new grammar. (I only removed properties, do we need to add custom properties?)

  • Adjust the grammar tests in test/cases.txt.

  • Build (npm run prepare) and test (npm test). (needs to be done each time the grammar is changed)

  • Rewrite this readme file.

  • Optionally add a license.

  • Publish. If you want to use a @codemirror/lang-... package name, open an issue to ask for npm publish rights for that name.