1%YAML 1.2
2---
3name: amber
4file_extensions: [amber]
5scope: source.amber
6contexts:
7  main:
8    # Strings begin and end with quotes, and use backslashes as an escape
9    # character
10    - match: '"'
11      scope: punctuation.definition.string.begin.amber
12      push: double_quoted_string
13
14    # Comments begin with a '#' and finish at the end of the line
15    - match: '#'
16      scope: punctuation.definition.comment.amber
17      push: line_comment
18
19    # Keywords
20    - match: '\b(END|SHADER|BUFFER|DATA_TYPE|SIZE|DATA|FILL|SERIES_FROM)\b'
21      scope: keyword.control.amber
22    - match: '\b(PASSTHROUGH|PIPELINE|ATTACH|ENTRY_POINT|DESCRIPTOR_SET|INC_BY)\b'
23      scope: keyword.control.amber
24    - match: '\b(BINDING|IDX|TO|RUN|DRAW_RECT|POS|DRAW_GRID|CELLS|DRAW_ARRAY|IN|AS|START_IDX)\b'
25      scope: keyword.control.amber
26    - match: '\b(COUNT|CLEAR_COLOR|CLEAR|EXPECT|TYPE|FRAMEBUFFER|SHADER_OPTIMIZATION)\b'
27      scope: keyword.control.amber
28    - match: '\b(FORMAT|FRAMEBUFFER_SIZE|BIND|SAMPLER|VERTEX_DATA|INDEX_DATA|INDEXED)\b'
29      scope: keyword.control.amber
30    - match: '\b(IMAGE_ATTACHMENT|DEPTH_STENCIL_ATTACHMENT|LOCATION|DEVICE_FEATURE)\b'
31      scope: keyword.control.amber
32    - match: '\b(DERIVE_PIPELINE|FROM|STD140|STD430)\b'
33      scope: keyword.control.amber
34    - match : '\b(COPY|TOLERANCE|REPEAT)\b'
35      scope: keyword.control.amber
36
37    - match: '\b(vertex|fragment|compute|geometry|tessellation_evaluation|tessellation_control|multi)\b'
38      scope: constant.character.escape.amber
39    - match: '\b(framebuffer|graphics)\b'
40      scope: constant.character.escape.amber
41    - match: '\b(uniform|storage|push_constant|color|depth_stencil)\b'
42      scope: constant.character.escape.amber
43    - match: '\b(EQ|NE|LT|LE|GT|GE|EQ_RGB|EQ_RGBA|EQ_BUFFER|RMSE_BUFFER)\b'
44      scope: constant.character.esape.amber
45    - match: '\b(GLSL|HLSL|SPIRV-ASM|SPIRV-HEX|OPENCL-C)\b'
46      scope: constant.character.escape.amber
47
48    - match: '\b(point_list|line_list|line_list_with_adjacency|line_strip)\b'
49      scope: entity.name.type.amber
50    - match: '\b(line_strip_with_adjacency|triangle_list|triangle_list_with_adjacency)\b'
51      scope: entity.name.type.amber
52    - match: '\b(triangle_strip|triangle_strip_with_adjacency|triangle_fan|patch_list)\b'
53      scope: entity.name.type.amber
54
55    - match: '\b(u?int\d*|float|double|vec\d*|mat\d*)\b'
56      scope: entity.name.type.amber
57
58    # Numbers
59    - match: '\b(-)?[0-9.]+\b'
60      scope: constant.numeric.amber
61
62  double_quoted_string:
63    - meta_scope: string.quoted.double.amber
64    - match: '\\.'
65      scope: constant.character.escape.amber
66    - match: '"'
67      scope: punctuation.definition.string.end.amber
68      pop: true
69
70  line_comment:
71    - meta_scope: comment.line.amber
72    - match: $
73      pop: true
74