Syntax highlighting using provided lexer


#1

Hi!

I need some small help with atom plugin development! :slight_smile:

Introduction

We are developing a new programming language and we would love to provide syntax highlighting for Atom. I don’t want, however, define grammar in text-mate like descriptor file, because we already provide standalone lexer / tokenizer. The lexer returns a simple descriptor, in pseudocode: [(Int, [String])], which is just a list of pairs - between word length and set of “tags” describing what class this particular text part belongs to.

The problem

I tried using markBufferRange and other similar functions, but it appears, they only allow me to highlight the background of the code. I want to run our tokenizer and translate it’s output to appropriate marker definitions, that Atom will understand and use just the same way it uses grammar descriptors under the hood.

The question

What is the best way to accomplish this task? Is there any public / internal API that I can hook into and plug in our lexer? I would be thankful for any hints and help in this topic!

We were reading trough similar topics, but we didn’t discover any solution yet. Topics that might be relative:


Cheers!