First steps to build a language highlight


#1

hi all!
I wish try to build a package to highlight a new language.
the first steps are to color some words. how can I start?

thanks


#2

Is it a new syntax theme you want to create? In that case, this guide is a good starting point.


#3

thanks!
I’m looking the guide, but there’s a thing that I don’t understand:
I wish create a syntax theme for the .grog files for example, and following the guide, the grammar folder and the .cson file are not present


#4

Ah, you’ll want to create a grammar then, I assume.

Is that what you did and are missing the grammar folder?


#5

yes, I’ve looked a sql syntax for example, but there are some things that I don’t understand:


what is the scopeName?

the entity.name.function.sql what means? indicates the color to use for the regex match below?
where is declared?

thanks!


#6

Explanations and details here: http://manual.macromates.com/en/language_grammars


#7

thanks @thomasjo!
I’ve read and something more is ok!
but a question:
the entity.name.function.sql is for sql, if I need to use my entity.name.function.mat where I need to declare it?
thanks


#8

i’ve made this: that partially works:

'scopeName': 'source.mat'
'name': 'gRally Mat'
'fileTypes': [
  'mat'
]
'patterns': [
  {
    'match': '(?i)\\b(material)\\b'
    'name': 'storage.type.source.mat'
  }
  {
    'match': '(?i)\\b(ambient|diffuse|specular|emissive)\\b'
    'name': 'entity.name.function.mat'
  }
  {
    'match': '(?i)\\b(parent)\\b'
    'name': 'meta.scope.mat'
  }
  {
    'match': '(?i)\\b(diffuseMap|specMap|normalMap)\\b'
    'name': 'keyword.texture.mat'
  }
  {
    'begin': '(^[ \\t]+)?(?=//)'
    'beginCaptures':
      '1':
        'name': 'punctuation.whitespace.comment.leading.mat'
    'end': '(?!\\G)'
    'patterns': [
      {
        'begin': '//'
        'beginCaptures':
          '0':
            'name': 'punctuation.definition.comment.mat'
        'end': '\\n'
        'name': 'comment.line.double-dash.mat'
      }
    ]
  }
]
'repository':
  'block':
    'patterns': [
      {
        'begin': '{'
        'beginCaptures':
          '0':
            'name': 'punctuation.section.block.begin.source.mat'
        'end': '}'
        'endCaptures':
          '0':
            'name': 'punctuation.section.block.end.source.mat'
        'name': 'meta.block.source.mat'
        'patterns': [
          {
            'include': '#code'
          }
        ]
      }
    ]

but is there a repository to understand the colors of each pattern-name?
thanks again