Skip to content

Commit

Permalink
Merge commit 'dea27e5e3cc61a0d9f00ffa3f598a1080c6502d6' into parent-s…
Browse files Browse the repository at this point in the history
…elector

* commit 'dea27e5e3cc61a0d9f00ffa3f598a1080c6502d6': (32 commits)
  Add plugin.cpp example to contrib directory
  Fix small issue with relative path creation on windows
  Fix small formatting error in Readme.md
  Fix issue with mingw32 build
  Fix some comments in C-API
  Move rpm spec file into contrib folder
  Remove code left overs from debugging
  Fix regression introduced in "root parent selector error"
  change sass_atof to be thread safe
  Add local unaware atof function
  Improve sourcemap output for prepended texts
  Implement number prefix parsing (/[\+\-]+/)
  Add error for parent selectors in root blocks
  Fix interpolation in media queries
  Improve comment parsing
  Add another fix for media query boundaries
  Parse line comments in blocks
  Fix illegal extending when no blocks are found
  Fix illegal extending accross media blocks
  More improvements
  ...

Conflicts:
	ast.hpp
  • Loading branch information
Eric Kimn committed Mar 13, 2015
2 parents 829fef7 + dea27e5 commit e1f78c0
Show file tree
Hide file tree
Showing 50 changed files with 1,136 additions and 232 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Miscellaneous stuff

VERSION
.DS_Store
.sass-cache
*.gem
Expand Down
39 changes: 24 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,30 @@ else
ifneq (,$(findstring mingw32,$(MAKE)))
UNAME := MinGW
else
UNAME := $(shell uname -s)
ifneq (,$(findstring MINGW32,$(shell uname -s)))
UNAME = MinGW
else
UNAME := $(shell uname -s)
endif
endif
endif
endif

ifeq "$(LIBSASS_VERSION)" ""
ifneq "$(wildcard ./.git/ )" ""
LIBSASS_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
endif
ifneq "$(wildcard ./.git/ )" ""
LIBSASS_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags)
endif
endif

ifeq "$(LIBSASS_VERSION)" ""
ifneq ("$(wildcard VERSION)","")
LIBSASS_VERSION ?= $(shell $(CAT) VERSION)
endif
ifneq ("$(wildcard VERSION)","")
LIBSASS_VERSION ?= $(shell $(CAT) VERSION)
endif
endif

ifneq "$(LIBSASS_VERSION)" ""
CFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
CXXFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
CFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
CXXFLAGS += -DLIBSASS_VERSION="\"$(LIBSASS_VERSION)\""
endif

# enable mandatory flag
Expand All @@ -50,18 +54,18 @@ else
endif

ifneq "$(SASS_LIBSASS_PATH)" ""
CFLAGS += -I $(SASS_LIBSASS_PATH)
CXXFLAGS += -I $(SASS_LIBSASS_PATH)
CFLAGS += -I $(SASS_LIBSASS_PATH)
CXXFLAGS += -I $(SASS_LIBSASS_PATH)
endif

ifneq "$(EXTRA_CFLAGS)" ""
CFLAGS += $(EXTRA_CFLAGS)
CFLAGS += $(EXTRA_CFLAGS)
endif
ifneq "$(EXTRA_CXXFLAGS)" ""
CXXFLAGS += $(EXTRA_CXXFLAGS)
CXXFLAGS += $(EXTRA_CXXFLAGS)
endif
ifneq "$(EXTRA_LDFLAGS)" ""
LDFLAGS += $(EXTRA_LDFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)
endif

LDLIBS = -lstdc++ -lm
Expand All @@ -71,6 +75,11 @@ ifeq ($(UNAME),Darwin)
LDFLAGS += -stdlib=libc++
endif

ifneq (MinGW,$(UNAME))
LDFLAGS += -ldl
LDLIBS += -ldl
endif

ifneq ($(BUILD),shared)
BUILD = static
endif
Expand Down Expand Up @@ -103,7 +112,6 @@ SOURCES = \
constants.cpp \
context.cpp \
contextualize.cpp \
copy_c_str.cpp \
cssize.cpp \
error_handling.cpp \
eval.cpp \
Expand All @@ -117,6 +125,7 @@ SOURCES = \
emitter.cpp \
output.cpp \
parser.cpp \
plugins.cpp \
position.cpp \
prelexer.cpp \
remove_placeholders.cpp \
Expand Down
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ else
AM_CFLAGS += -fPIC
AM_CXXFLAGS += -fPIC
AM_CXXFLAGS += -std=c++0x
AM_LDFLAGS += -ldl
endif

AM_CFLAGS += -DLIBSASS_VERSION="\"$(VERSION)\""
Expand Down Expand Up @@ -54,7 +55,6 @@ libsass_la_SOURCES = \
constants.cpp constants.hpp \
context.cpp context.hpp \
contextualize.cpp contextualize.hpp \
copy_c_str.cpp copy_c_str.hpp \
error_handling.cpp error_handling.hpp \
eval.cpp eval.hpp \
expand.cpp expand.hpp \
Expand All @@ -68,6 +68,7 @@ libsass_la_SOURCES = \
emitter.cpp emitter.hpp \
output.cpp output.hpp \
parser.cpp parser.hpp \
plugins.cpp plugins.hpp \
prelexer.cpp prelexer.hpp \
remove_placeholders.cpp remove_placeholders.hpp \
sass.cpp sass.h \
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Our MIT license is designed to be as simple, and liberal as possible.
[@chriseppstein]: https://github.com/chriseppstein
[@nex3]: https://github.com/nex3

sass2scss was originally written by Marcel Greter [@mgreter]
sass2scss was originally written by [Marcel Greter](@mgreter)
and he happily agreed to have it merged into the project.

[sass_interface.h]: sass_interface.h
22 changes: 10 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ environment:
ruby_version: "21-x64"

cache:
- x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z
- C:\mingw64
- C:\Ruby%ruby_version%\lib\ruby\gems

install:
- git clone https://github.com/sass/sassc.git
- git clone https://github.com/sass/sass-spec.git
- set PATH=C:\Ruby%ruby_version%\bin;%PATH%
- set SASS_LIBSASS_PATH=..
- gem install minitest
- ps: |
if ($env:Compiler -eq "mingw") {
if (-Not (Test-Path "x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z")) {
# Install MinGW.
$url = "http://sourceforge.net/projects/mingw-w64/files/"
$url += "Toolchains%20targetting%20Win64/Personal%20Builds/"
$url += "mingw-builds/4.9.2/threads-win32/seh/"
$url += "x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z/download"
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z
}
if(!(gem which minitest 2>$nul)) { gem install minitest }
if ($env:Compiler -eq "mingw" -AND -Not (Test-Path "C:\mingw64")) {
# Install MinGW.
$url = "http://sourceforge.net/projects/mingw-w64/files/"
$url += "Toolchains%20targetting%20Win64/Personal%20Builds/"
$url += "mingw-builds/4.9.2/threads-win32/seh/"
$url += "x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z/download"
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z
&7z x -oC:\ x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z > $null
}
- set PATH=C:\mingw64\bin;%PATH%
Expand Down Expand Up @@ -71,4 +70,3 @@ test_script:
ruby sass-spec\sass-spec.rb -c win\bin\sassc.exe -s --ignore-todo sass-spec/spec
}
}
5 changes: 4 additions & 1 deletion ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,10 @@ namespace Sass {
{
if (!tail()) return 0;
if (!head()) return tail()->context(ctx);
return new (ctx.mem) Complex_Selector(pstate(), combinator(), head(), tail()->context(ctx));
Complex_Selector* cpy = new (ctx.mem) Complex_Selector(pstate(), combinator(), head(), tail()->context(ctx));
cpy->media_block(media_block());
cpy->last_block(last_block());
return cpy;
}

Complex_Selector* Complex_Selector::innermost()
Expand Down
31 changes: 22 additions & 9 deletions ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "ast_def_macros.hpp"
#include "ast_fwd_decl.hpp"
#include "to_string.hpp"
#include "source_map.hpp"

#include "sass.h"
#include "sass_values.h"
Expand Down Expand Up @@ -86,7 +87,6 @@ namespace Sass {
STRING,
LIST,
MAP,
SELECTOR,
NULL_VAL,
NUM_TYPES
};
Expand Down Expand Up @@ -410,7 +410,13 @@ namespace Sass {
At_Rule(ParserState pstate, string kwd, Selector* sel = 0, Block* b = 0)
: Has_Block(pstate, b), keyword_(kwd), selector_(sel), value_(0) // set value manually if needed
{ statement_type(DIRECTIVE); }
bool bubbles() { return true; }
bool bubbles() { return is_keyframes() || is_media(); }
bool is_media() {
return keyword_.compare("@-webkit-media") == 0 ||
keyword_.compare("@-moz-media") == 0 ||
keyword_.compare("@-o-media") == 0 ||
keyword_.compare("@media") == 0;
}
bool is_keyframes() {
return keyword_.compare("@-webkit-keyframes") == 0 ||
keyword_.compare("@-moz-keyframes") == 0 ||
Expand Down Expand Up @@ -1692,21 +1698,28 @@ namespace Sass {
/////////////////////////////////////////
// Abstract base class for CSS selectors.
/////////////////////////////////////////
class Selector : public Expression {
class Selector : public AST_Node {
ADD_PROPERTY(bool, has_reference);
ADD_PROPERTY(bool, has_placeholder);
// line break before list separator
ADD_PROPERTY(bool, has_line_feed);
// line break after list separator
ADD_PROPERTY(bool, has_line_break);
// maybe we have optional flag
ADD_PROPERTY(bool, is_optional);
// parent block pointers
ADD_PROPERTY(Block*, last_block);
ADD_PROPERTY(Media_Block*, media_block);
public:
Selector(ParserState pstate, bool r = false, bool h = false)
: Expression(pstate),
: AST_Node(pstate),
has_reference_(r),
has_placeholder_(h),
has_line_feed_(false),
has_line_break_(false)
{ concrete_type(SELECTOR); }
has_line_break_(false),
is_optional_(false),
media_block_(0)
{ }
virtual ~Selector() = 0;
// virtual Selector_Placeholder* find_placeholder();
virtual int specificity() { return Constants::SPECIFICITY_BASE; }
Expand Down Expand Up @@ -1957,9 +1970,9 @@ namespace Sass {
ADD_PROPERTY(Complex_Selector*, tail);
public:
Complex_Selector(ParserState pstate,
Combinator c,
Compound_Selector* h,
Complex_Selector* t)
Combinator c,
Compound_Selector* h,
Complex_Selector* t)
: Selector(pstate), combinator_(c), head_(h), tail_(t)
{
if ((h && h->has_reference()) || (t && t->has_reference())) has_reference(true);
Expand Down
5 changes: 1 addition & 4 deletions backtrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@

#include <sstream>

#include "position.hpp"

#ifndef SASS_FILE
#include "file.hpp"
#endif
#include "position.hpp"

namespace Sass {

Expand Down
Loading

0 comments on commit e1f78c0

Please sign in to comment.