Skip to content

Commit

Permalink
Fix nested character classes. Remove $schema field. Remove redundant …
Browse files Browse the repository at this point in the history
…'special-identifier' rule.
  • Loading branch information
PanAeon committed Jun 7, 2019
1 parent 86f3239 commit 0be6724
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
33 changes: 14 additions & 19 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
"use strict";
import { TmLanguage } from "./TMLanguageModel";

const upperLetter = "[A-Z\\p{Lt}\\p{Lu}]"
const lowerLetter = "[_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}]"
const letter = `[${upperLetter}${lowerLetter}]`
const digit = "[0-9]"
const letterOrDigit = `${letter}|${digit}`
const upperLetterChars = "A-Z\\p{Lt}\\p{Lu}"
const upperLetter = `[${upperLetterChars}]`
const lowerLetterChars = "_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}"
const lowerLetter = `[${lowerLetterChars}]`
const letterChars = `${upperLetterChars}${lowerLetterChars}`
const letter = `[${letterChars}]`
const letterOrDigitChars = `${letterChars}0-9`
const letterOrDigit = `[${letterOrDigitChars}]`
const alphaId = `${letter}+`
const simpleInterpolatedVariable = `${letter}(?:${letterOrDigit})*` // see SIP-11 https://docs.scala-lang.org/sips/string-interpolation.html
const opchar = `[!#%&*+\\-\\/:<>=?@^|~[\\p{Sm}\\p{So}]]`
const idrest = `${letter}(?:${letterOrDigit})*(?:(?<=_)${opchar}+)?`
const idUpper = `${upperLetter}(?:${letterOrDigit})*(?:(?<=_)${opchar}+)?`
const idLower = `${lowerLetter}(?:${letterOrDigit})*(?:(?<=_)${opchar}+)?`
const plainid = `(?:${idrest}|(?:${opchar})+)`
const simpleInterpolatedVariable = `${letter}${letterOrDigit}*` // see SIP-11 https://docs.scala-lang.org/sips/string-interpolation.html
const opchar = `[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]`
const idrest = `${letter}${letterOrDigit}*(?:(?<=_)${opchar}+)?`
const idUpper = `${upperLetter}${letterOrDigit}*(?:(?<=_)${opchar}+)?`
const idLower = `${lowerLetter}${letterOrDigit}*(?:(?<=_)${opchar}+)?`
const plainid = `(?:${idrest}|${opchar}+)`
const backQuotedId = "`[^`]+`"


Expand Down Expand Up @@ -179,9 +182,6 @@ export const scalaTmLanguage: TmLanguage = {
{
include: '#scala-quoted'
},
{
include: '#special-identifier'
},
{
include: '#char-literal'
},
Expand All @@ -205,10 +205,6 @@ export const scalaTmLanguage: TmLanguage = {
}
]
},
'special-identifier': {
match: '\\b[_$a-zA-Z][_$a-zA-Z0-9]*(?:_[^\\t .,;()\\[\\]{}\'"`\\w])',
comment: 'Match special scala style identifiers that can end with and underscore and a a not letter such as blank_?. This way the symbol will not be colored differently.'
},
strings: {
patterns: [
{
Expand Down Expand Up @@ -918,7 +914,6 @@ export const scalaTmLanguage: TmLanguage = {
}
},
uuid: '158C0929-299A-40C8-8D89-316BE0C446E8',
"$schema" : "https://raw.githubusercontent.com/Septh/tmlanguage/master/tmLanguage.schema.json",
patterns: [
{
include: '#code'
Expand Down
Loading

0 comments on commit 0be6724

Please sign in to comment.