package tm-grammars

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file tm_grammar_gn.ml

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
let lang_id = "gn"
let json = {json|{
  "displayName": "GN",
  "name": "gn",
  "patterns": [
    {
      "include": "#expression"
    }
  ],
  "repository": {
    "boolean": {
      "match": "\\b(true|false)\\b",
      "name": "constant.language.boolean.gn"
    },
    "builtins": {
      "patterns": [
        {
          "match": "\\b(action|action_foreach|bundle_data|copy|create_bundle|executable|generated_file|group|loadable_module|rust_library|rust_proc_macro|shared_library|source_set|static_library|target)\\b",
          "name": "support.function.gn"
        },
        {
          "match": "\\b(assert|config|declare_args|defined|exec_script|filter_exclude|filter_include|filter_labels_exclude|filter_labels_include|foreach|forward_variables_from|get_label_info|get_path_info|get_target_outputs|getenv|import|label_matches|not_needed|pool|print|print_stack_trace|process_file_template|read_file|rebase_path|set_default_toolchain|set_defaults|split_list|string_join|string_replace|string_split|template|tool|toolchain|write_file)\\b",
          "name": "support.function.gn"
        },
        {
          "match": "\\b(current_cpu|current_os|current_toolchain|default_toolchain|gn_version|host_cpu|host_os|invoker|python_path|root_build_dir|root_gen_dir|root_out_dir|target_cpu|target_gen_dir|target_name|target_os|target_out_dir)\\b",
          "name": "variable.language.gn"
        },
        {
          "match": "\\b(aliased_deps|all_dependent_configs|allow_circular_includes_from|arflags|args|asmflags|assert_no_deps|bridge_header|bundle_contents_dir|bundle_deps_filter|bundle_executable_dir|bundle_resources_dir|bundle_root_dir|cflags|cflags_cc??|cflags_objcc??|check_includes|code_signing_args|code_signing_outputs|code_signing_script|code_signing_sources|complete_static_lib|configs|contents|crate_name|crate_root|crate_type|data|data_deps|data_keys|defines|depfile|deps|externs|framework_dirs|frameworks|friend|gen_deps|include_dirs|inputs|ldflags|lib_dirs|libs|metadata|mnemonic|module_name|output_conversion|output_dir|output_extension|output_name|output_prefix_override|outputs|partial_info_plist|pool|post_processing_args|post_processing_outputs|post_processing_script|post_processing_sources|precompiled_header|precompiled_header_type|precompiled_source|product_type|public|public_configs|public_deps|rebase|response_file_contents|rustflags|script|sources|swiftflags|testonly|transparent|visibility|walk_keys|weak_frameworks|write_runtime_deps|xcasset_compiler_flags|xcode_extra_attributes|xcode_test_application_name)\\b",
          "name": "variable.language.gn"
        }
      ]
    },
    "call": {
      "begin": "\\b([A-Z_a-z][0-9A-Z_a-z]*)\\s*\\(",
      "beginCaptures": {
        "1": {
          "name": "entity.name.function.gn"
        }
      },
      "end": "\\)",
      "patterns": [
        {
          "include": "#expression"
        }
      ]
    },
    "comment": {
      "begin": "#",
      "end": "$",
      "name": "comment.line.number-sign.gn"
    },
    "expression": {
      "patterns": [
        {
          "include": "#keywords"
        },
        {
          "include": "#builtins"
        },
        {
          "include": "#call"
        },
        {
          "include": "#literals"
        },
        {
          "include": "#identifier"
        },
        {
          "include": "#operators"
        },
        {
          "include": "#comment"
        }
      ]
    },
    "identifier": {
      "match": "\\b[A-Z_a-z][0-9A-Z_a-z]*\\b",
      "name": "variable.general.gn"
    },
    "keywords": {
      "match": "\\b(if|else)\\b",
      "name": "keyword.control.if.gn"
    },
    "literals": {
      "patterns": [
        {
          "include": "#string"
        },
        {
          "include": "#number"
        },
        {
          "include": "#boolean"
        }
      ]
    },
    "number": {
      "match": "\\b-?\\d+\\b",
      "name": "constant.numeric.gn"
    },
    "operators": {
      "match": "\\b(\\+=??|==|!=|-=??|<=??|[!=>]|>=|&&|\\|\\|\\.)\\b",
      "name": "keyword.operator.gn"
    },
    "string": {
      "begin": "\"",
      "end": "\"",
      "name": "string.quoted.double.gn",
      "patterns": [
        {
          "match": "\\\\[\"$\\\\]",
          "name": "constant.character.escape.gn"
        },
        {
          "match": "\\$0x\\h\\h",
          "name": "constant.character.hex.gn"
        },
        {
          "begin": "\\$\\{",
          "beginCaptures": {
            "0": {
              "name": "punctuation.definition.template-expression.begin.gn"
            }
          },
          "contentName": "meta.embedded.substitution.gn",
          "end": "}",
          "endCaptures": {
            "0": {
              "name": "punctuation.definition.template-expression.end.gn"
            }
          },
          "patterns": [
            {
              "include": "#expression"
            }
          ]
        },
        {
          "captures": {
            "1": {
              "name": "punctuation.definition.template-expression.begin.gn"
            },
            "2": {
              "name": "meta.embedded.substitution.gn variable.general.gn"
            }
          },
          "match": "(\\$)([A-Z_a-z][0-9A-Z_a-z]*)"
        }
      ]
    }
  },
  "scopeName": "source.gn"
}|json}