Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom property syntax #2534

Merged
merged 2 commits into from
Jan 14, 2018
Merged

Add support for custom property syntax #2534

merged 2 commits into from
Jan 14, 2018

Conversation

xzyfer
Copy link
Contributor

@xzyfer xzyfer commented Jan 13, 2018

I've been working on this on-and-off for the last couple months.
It's mostly a 1-1 port of the Ruby Sass implementation.

The only thing of interest is that the whitespace after the :
need to be captured as written for custom properties.

This PR does not handle some less significant features

Spec sass/sass-spec#1199
Fixes #2076

@xzyfer
Copy link
Contributor Author

xzyfer commented Jan 13, 2018

There are still a couple bugs to chase down, and some clean up but this is ready for some 👀

src/ast.cpp Outdated
{
return !(
is_custom_property() ||
value_ ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the check below will produce a segfault if the check above is not true, since the check below is only hit when value_ is NULL? Should this be a && logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally right, this was a last minute change.

@@ -673,6 +674,7 @@ namespace Sass {
is_important_(ptr->is_important_),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new property is not copied when cloning here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

src/inspect.cpp Outdated
@@ -123,6 +123,8 @@ namespace Sass {
if (dec->value()->concrete_type() == Expression::NULL_VAL) return;
bool was_decl = in_declaration;
in_declaration = true;
if (dec->is_custom_property()) in_custom_property = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use LOCAL_FLAG macro to ensure it is reset automatically when scope is left (e.g. due to thrown error).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

src/prelexer.cpp Outdated
negate< sequence<
exactly<'u'>,
exactly<'r'>,
exactly<'l'>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use url_kwd or maybe introduce a urlfn_kwd for reuse (seems we need both).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

src/prelexer.cpp Outdated
negate< sequence<
exactly<'u'>,
exactly<'r'>,
exactly<'l'>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use url_kwd or maybe introduce a urlfn_kwd for reuse (seems we need both).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@xzyfer xzyfer force-pushed the yolo branch 4 times, most recently from d306ef9 to cf8256c Compare January 14, 2018 03:21
@xzyfer
Copy link
Contributor Author

xzyfer commented Jan 14, 2018

CI is green

@mgreter
Copy link
Contributor

mgreter commented Jan 14, 2018

👍

@xzyfer xzyfer merged commit 52a242f into sass:master Jan 14, 2018
@xzyfer xzyfer deleted the yolo branch January 14, 2018 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants