Skip to content

Commit

Permalink
Adopt '.a3s' and '.a3t' Extensions
Browse files Browse the repository at this point in the history
Adopt to the upcoming official extensions `.a3s` and `.a3t` for ALAN3
solution files and transcripts, respectively (see alan-if/alan#2), but
also preserve the old `.a3sol` and `.a3log` extensions (as secondary)
for a grace period, to allow projects that are using them enough time
to migrate.

Also change the scope of the Alan Solution and Transcript syntaxes from
`.a3sol` and `.a3log` to `.a3s` and `.a3t`, respectively, and update all
package files accordingly. (closes #1)
  • Loading branch information
tajmone committed May 5, 2021
1 parent f53eb32 commit 67652f4
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 80 deletions.
2 changes: 1 addition & 1 deletion Alan Solution Comments.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.a3sol</string>
<string>source.a3s</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
Expand Down
12 changes: 6 additions & 6 deletions Alan Solution.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// "Alan Solution.sublime-settings" v0.0.4 (2018-08-23) | Alan v3 beta6
// "Alan Solution.sublime-settings" v0.0.4 (2018-08-23) | Alan v3 beta6
// ------------------------------------------------------------------------------
// Sublime-Alan: Alan Solution files settings.
// ------------------------------------------------------------------------------
// Solution files are player commands script to run an Interactive Fiction
// adventure in automated mode. I've added to the Alan package a custom syntax
// definition for "Alan Solution" (with ".a3sol" extension) to ensure that they
// are automatically encoded in ISO-8859-1, otherwise Sublime Text will default
// to UTF-8 encoding, and they won't work with Alan adventures if the script
// contains special characters (like accented letters).
// definition for "Alan Solution" files (with ".a3s"/".a3sol" extension) to
// ensure that they are automatically encoded in ISO-8859-1, otherwise Sublime
// Text will default to UTF-8 encoding, and they won't work with Alan adventures
// if the script contains special characters (like accented letters).
{

// =========================================================================
Expand All @@ -23,7 +23,7 @@
"fallback_encoding": "Western (ISO 8859-1)",
// ... it looks like ISO 8859-1 has to be set as "fallback_encoding" too, in
// order to prevent lot's of problems with special characters, where ST will
// try to fallback on UTF-8 otherwise!
// try to fallback on UTF-8 otherwise!

// =========================================================================
// INDENTATION SETTINGS
Expand Down
29 changes: 17 additions & 12 deletions Alan Solution.sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
%YAML 1.2
---
# "Alan Solution.sublime-syntax" v0.0.2 (2018-08-22) | Alan v3 beta6
# "Alan Solution.sublime-syntax" v0.1.0 (2021-05-05) | Alan v3 beta6
# ==============================================================================
# Alan Solution Syntax (for Alan IF games' commands scripts)
# Alan Solution Syntax (for Alan IF games' commands scripts)
# ==============================================================================
# Syntax definition for Alan IF Adventures solution files:
# -- https://www.alanif.se
# ------------------------------------------------------------------------------
# Solution files (aka "commands scripts") are used for running an adventure via
# automated player-commands scripts. There is no official file extension for
# solution files, although usually they have the ".sol" extension; so I've chosen
# to arbitrarily adopt the ".a3sol" to create a unique extension for Alan.
# automated player-commands scripts. Alan is now adopting ".a3s" as the official
# file extension for solution files.
# Since this package introduced the ".a3sol" 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 ".a3sol" 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
# solution files need to be encoded in ISO-8859-1, therefore Sublime Text must
# be made aware of the extension. But the syntax can also provide some basic
Expand All @@ -23,8 +27,9 @@
name: Alan Solution
comment: Alan IF Adventure Solution File
file_extensions:
- a3s
- a3sol
scope: source.a3sol
scope: source.a3s

contexts:

Expand All @@ -34,23 +39,23 @@ contexts:

strings:
- match: '"'
scope: punctuation.definition.string.begin.a3sol
scope: punctuation.definition.string.begin.a3s
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.a3sol
- meta_scope: string.quoted.double.a3s
- match: '\.'
scope: constant.character.escape.a3sol
scope: constant.character.escape.a3s
- match: '"'
scope: punctuation.definition.string.end.a3sol
scope: punctuation.definition.string.end.a3s
pop: true

comments:
# Comments begin with a ';' and finish at the end of the line.
- match: ';'
scope: punctuation.definition.comment.a3sol
scope: punctuation.definition.comment.a3s
push:
- meta_scope: comment.line.semicolon.a3sol
- meta_scope: comment.line.semicolon.a3s
- match: $\n?
pop: true
2 changes: 1 addition & 1 deletion Alan Transcript Comments.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>source.a3log</string>
<string>source.a3t</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
Expand Down
5 changes: 1 addition & 4 deletions Alan Transcript.YAML-propertyList
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ settings:
# PROMPT
# ======
- name: Prompt
scope: punctuation.definition.prompt.a3log
scope: punctuation.definition.prompt
settings:
foreground: '#00a7df' # Cerulean
fontStyle: 'bold'
Expand All @@ -70,6 +70,3 @@ settings:
settings:
foreground: '#f8f8f8' # Alabaster
background: '#cc0066' # Hibiscus



2 changes: 1 addition & 1 deletion Alan Transcript.hidden-tmTheme
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<key>name</key>
<string>Prompt</string>
<key>scope</key>
<string>punctuation.definition.prompt.a3log</string>
<string>punctuation.definition.prompt</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
Expand Down
14 changes: 7 additions & 7 deletions Alan Transcript.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// "Alan Transcript.sublime-settings" v0.0.2 (2018-08-23) | Alan v3 beta6
// "Alan Transcript.sublime-settings" v0.0.2 (2018-08-23) | Alan v3 beta6
// ------------------------------------------------------------------------------
// Sublime-Alan: Alan Transcript files settings.
// ------------------------------------------------------------------------------
// Transcript files are recordings of an Interactive Fiction adventure gameplay,
// generated by the interpreter. I've added to the Alan package a custom syntax
// definition for "Alan Transcript" files (with ".a3log" extension) to ensure
// that they are automatically encoded in ISO-8859-1, otherwise Sublime Text
// will default to UTF-8 encoding, which would show incorrectly transcripts that
// contain special characters (like accented letters).
// definition for "Alan Transcript" files (with ".a3t"/".a3log" extension) to
// ensure that they are automatically encoded in ISO-8859-1, otherwise Sublime
// Text will default to UTF-8 encoding, which would show incorrectly transcripts
// that contain special characters (like accented letters).
{

// =========================================================================
Expand All @@ -23,8 +23,8 @@
"fallback_encoding": "Western (ISO 8859-1)",
// ... it looks like ISO 8859-1 has to be set as "fallback_encoding" too, in
// order to prevent lot's of problems with special characters, where ST will
// try to fallback on UTF-8 otherwise!
// try to fallback on UTF-8 otherwise!

// =========================================================================
// =========================================================================
// INDENTATION SETTINGS
Expand Down
37 changes: 21 additions & 16 deletions Alan Transcript.sublime-syntax
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
%YAML 1.2
---
# "Alan Transcript.sublime-syntax" v0.1.0 (2018-08-24) | Alan v3 beta6
# "Alan Transcript.sublime-syntax" v0.1.0 (2021-05-05) | Alan v3 beta6
# ==============================================================================
# Alan Transcript Syntax (for Alan IF games' commands scripts)
# Alan 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. Usually Alan transcript files have the ".log" extension,
# but since this is a common extension shared by so many log files, I've chosen
# to arbitrarily adopt ".a3log" as a unique extension for Alan.
# 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
Expand All @@ -24,8 +30,9 @@
name: Alan Transcript
comment: Alan IF Adventure Transcript File
file_extensions:
- a3t
- a3log
scope: source.a3log
scope: source.a3t

contexts:

Expand All @@ -38,9 +45,9 @@ contexts:

player_input:
- match: "^>"
scope: punctuation.definition.prompt.a3log
scope: punctuation.definition.prompt.a3t
push:
- meta_scope: player-input.a3log
- meta_scope: player-input.a3t
- include: comments
- include: strings
- match: $\n?
Expand All @@ -53,25 +60,23 @@ contexts:
##############################################################################
strings:
- match: '"'
scope: punctuation.definition.string.begin.a3log
scope: punctuation.definition.string.begin.a3t
push: inside_string

inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.a3log
- meta_scope: string.quoted.double.a3t
- match: '\.'
scope: constant.character.escape.a3log
scope: constant.character.escape.a3t
- match: '"'
scope: punctuation.definition.string.end.a3log
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.a3log
scope: punctuation.definition.comment.a3t
push:
- meta_scope: comment.line.semicolon.a3log
- meta_scope: comment.line.semicolon.a3t
- match: $\n?
pop: true


22 changes: 19 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGELOG

### 2021-05-05

Adopt new official Alan extensions: `.a3s` for solutions, and `.a3t` for transcripts (See [alan-if/alan#2]), but preserve the old custom extensions `.a3sol` and `.a3log` for a grace period, to allow projects that are using them to migrate to the new extensions.

- [`Alan Solution.sublime-syntax`][Alan Solution] v0.1.0:
+ Add `.a3s` as the main file extension.
+ Rename scope from `source.a3sol` to `source.a3s`.
- [`Alan Transcript.sublime-syntax`][AlanLog]
+ Add `.a3t` as the main file extension.
+ Rename scope from `source.a3log` to `source.a3t`.
- Update references to the their new scopes in all package files-

### 2019-01-16

- [`Alan.sublime-syntax`][Alan] v0.0.30 — __Ligatures__:
Expand Down Expand Up @@ -44,7 +56,7 @@
* `>=``` (Greater or equal)
* `<=``` (Less or equal)
* `==``` (String identity operator)
* `=>``` (Alt symbol for THEN)
* `=>``` (Alt symbol for THEN)

(_experimental_): tweaked comment definition to also treat `-->` as a comment delimiter, in order to support _long rightward arrow_ ligature (`⟶`) substitution of the delimiter.

Expand All @@ -67,7 +79,7 @@

### 2018-08-23

- Enforce ISO 8859-1 encoding as "fallback_encoding" too, to prevent ST from trying to use UTF-8 when special chars are encountered in the file. This setting seems to mitigate the problems relating to working with ISO 8859-1 file in Sublime Text — opening files seems to work better with this setting, but some problems still remain unsolved.
- Enforce ISO 8859-1 encoding as "fallback_encoding" too, to prevent ST from trying to use UTF-8 when special chars are encountered in the file. This setting seems to mitigate the problems relating to working with ISO 8859-1 file in Sublime Text — opening files seems to work better with this setting, but some problems still remain unsolved.

### 2018-08-22 (3)

Expand Down Expand Up @@ -409,7 +421,7 @@


<!-----------------------------------------------------------------------------
REFERENCE LINKS
REFERENCE LINKS
------------------------------------------------------------------------------>


Expand Down Expand Up @@ -486,4 +498,8 @@

[__@djspiewak's__ guidelines]: https://github.com/sublimehq/Packages/issues/757#issuecomment-269031562 "View @djspiewak's notes on writing syntaxes"

<!-- Issues ------------------------------------------------------------------>

[alan-if/alan#2]: https://github.com/alan-if/alan/issues/2

<!-- EOF -->
Loading

0 comments on commit 67652f4

Please sign in to comment.