Skip to content

Commit

Permalink
SCSS: Regexp simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Oct 22, 2017
1 parent bd19b04 commit c60b7d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions components/prism-scss.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ Prism.languages.scss = Prism.languages.extend('css', {
// this one was hard to do, so please be careful if you edit this one :)
'selector': {
// Initial look-ahead is used to prevent matching of blank selectors
pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,
pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()]|&|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}]+[:{][^}]+))/m,
inside: {
'parent': {
pattern: /&/,
alias: 'important'
},
'placeholder': /%[-_\w]+/,
'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
'placeholder': /%[-\w]+/,
'variable': /\$[-\w]+|#\{\$[-\w]+\}/
}
}
});
Expand All @@ -44,20 +44,20 @@ Prism.languages.insertBefore('scss', 'atrule', {
});

Prism.languages.scss.property = {
pattern: /(?:[\w-]|\$[-_\w]+|#\{\$[-_\w]+\})+(?=\s*:)/i,
pattern: /(?:[\w-]|\$[-\w]+|#\{\$[-\w]+\})+(?=\s*:)/i,
inside: {
'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
'variable': /\$[-\w]+|#\{\$[-\w]+\}/
}
};

Prism.languages.insertBefore('scss', 'important', {
// var and interpolated vars
'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
'variable': /\$[-\w]+|#\{\$[-\w]+\}/
});

Prism.languages.insertBefore('scss', 'function', {
'placeholder': {
pattern: /%[-_\w]+/,
pattern: /%[-\w]+/,
alias: 'selector'
},
'statement': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-scss.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c60b7d4

Please sign in to comment.