Hi all,
The Limelight GRIP release (https://github.com/LimelightVision/GRIP) works really well for tracking items on the new Limelight 2019.3 release.
To improve the experience of using GRIP with the Limelight, I created a syntax definition for Sublime Text (I am working on a VSCode version) to highlight the output the Export option for Limelight in GRIP creates.
Here is the .sublime-syntax
definition file (I call it LLScript):
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: LLScript
file_extensions: [ll]
scope: source.ll
contexts:
# The only prototype usable throughout LLScript
# (i.e. not only in blocks) is comments.
# There are no block comments; only one-line comments.
prototype:
- include: comments
main:
# The main context in LLScript includes all functional syntax elements.
- include: keywords
- include: function-call
- include: numbers
- include: semicolons
- include: blocks
# These match using Sublime's bracket syntax checker.
- match: \{
push: brackets-check
- match: \(
push: brackets-check
- match: \[
push: brackets-check
- match: \}
scope: invalid.illegal.stray-bracket-end
- match: \)
scope: invalid.illegal.stray-bracket-end
- match: \]
scope: invalid.illegal.stray-bracket-end
keywords:
# Control keywords in LLScript are Inputs and Outputs.
- match: '\b(Inputs|Outputs)\b'
scope: keyword.control.ll
# Parameterized control keywords in LLScript are Steps.
# This regex was stolen from the C# syntax code for Sublime.
- match: '\b(Step)\s+((?:(?:\\u\h{4}|\\U\h{8})|[_\p{L}])(?:(?:\\u\h{4}|\\U\h{8})|[_0-9\p{L}])*\b)'
captures:
1: storage.type.class.ll
2: entity.name.class.ll
# This regex was stolen from the C syntax code for Sublime.
# It highlights integers, decimals, and doubles without catching numbers in
# variable names.
numbers:
- match: '\-*\b((0(x|X)[0-9a-fA-F]*(\.[0-9a-fA-F]+p-?\d+)?)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)([fF]|(l{1,2}|L{1,2})[uU]?|[uU](l{0,2}|L{0,2}))?\b'
scope: constant.numeric.ll
# This catches function calls of any type and highlights the whole function.
function-call:
- match: '(\w+)\s*\(\w.*\)[;]'
scope: variable.function.ll
# This catches semicolons. No real big item here.
semicolons:
- match: ';'
scope: punctuation.terminator.ll
# This catches commas. Again, no real big item here.
commas:
- match: ','
scope: punctuation.separator.ll
# Here are boolean values.
bools:
- match: '\b(true|false)\b'
scope: constant.language.ll
# These are the basic types that I know of.
# These most likely will need patching of some sort in the future.
types:
- match: '\b(Mat|ContoursReport|List|Point|Double|BorderType|Scalar|Boolean)\b'
scope: storage.type.ll
# Square brackets, stolen from C
square-brackets:
- match: '\['
scope: punctuation.section.brackets.begin.ll
push:
- meta_scope: meta.block.ll
- match: \]
scope: punctuation.section.brackets.end.ll
pop: true
- include: numbers
- include: commas
# Parentheses, stolen from C
parentheses:
- match: '\('
scope: punctuation.section.parens.begin.ll
push:
- meta_scope: meta.block.ll
- match: \)
scope: punctuation.section.parens.end.ll
pop: true
- include: numbers
- include: commas
# Constants, not stolen from C
constants:
- match: '\b(BORDER_CONSTANT|BORDER_REPLICATE|BORDER_REFLECT|BORDER_WRAP|BORDER_REFLECT_101|BORDER_TRANSPARENT|BORDER_REFLECT101|BORDER_DEFAULT|BORDER_ISOLATED)\b'
scope: support.constant.ll
# Blocks include all basic syntax features and also have the unique ability to be opened and closed.
blocks:
- match: \{
scope: punctuation.section.block.begin.ll
push:
- meta_scope: meta.block.ll
- match: '\}'
scope: punctuation.section.block.end.ll
pop: true
- include: function-call
- include: comments
- include: numbers
- include: semicolons
- include: square-brackets
- include: parentheses
- include: commas
- include: types
- include: bools
- include: constants
comments:
# Comments in LLScript begin with a '//' and finish at the end of the line.
- match: '//'
scope: punctuation.definition.comment.ll
push:
# This is an anonymous context push for brevity.
- meta_scope: comment.line.double-slash.ll
- match: $\n?
pop: true
brackets-check:
- match: \}
pop: true
- match: \)
pop: true
- match: \]
- include: main
Feel free to use it as you wish! I find that it makes it easier to adjust values quickly without firing up the special version of GRIP to fix values.