summaryrefslogtreecommitdiffstats
path: root/assets/syntaxes/02_Extra/Robot.sublime-syntax
blob: 6805c2bb375dc64e44570a8baaa9acce792c10f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Robot Framework
file_extensions:
  - robot
scope: source.robot
contexts:
  main:
    - match: '\$\{(\d+|\d+\.\d*|0[bB][01]+|0[oO][0-7]+|0[xX][0-9a-fA-F]+)\}'
      comment: "Robot Framework numbers, like ${1} or ${12.3}"
      scope: constant.numeric.robot
    - match: '(?i)(%\{[\w|\s]+\})'
      comment: "Robot Framework environment variable, like %{USER}"
      scope: variable.parameter.robot
    - match: '((?<!\\)|(?<=\\\\))[$&]{'
      comment: Robot Framework scalar and dictionary variables
      push:
        - meta_scope: entity.name.class
        - match: '\}'
          pop: true
    - match: '((?<!\\)(@{)|(?<=\\\\)(@{))'
      comment: Robot Framework list variables
      push:
        - meta_scope: entity.name.class
        - match: '(}\[.+])|(})'
          pop: true
    - match: '(?i)^(\|\s*)?(\*{1,3} ?)(settings?|variables?|keywords?|test cases?)( ?\*{1,3})?(\s*\|)?'
      comment: Robot Framework data tables
      scope: string.robot.header
    - match: '(?i)(^\|\s*)?\[?Documentation\]?\s+'
      comment: Test case, keyword and settings table documentation
      push:
        - meta_scope: comment
        - match: ^(?!\s*+\.\.\.)
          pop: true
    - match: '(^| {2,}|\t|\\| {1,})(?<!\\\\)#'
      comment: Comment character
      push:
        - meta_scope: comment
        - match: $
          pop: true
    - match: '(?i)\s+\[(Tags|Setup|Teardown|Template|Timeout|Arguments|Return)\]'
      comment: Tests case and keyword settings
      scope: storage.type
    - match: (?i)^(\|\s*)?(Library|Resource|Test Timeout|Test Template|Test Teardown|Test Setup|Default Tags|Force Tags|Metadata|Variables|Suite Setup|Suite Teardown)(?:(  )|( \| ))
      comment: Settings table settings, like Library
      scope: constant.language
    - match: '^(\|\s+)?(?!^\.{3})(?![\|$&])\S+'
      comment: Keywords and test cases
      push:
        - meta_scope: keyword.control.robot
        - match: '($|\||\s{2,})'
          pop: true
    - match: (?i)^\s+(Given|When|and|but|Then)
      comment: BDD keywords
      scope: string.robot.bdd