Skip to content

Commit

Permalink
patch weird trig spacing rules
Browse files Browse the repository at this point in the history
  • Loading branch information
blake-regalia committed Dec 12, 2018
1 parent f296443 commit 50591f6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Each syntax highlighter reflects a complete implementation of the grammar specif
- Atom
- CodeMirror
- Emacs
- minted (LaTeX)

#### *Planned color theme support*
- *Suggestions?*
Expand Down
14 changes: 10 additions & 4 deletions src/ace/mode.jmacs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
/* global define */
define((require, exports, module) => {
const oop = require('../lib/oop');
const TextMode = require('./text').Mode;
const HighlightRules = require('./@{SYNTAX}_highlight_rules.js');
let a_imports = [
'ace/lib/oop',
'ace/mode/text_highlight_rules',
'ace/mode/sparql_highlight_rules',
];

require('brace').define('ace/mode/@{SYNTAX}', a_imports, (ace_require, exports, module) => {
const oop = ace_require('ace/lib/oop');
const TextMode = ace_require('ace/mode/text').Mode;
const HighlightRules = ace_require('ace/mode/@{SYNTAX}_highlight_rules').HighlightRules;
// let JavaFoldMode = require('./folding/java').FoldMode;

let Mode = function() {
Expand Down
13 changes: 9 additions & 4 deletions src/main/ace-syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ transform.build().then((k_syntax) => {
process.stdout.write(/* syntax: js */ `
/* global define */
define(function(require, exports, module) {
let a_imports = [
'ace/lib/oop',
'ace/mode/text_highlight_rules',
];
require('brace').define('ace/mode/sparql_highlight_rules', a_imports, function(ace_require, exports) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var oop = ace_require("ace/lib/oop");
var TextHighlightRules = ace_require("ace/mode/text_highlight_rules").TextHighlightRules;
function next_states(a_states) {
return function(s_state, a_stack) {
Expand Down Expand Up @@ -54,7 +59,7 @@ transform.build().then((k_syntax) => {
oop.inherits(SPARQLgraphyHighlightRules, TextHighlightRules);
exports.SPARQLgraphyHighlightRules = SPARQLgraphyHighlightRules;
exports.HighlightRules = SPARQLgraphyHighlightRules;
});
`);
});
2 changes: 1 addition & 1 deletion src/syntax/human-readable.sublime-syntax-source
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ variables:

whitespace: '\s+'

KEYWORD_BOUNDARY: '[\s{(\[*#$?^/"''\])}]'
KEYWORD_BOUNDARY: '[\s{(\[<*#$?^/"''>\])}]'

PN_CHARS_BASE: '[A-Za-z\x{00C0}-\x{00D6}\x{00D8}-\x{00F6}\x{00F8}-\x{02FF}\x{0370}-\x{037D}\x{037F}-\x{1FFF}\x{200C}-\x{200D}\x{2070}-\x{218F}\x{2C00}-\x{2FEF}\x{3001}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFFD}\x{10000}-\x{EFFFF}]'
PN_CHARS_U: '(?:{{PN_CHARS_BASE}}|_)'
Expand Down
11 changes: 10 additions & 1 deletion src/syntax/t-family.sublime-syntax-source
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,19 @@ contexts:

prefixDeclarationAt_AFTER_AT:
- _case: prefix
lookahead: '(?:{{KEYWORD_BOUNDARY}}|:)'
scope: storage.type.prefix.at.SYNTAX
set: [prefixDeclarationAt_TERMINATE, prefixDeclarationAt_AFTER_KEYWORD_SPACE, prefixDeclaration_AFTER_KEYWORD]
set: [prefixDeclarationAt_TERMINATE, prefixDeclarationAt_AFTER_KEYWORD_SPACE, prefixDeclaration_AFTER_KEYWORD_OPTIONAL]
- _throw: false

prefixDeclaration_AFTER_KEYWORD_OPTIONAL:
- meta_include_prototype: false
- match: '\s+'
scope: meta.whitespace.SYNTAX
pop: true
- include: prototype
- include: else_pop

prefixDeclarationAt_AFTER_KEYWORD_SPACE:
- _registeredPrefixDeclarations: at
- match: '(({{PN_PREFIX}}?)(:))'
Expand Down

0 comments on commit 50591f6

Please sign in to comment.