-
Notifications
You must be signed in to change notification settings - Fork 0
/
Alan IF Transcript.sublime-syntax
82 lines (75 loc) · 3.46 KB
/
Alan IF Transcript.sublime-syntax
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
%YAML 1.2
---
# "Alan IF Transcript.sublime-syntax" v0.2.0 (2021-06-07) | Alan v3 beta6
# ==============================================================================
# Alan IF Transcript Syntax (for Alan IF games' commands scripts)
# ==============================================================================
# Syntax definition for Alan IF Adventures transcript files:
# -- https://www.alanif.se
# ------------------------------------------------------------------------------
# Adventure transcript files are recordings of an adventure gameplay, generated
# by the interpreter. Historically, Alan transcripts used the ".log" extension,
# but since this is a common extension shared by so many log files, Alan has now
# adopted ".a3t" as the official extension for its transcripts.
# Since this package introduced the ".a3log" arbitrary extension when there
# wasn't an official one, it will keep using both, at least for a grace period
# of a year or two, because ".a3log" has been adopted by various projects, and
# we want to allow them time to migrate to the new official extensions -- which
# won't be supported until the next Alan Beta release.
# The need to create a dedicated syntax is mainly due to the fact that Alan
# transcript files needs to be encoded in ISO-8859-1 in order to display
# correctly special chars (like accented letters), therefore Sublime Text must
# be made aware of the extension. But the syntax can also provide some basic
# syntax highlighting, and be associated to a theme, allowing users to customize
# its aesthetics.
# ------------------------------------------------------------------------------
# Copyright (c) Tristano Ajmone, 2018. MIT License.
# -- https://github.com/tajmone/sublime-alan-if
# ------------------------------------------------------------------------------
name: Alan IF Transcript
comment: Alan IF Adventure Transcript File
file_extensions:
- a3t
- a3log
scope: source.a3t
contexts:
main:
# --------------------------------------------------------------------------
# We're only going to syntax highlight the player input lines (ie, prompt,
# strings and comments) and leave the adventure output as is.
# --------------------------------------------------------------------------
- include: player_input
player_input:
- match: "^>"
scope: punctuation.definition.prompt.a3t
push:
- meta_scope: player-input.a3t
- include: comments
- include: strings
- match: $\n?
pop: true
##############################################################################
# #
# GENERIC REUSABLE CONTEXTS #
# #
##############################################################################
strings:
- match: '"'
scope: punctuation.definition.string.begin.a3t
push: inside_string
inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.a3t
- match: '\.'
scope: constant.character.escape.a3t
- match: '"'
scope: punctuation.definition.string.end.a3t
pop: true
comments:
# Comments begin with a ';' and finish at the end of the line.
- match: ';'
scope: punctuation.definition.comment.a3t
push:
- meta_scope: comment.line.semicolon.a3t
- match: $\n?
pop: true