New Grammar or Syntax?


#1

Hi there!
My team and I use Atom at work for translations, as the intuitiveness and syntax highlighting help us work within code more efficiently. One of the projects we work on uses a custom script with no existing grammar in Atom. My question is this: is it possible to create custom syntax highlighting for this script without creating a grammar as well? Basically the only thing I want the syntax to highlight is the strings, as that’s the only thing my translators need to worry about. If anyone could give me advice as to how to go about this, I would be eternally grateful.
Thank you!


#2

Syntax highlighting pretty much requires a grammar; I believe it’s possible to get the same effect with other API methods, but that’s more complicated than writing a grammar.

In your case, a minimal grammar might look like

# lang.cson
name: 'Language name'
scopeName: 'source.lang'
fileTypes: [ 'ext' ]

patterns: [
  {
    begin: '"'
    end: '"'
    name: 'string.lang'
  }
]

The folder structure is

language-lang
|- package.json
`- grammars
   `- lang.cson