Permalink
Browse files

Ligatures checked against PragmataPro, Hasklig and Fira Code (#96)

* Ligatures checked against PragmataPro, Hasklig and Fira Code

* Implemented suggestions by 50Wliu

* Fix ternary matching

* Add test for the function applicator

* Update tests to match range rather ternary when scoping :
  • Loading branch information...
Libbum authored and sglyon committed Nov 29, 2016
1 parent 02cc5bc commit 4f249a64ffdb8133e7453cbc28f2573afd85016a
Showing with 37 additions and 14 deletions.
  1. +14 −10 grammars/julia.cson
  2. +23 −4 spec/julia-spec.coffee
@@ -218,25 +218,25 @@ repository:
name: "keyword.operator.arrow.julia"
}
{
match: "(?:\\.==|!=|\\.>=|\\.>=|\\.>|\\.<|==|\\.!=|\\.=|\\.!|<:|:>|>=|<=|>|<)"
name: "keyword.operator.relation.julia"
match: "(?::=|\\+=|-=|\\*=|//=|/=|\\.//=|\\./=|\\.\\*=|\\\\=|\\.\\\\=|\\^=|\\.\\^=|%=|\\.%=|÷=|\\.÷=|\\|=|&=|\\$=|<<=|>>=|>>>=|=(?!=))"
name: "keyword.operator.update.julia"
}
{
match: "(?::=|\\+=|-=|\\*=|//=|/=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=|=)"
name: "keyword.operator.update.julia"
match: "(?:<<|>>>|>>|\\.>>>|\\.>>|\\.<<)"
name: "keyword.operator.shift.julia"
}
{
match: "(?:===|\\.==|!==|!=|\\.>=|\\.>|\\.<|==|\\.!=|\\.=|\\.!|<:|:>|(?<!>)>=|(?<!<)<=|\\.<=|>|<)"
name: "keyword.operator.relation.julia"
}
{
match: "(?:\\s*::\\s*(?:(?:Union)?\\([^)]*\\)|[[:alpha:]_][[:word:]\u207A-\u209C!\u2032\\.]*(?:{(?:[^{}]|{(?:[^{}]|{[^{}]*})*})*})?))(?:\\.\\.\\.)?"
name: "support.type.julia"
}
{
match: "(?:\\?|:)"
match: "(?:\\?:)"
name: "keyword.operator.ternary.julia"
}
{
match: "(?:<<|>>)"
name: "keyword.operator.shift.julia"
}
{
match: "(?:\\|\\||&&|(?<![[:word:]])!)"
name: "keyword.operator.boolean.julia"
@@ -245,12 +245,16 @@ repository:
match: "(?::)"
name: "keyword.operator.range.julia"
}
{
match: "(?:\\|>)"
name: "keyword.operator.applies.julia"
}
{
match: "(?:\\||\\&|~)"
name: "keyword.operator.bitwise.julia"
}
{
match: "(?:\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^)"
match: "(?:\\+\\+|--|\\+|\\.\\+|-|\\.\\-|\\*|\\.\\*|//(?!=)|\\.//(?!=)|/|\\./|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^)"
name: "keyword.operator.arithmetic.julia"
}
{
@@ -123,7 +123,7 @@ describe "Julia grammar", ->
it "tokenizes symbols", ->
{tokens} = grammar.tokenizeLine(":à_b9!")
expect(tokens[0]).toEqual value: ":", scopes: ["source.julia", "keyword.operator.ternary.julia"]
expect(tokens[0]).toEqual value: ":", scopes: ["source.julia", "keyword.operator.range.julia"]
expect(tokens[1]).toEqual value: "à_b9!", scopes: ["source.julia", "constant.other.symbol.julia"]
it "tokenizes regular expressions", ->
@@ -322,17 +322,17 @@ describe "Julia grammar", ->
it "tokenizes symbols of `keyword.other`s", ->
{tokens} = grammar.tokenizeLine(':type')
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.ternary.julia"]
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.range.julia"]
expect(tokens[1]).toEqual value: 'type', scopes: ["source.julia", "constant.other.symbol.julia"]
it "tokenizes symbols of `storage.modifier`s", ->
{tokens} = grammar.tokenizeLine(':using')
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.ternary.julia"]
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.range.julia"]
expect(tokens[1]).toEqual value: 'using', scopes: ["source.julia", "constant.other.symbol.julia"]
it "tokenizes symbols of `keyword.control`s", ->
{tokens} = grammar.tokenizeLine(':else')
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.ternary.julia"]
expect(tokens[0]).toEqual value: ':', scopes: ["source.julia", "keyword.operator.range.julia"]
expect(tokens[1]).toEqual value: 'else', scopes: ["source.julia", "constant.other.symbol.julia"]
it "tokenizes variables ending in _type", ->
@@ -369,3 +369,22 @@ describe "Julia grammar", ->
expect(tokens[6]).toEqual value: ' ', scopes: ["source.julia"]
expect(tokens[7]).toEqual value: 'xᵢ₊₁', scopes: ["source.julia"]
expect(tokens[8]).toEqual value: "'", scopes: ["source.julia", "keyword.operator.transposed-variable.julia"]
it "tokenizes the function applicator", ->
{tokens} = grammar.tokenizeLine('[1:5;] |> x->x.^2 |> sum')
expect(tokens[0]).toEqual value: '[', scopes: ["source.julia", "meta.array.julia"]
expect(tokens[1]).toEqual value: '1', scopes: ["source.julia", "meta.array.julia", "constant.numeric.julia"]
expect(tokens[2]).toEqual value: ':', scopes: ["source.julia", "meta.array.julia", "keyword.operator.range.julia"]
expect(tokens[3]).toEqual value: '5', scopes: ["source.julia", "meta.array.julia", "constant.numeric.julia"]
expect(tokens[4]).toEqual value: ';', scopes: ["source.julia", "meta.array.julia"]
expect(tokens[5]).toEqual value: ']', scopes: ["source.julia", "meta.array.julia"]
expect(tokens[6]).toEqual value: ' ', scopes: ["source.julia"]
expect(tokens[7]).toEqual value: '|>', scopes: ["source.julia", "keyword.operator.applies.julia"]
expect(tokens[8]).toEqual value: ' x', scopes: ["source.julia"]
expect(tokens[9]).toEqual value: '->', scopes: ["source.julia", "keyword.operator.arrow.julia"]
expect(tokens[10]).toEqual value: 'x', scopes: ["source.julia"]
expect(tokens[11]).toEqual value: '.^', scopes: ["source.julia", "keyword.operator.arithmetic.julia"]
expect(tokens[12]).toEqual value: '2', scopes: ["source.julia", "constant.numeric.julia"]
expect(tokens[13]).toEqual value: ' ', scopes: ["source.julia"]
expect(tokens[14]).toEqual value: '|>', scopes: ["source.julia", "keyword.operator.applies.julia"]
expect(tokens[15]).toEqual value: ' sum', scopes: ["source.julia"]

0 comments on commit 4f249a6

Please sign in to comment.