Skip to content

Commit

Permalink
temporarily include syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
MattWindsor91 committed Mar 31, 2017
1 parent 92b35be commit c4cb92c
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions Starling.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
%YAML 1.2
---
name: Starling
file_extensions: [cvf]
scope: source.starling

variables:
environments: 'thread|shared'
basic_types: 'int|bool'
control_keywords: 'do|else|for|if|while'
identifier: '[_a-zA-Z]([_0-9a-zA-Z])*'

contexts:
prototype:
- include: comments

block_comment:
- meta_scope: comment.block.starling
- match: /\*
scope: punctuation.definition.comment.starling
push: block_comment
- match: \*/
pop: true

comments:
- match: //
scope: punctuation.definition.comment.starling
push:
- meta_scope: comment.line.double-slash.starling
- match: \n
pop: true
- match: /\*
scope: punctuation.definition.comment.starling
push: block_comment

typename:
- match: \b({{basic_types}})\b
scope: storage.type.starling
pop: true
- match: \b({{identifier}})\b
scope: entity.name.type.starling
pop: true

keywords:
- match: \b({{control_keywords}})\b
scope: keyword.control.starling
# temporary
- match: \b(view|pragma)\b
scope: keyword.control.starling

literals:
- match: \b([0-9]*(\.[0-9]+)?)\b
scope: constant.numeric
- match: \b(true|false)\b
scope: constant.language.boolean.starling

constraint_view:
- meta_content_scope: string.view.starling
- match: ->
scope: punctuation.other.constraint_entail.starling
pop: true

constraints:
- match: \b(constraint)\b
scope: keyword.other.starling
push: constraint_view

method_name:
- meta_content_scope: entity.name.function.starling
- match: \(
pop: true

methods:
- match: \b(method)\b
scope: keyword.other.method.starling
push: method_name

views:
- match: \{\|
scope: [meta.braces, punctuation.section.braces.begin]
push:
- meta_scope: string.view.starling
- match: \|\}
scope: [meta.braces, punctuation.section.braces.end]
pop: true

vardecl_after_typename:
- match: \b({{identifier}})\b
scope: variable.other.vardecl.starling
- match: \,
scope: punctuation.separator.vardecl.starling
- match: ;
scope: punctuation.terminator.vardecl.starling
pop: true

vardecls:
- match: \b({{environments}})\b
scope: storage.modifier.starling
set: [vardecl_after_typename, typename]

typedefs:
- match: \b(typedef)\b
scope: keyword.control.starling
set: [typename, typename]

main:
- include: types
- include: keywords
- include: literals
- include: constraints
- include: methods
- include: views
- include: vardecls
- include: typedefs

0 comments on commit c4cb92c

Please sign in to comment.