D14270: CoffeeScript: fix templates in embedded JavaScript code & add escapes
Nibaldo González
noreply at phabricator.kde.org
Sun Jul 22 09:59:12 BST 2018
nibags created this revision.
Restricted Application added projects: Kate, Frameworks.
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel.
nibags requested review of this revision.
REVISION SUMMARY
In CoffeeScript, the character ` (grave accent) is used to insert JavaScript code, but in JavaScript that same character is used for templates. The templantes in embedded JavaScript code are done by prefixing backslashes, as mentioned in the CoffeeScript documentation [1].
To do this I had to overwrite some JavaScript rules, since some contexts of `javascript.xml` contain` <IncludeRules context="Normal"/> `, where you can also insert templates.
I also added the escapes supported by CoffeeScript, which are the same as JavaScript [2], with the exception of the octal escapes.
All changes were tested using the CoffeeScript playground [3].
References:
- [1] CoffeeScript. Embedded JavaScript: https://coffeescript.org/#embedded
- [2] JavaScript escapes: https://mathiasbynens.be/notes/javascript-escapes#unicode-code-point
- [3] Try CoffeeScript: https://coffeescript.org/#try
REPOSITORY
R216 Syntax Highlighting
BRANCH
jsemb-coffeescript
REVISION DETAIL
https://phabricator.kde.org/D14270
AFFECTED FILES
autotests/folding/test.coffee.fold
autotests/html/test.coffee.html
autotests/input/test.coffee
autotests/reference/test.coffee.ref
data/syntax/coffee.xml
To: nibags
Cc: kwrite-devel, kde-frameworks-devel, michaelh, kevinapavew, ngraham, bruns, demsking, cullmann, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20180722/c8d53e52/attachment.html>
More information about the KWrite-Devel
mailing list