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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of GtkSourceView
Author: Jeffery To <jeffery.to@gmail.com>
Copyright (C) 2019-2020 Jeffery To <jeffery.to@gmail.com>
GtkSourceView is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
GtkSourceView is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<language id="typescript-js-mod" name="TypeScript JavaScript Module Additions" version="2.0" _section="Script" hidden="true">
<!-- from js:identifier-char -->
<keyword-char-class>(?!\x{2E2F})[\p{L}\p{Nl}\x{1885}-\x{1886}\x{2118}\x{212E}\x{309B}-\x{309C}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{00B7}\x{0387}\x{1369}-\x{1371}\x{19DA}$\x{200C}\x{200D}]</keyword-char-class>
<definitions>
<!--
See typescript.lang for general notes, naming conventions, etc.
-->
<!-- # Export declaration -->
<!-- ## Export as namespace (UMD module definition)
export as namespace myModule;
-->
<context id="_export-as-namespace-keyword" style-ref="js:keyword" once-only="true">
<match>\%{typescript:namespace-keyword}</match>
</context> <!-- /_export-as-namespace-keyword -->
<context id="_ordered-export-as-namespace-keyword" once-only="true">
<start>\%{js:before-next-token}</start>
<end>\%{js:before-next-token}</end>
<include>
<context ref="_export-as-namespace-keyword"/>
</include>
</context> <!-- /_ordered-export-as-namespace-keyword -->
<context id="_choice-export-as-namespace" end-parent="true">
<start>\%{js:as-keyword}</start>
<end>\%{js:statement-end}</end>
<include>
<context sub-pattern="0" where="start" style-ref="js:keyword"/>
<context ref="js:comments"/>
<context id="_export-as-namespace-content">
<include>
<context ref="_ordered-export-as-namespace-keyword"/>
<context ref="js:ordered-identifier"/>
</include>
</context> <!-- /_export-as-namespace-content -->
</include>
</context> <!-- /_choice-export-as-namespace -->
<!-- ## Export assignment
export = obj;
-->
<!-- <ExportAssignment> -->
<context id="_choice-export-assignment" end-parent="true">
<start>=</start>
<end>\%{js:statement-end}</end>
<include>
<context ref="js:comments"/>
<context id="_export-assignment-content">
<include>
<context ref="js:ordered-identifier"/>
</include>
</context> <!-- /_export-assignment-content -->
</include>
</context> <!-- /_choice-export-assignment -->
<!-- ## Type-only export or export type alias declaration
type-only export:
export type { T };
export type { T } from './mod';
export type alias declaration:
export type Name = string;
-->
<context id="_choice-export-type-alias-declaration" style-ref="typescript:type-alias-declaration" end-parent="true">
<start>\%{js:before-next-token}</start>
<end>\%{js:statement-end}</end>
<include>
<context ref="js:comments"/>
<context ref="typescript-js-st:_type-alias-declaration-content"/>
</include>
</context> <!-- /_choice-export-type-alias-declaration -->
<context id="_choice-export-type-only-or-type-alias-declaration" end-parent="true">
<start>\%{typescript:type-keyword}</start>
<end>\%{js:before-next-token}</end>
<include>
<context sub-pattern="0" where="start" style-ref="typescript:type-keyword"/>
<context ref="js:comments"/>
<context id="_export-type-only-or-type-alias-declaration-content">
<include>
<context ref="js-mod:_choice-export-named"/>
<context ref="_choice-export-type-alias-declaration"/>
</include>
</context> <!-- /_export-type-only-or-type-alias-declaration-content -->
</include>
</context> <!-- /_choice-export-type-only-or-type-alias-declaration -->
<!-- ## Export declaration -->
<!-- replaces js-mod:_export-declaration-content -->
<context id="export-declaration-content">
<include>
<context ref="_choice-export-as-namespace"/>
<context ref="_choice-export-assignment"/>
<context ref="typescript-js-st:choice-ambient-declaration"/>
<context ref="typescript-js-st:choice-const-declaration"/>
<context ref="typescript-js-st:choice-enum-declaration"/>
<context ref="_choice-import-default-declaration"/> <!-- for import alias declaration -->
<context ref="typescript-js-st:choice-interface-declaration"/>
<context ref="typescript-js-st:choice-namespace-declaration"/>
<context ref="_choice-export-type-only-or-type-alias-declaration"/>
<context ref="js-mod:_export-declaration-content" original="true"/>
</include>
</context> <!-- /export-declaration-content -->
<!-- # Import declaration -->
<!-- ## Import alias / import require
import shortname = Long.Namespace.Name;
import mod = require("module");
even though these are not variations of import default,
we add these to import default because it matches an
identifier after the import keyword
-->
<context id="_choice-import-require" end-parent="true">
<start>\%{typescript:require-keyword}</start>
<end>\%{js:statement-end}</end>
<include>
<context sub-pattern="0" where="start" style-ref="js:keyword"/>
<context ref="js:comments"/>
<context id="_import-require-content">
<include>
<context id="_import-require-parameters-list" once-only="true">
<start>\(</start>
<end>\)</end>
<include>
<context ref="js:comments"/>
<context id="_import-require-parameters-list-content">
<include>
<context ref="typescript:js-ordered-string"/>
</include>
</context> <!-- /_import-require-parameters-list-content -->
</include>
</context> <!-- /_import-require-parameters-list -->
</include>
</context> <!-- /_import-require-content -->
</include>
</context> <!-- /_choice-import-require -->
<context id="_choice-import-alias" end-parent="true">
<start>\%{js:before-next-token}</start>
<end>\%{js:statement-end}</end>
<include>
<context ref="js:comments"/>
<context id="_import-alias-content">
<include>
<context ref="typescript:ordered-namespace-name"/>
</include>
</context> <!-- /_import-alias-content -->
</include>
</context> <!-- /_choice-import-alias -->
<context id="_choice-import-alias-or-require" end-parent="true">
<start>=</start>
<end>\%{js:before-next-token}</end>
<include>
<context ref="js:comments"/>
<context id="_import-alias-or-require-content">
<include>
<context ref="_choice-import-require"/>
<context ref="_choice-import-alias"/>
</include>
</context> <!-- /_import-alias-or-require-content -->
</include>
</context> <!-- /_choice-import-alias-or-require -->
<!-- ## Type-only import
import type T from './mod';
import type { A, B } from './mod';
import type * as Types from './mod';
-->
<context id="_choice-import-type-only" end-parent="true">
<start>\%{typescript:type-keyword}</start>
<end>\%{js:before-next-token}</end>
<include>
<context sub-pattern="0" where="start" style-ref="typescript:type-keyword"/>
<context ref="js:comments"/>
<context id="_import-type-only-content">
<include>
<context ref="js-mod:_choice-import-named"/>
<context ref="js-mod:_choice-all-as-namespace"/>
<context ref="js-mod:_choice-import-default"/>
</include>
</context> <!-- _import-type-only-content -->
</include>
</context> <!-- /_choice-import-type-only -->
<!-- ## Import default -->
<!-- replaces js-mod:_import-default-content -->
<context id="import-default-content">
<include>
<context ref="js:ordered-identifier"/>
<context ref="_choice-import-alias-or-require"/>
<context ref="js-mod:_choice-import-default-additional"/>
<context ref="js-mod:_choice-import-default-only"/>
</include>
</context> <!-- /import-default-content -->
<!-- this is like js-mod:import-declarations but only matches import
default (for import alias) -->
<context id="_choice-import-default-declaration" style-ref="js:export-import-declaration" end-parent="true">
<start>\%{js:import-keyword}</start>
<end>\%{js:before-next-token}</end>
<include>
<context sub-pattern="0" where="start" style-ref="js:keyword"/>
<context ref="js:comments"/>
<context id="_import-default-declaration-content">
<include>
<context ref="js-mod:_choice-import-default"/>
</include>
</context> <!-- /_import-default-declaration-content -->
</include>
</context> <!-- /_choice-import-default-declaration -->
<!-- replaces js-mod:_import-declaration-content -->
<context id="import-declaration-content">
<include>
<context ref="_choice-import-type-only"/>
<context ref="js-mod:_import-declaration-content" original="true"/>
</include>
</context> <!-- /import-declaration-content -->
</definitions>
</language>
|