forked from universal-ctags/ctags
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCSS: new parser based on @Roy-Orbison's work
Close universal-ctags#801. This is derrived from https://gist.github.com/Roy-Orbison/71bc81f488f85adaeacfb76a7967eda0. Some modifications are done to align the kind and the behavior of this parser to our css parser. Noteworthy changes from the original version: * The name of kind for "identifier" is changed to "id", * The pseudo kind is removed, (my comments at universal-ctags#801) * The parameter kind is added and * The parser captures variables defined at @for ... and @each ... TODO: * table optimizations, and * adding scope for parameters
- Loading branch information
Showing
22 changed files
with
459 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
remove-where input.scss /^@function remove-where($list, $condition) {$/;" f | ||
list input.scss /^@function remove-where($list, $condition) {$/;" z | ||
condition input.scss /^@function remove-where($list, $condition) {$/;" z | ||
new-list input.scss /^ $new-list: ();$/;" v | ||
separator input.scss /^ $separator: list-separator($list);$/;" v | ||
element input.scss /^ @each $element in $list {$/;" v | ||
new-list input.scss /^ $new-list: append($new-list, $element, $separator: $separator);$/;" v | ||
fonts input.scss /^$fonts: Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif;$/;" v | ||
contains-helvetica input.scss /^ @function contains-helvetica($string) {$/;" f | ||
string input.scss /^ @function contains-helvetica($string) {$/;" z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Taken from https://sass-lang.com/documentation/values/functions | ||
/// Return a copy of $list with all elements for which $condition returns `true` | ||
/// removed. | ||
@function remove-where($list, $condition) { | ||
$new-list: (); | ||
$separator: list-separator($list); | ||
@each $element in $list { | ||
@if not call($condition, $element) { | ||
$new-list: append($new-list, $element, $separator: $separator); | ||
} | ||
} | ||
@return $new-list; | ||
} | ||
|
||
$fonts: Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif; | ||
|
||
content { | ||
@function contains-helvetica($string) { | ||
@return str-index($string, "Helvetica"); | ||
} | ||
font-family: remove-where($fonts, get-function("contains-helvetica")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
reset-list input.scss /^@mixin reset-list {$/;" m | ||
horizontal-list input.scss /^@mixin horizontal-list {$/;" m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Taken from https://sass-lang.com/documentation/at-rules/mixin | ||
@mixin reset-list { | ||
margin: 0; | ||
padding: 0; | ||
list-style: none; | ||
} | ||
|
||
@mixin horizontal-list { | ||
@include reset-list; | ||
|
||
li { | ||
display: inline-block; | ||
margin: { | ||
left: -2px; | ||
right: 2em; | ||
} | ||
} | ||
} | ||
|
||
nav ul { | ||
@include horizontal-list; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.alert:hover input.scss /^.alert:hover, %strong-alert {$/;" c | ||
%strong-alert input.scss /^.alert:hover, %strong-alert {$/;" P | ||
%strong-alert:hover input.scss /^%strong-alert:hover {$/;" P | ||
%toolbelt input.scss /^%toolbelt {$/;" P | ||
.action-buttons input.scss /^.action-buttons {$/;" c | ||
.reset-buttons input.scss /^.reset-buttons {$/;" c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.alert:hover, %strong-alert { | ||
font-weight: bold; | ||
} | ||
|
||
%strong-alert:hover { | ||
color: red; | ||
} | ||
|
||
%toolbelt { | ||
box-sizing: border-box; | ||
border-top: 1px rgba(#000, .12) solid; | ||
padding: 16px 0; | ||
width: 100%; | ||
|
||
&:hover { border: 2px rgba(#000, .5) solid; } | ||
} | ||
|
||
.action-buttons { | ||
@extend %toolbelt; | ||
color: #4285f4; | ||
} | ||
|
||
.reset-buttons { | ||
@extend %toolbelt; | ||
color: #cddc39; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.alert input.scss /^.alert, .warning {$/;" c | ||
.warning input.scss /^.alert, .warning {$/;" c | ||
.modal-open input.scss /^.modal-open {$/;" c | ||
.modal input.scss /^ .modal {$/;" c | ||
foo input.scss /^ #foo {$/;" i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Taken from https://sass-lang.com/documentation/style-rules */ | ||
.alert, .warning { | ||
ul, p { | ||
margin-right: 0; | ||
margin-left: 0; | ||
padding-bottom: 0; | ||
} | ||
} | ||
|
||
/* Taken from _bodal.scss of bootstrap */ | ||
.modal-open { | ||
// Kill the scroll on the body | ||
overflow: hidden; | ||
|
||
.modal { | ||
overflow-x: hidden; | ||
overflow-y: auto; | ||
} | ||
|
||
#foo { | ||
color: red; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
base-color input.scss /^$base-color: #c6538c;$/;" v | ||
border-dark input.scss /^$border-dark: rgba($base-color, 0.88);$/;" v | ||
.alert input.scss /^.alert {$/;" c | ||
i input.scss /^@for $i from 1 through 3 {$/;" v | ||
sizes input.scss /^$sizes: 40px, 50px, 80px;$/;" v | ||
size input.scss /^@each $size in $sizes {$/;" v | ||
.icon- input.scss /^ .icon-#{$size} {$/;" c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Taken from https://sass-lang.com/documentation/variables | ||
$base-color: #c6538c; | ||
$border-dark: rgba($base-color, 0.88); | ||
|
||
.alert { | ||
border: 1px solid $border-dark; | ||
} | ||
|
||
// Taken from https://sass-lang.com/documentation/at-rules/control/for | ||
@for $i from 1 through 3 { | ||
ul:nth-child(3n + #{$i}) { | ||
background-color: lighten($base-color, $i * 5%); | ||
} | ||
} | ||
|
||
// Taken from https://sass-lang.com/documentation/at-rules/control/each | ||
$sizes: 40px, 50px, 80px; | ||
|
||
@each $size in $sizes { | ||
.icon-#{$size} { | ||
font-size: $size; | ||
height: $size; | ||
width: $size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,6 +124,7 @@ | |
RubyParser, \ | ||
RustParser, \ | ||
SchemeParser, \ | ||
SCSSParser, \ | ||
ShParser, \ | ||
SlangParser, \ | ||
SmlParser, \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.