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

[WIP] Early preview of dart-sass parser backport #2918

Open
wants to merge 2 commits into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -53,6 +53,10 @@ libsass/*
*.lo
*.so
*.dll
*.h.gch
*.h.pch
*.hpp.gch
*.hpp.pch
*.a
*.suo
*.sdf
@@ -29,6 +29,7 @@ if ENABLE_TESTS

SASS_SASSC_PATH ?= $(top_srcdir)/sassc
SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
SASS_SPEC_ROOT ?= $(top_srcdir)/sass-spec

noinst_PROGRAMS = tester
tester_LDADD = src/libsass.la
@@ -49,6 +50,7 @@ AM_RB_LOG_FLAGS = $(RUBY)
SASS_TEST_FLAGS = --impl libsass
SASS_TEST_FLAGS += -r $(SASS_SPEC_PATH)/spec
SASS_TEST_FLAGS += -c $(top_srcdir)/tester$(EXEEXT)
SASS_TEST_FLAGS += --cmd-args "-I $(SASS_SPEC_ROOT)/spec"
AM_TESTS_ENVIRONMENT = TEST_FLAGS='$(SASS_TEST_FLAGS)'

SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb
@@ -16,14 +16,24 @@ CFLAGS ?= -Wall
CXXFLAGS ?= -Wall
LDFLAGS ?= -Wall
ifndef COVERAGE
CFLAGS += -O2
CXXFLAGS += -O2
LDFLAGS += -O2
CFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
CXXFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
LDFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
else
CFLAGS += -O1 -fno-omit-frame-pointer
CXXFLAGS += -O1 -fno-omit-frame-pointer
LDFLAGS += -O1 -fno-omit-frame-pointer
endif
ifeq "$(LIBSASS_GPO)" "generate"
CFLAGS += -fprofile-generate
CXXFLAGS += -fprofile-generate
LDFLAGS += -fprofile-generate -Wl,-fprofile-instr-generate
endif
ifeq "$(LIBSASS_GPO)" "use"
CFLAGS += -fprofile-use
CXXFLAGS += -fprofile-use
LDFLAGS += -fprofile-use -Wl,-fprofile-instr-use
endif
CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)

ifneq (,$(findstring /cygdrive/,$(PATH)))
@@ -175,6 +185,7 @@ endif
include Makefile.conf
OBJECTS = $(addprefix src/,$(SOURCES:.cpp=.o))
COBJECTS = $(addprefix src/,$(CSOURCES:.c=.o))
HEADOBJS = $(addprefix src/,$(HPPFILES:.hpp=.hpp.gch))
RCOBJECTS = $(RESOURCES:.rc=.o)

DEBUG_LVL ?= NONE
@@ -183,6 +194,7 @@ CLEANUPS ?=
CLEANUPS += $(RCOBJECTS)
CLEANUPS += $(COBJECTS)
CLEANUPS += $(OBJECTS)
CLEANUPS += $(HEADOBJS)
CLEANUPS += $(LIBSASS_LIB)

all: $(BUILD)
@@ -216,15 +228,18 @@ lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS) | lib
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) \
-s -Wl,--subsystem,windows,--out-implib,lib/libsass.a

%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

%.o: %.rc
$(RCOBJECTS): %.o: %.rc
$(WINDRES) -i $< -o $@

%.o: %.cpp
$(OBJECTS): %.o: %.cpp $(HEADOBJS)
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(COBJECTS): %.o: %.c $(HEADOBJS)
$(CC) $(CFLAGS) -c -o $@ $<

$(HEADOBJS): %.hpp.gch: %.hpp
$(CXX) $(CXXFLAGS) -x c++-header -c -o $@ $<

%: %.o static
$(CXX) $(CXXFLAGS) -o $@ $+ $(LDFLAGS) $(LDLIBS)

@@ -250,7 +265,6 @@ $(DESTDIR)$(PREFIX)/include/%.h: include/%.h \
$(INSTALL) -v -m0644 "$<" "$@"

install-headers: $(DESTDIR)$(PREFIX)/include/sass.h \
$(DESTDIR)$(PREFIX)/include/sass2scss.h \
$(DESTDIR)$(PREFIX)/include/sass/base.h \
$(DESTDIR)$(PREFIX)/include/sass/version.h \
$(DESTDIR)$(PREFIX)/include/sass/values.h \
@@ -4,9 +4,108 @@
# in parallel. But we also want to mix them a little too avoid
# heavy RAM usage peaks. Other than that the order is arbitrary.

HPPFILES = \
ast.hpp \
ast2c.hpp \
ast_css.hpp \
ast_base.hpp \
ast_def_macros.hpp \
ast_fwd_decl.hpp \
ast_helpers.hpp \
ast_selectors.hpp \
ast_containers.hpp \
ast_supports.hpp \
ast_values.hpp \
backtrace.hpp \
base64vlq.hpp \
c2ast.hpp \
character.hpp \
charcode.hpp \
color_maps.hpp \
constants.hpp \
context.hpp \
cssize.hpp \
dart_helpers.hpp \
debug.hpp \
debugger.hpp \
emitter.hpp \
environment.hpp \
error_handling.hpp \
memory.hpp \
memory/config.hpp \
memory/allocator.hpp \
memory/shared_ptr.hpp \
memory/memory_pool.hpp \
MurmurHash2.hpp \
eval.hpp \
evaluate.hpp \
extender.hpp \
extension.hpp \
file.hpp \
fn_colors.hpp \
fn_lists.hpp \
fn_maps.hpp \
fn_meta.hpp \
fn_numbers.hpp \
fn_selectors.hpp \
fn_strings.hpp \
fn_utils.hpp \
inspect.hpp \
interpolation.hpp \
logger.hpp \
json.hpp \
kwd_arg_macros.hpp \
listize.hpp \
randomize.hpp \
mapping.hpp \
operation.hpp \
operators.hpp \
ordered_map.hpp \
source.hpp \
output.hpp \
parser.hpp \
parser_base.hpp \
parser_css.hpp \
parser_expression.hpp \
parser_media_query.hpp \
parser_at_root_query.hpp \
parser_keyframe_selector.hpp \
parser_sass.hpp \
parser_scss.hpp \
parser_selector.hpp \
parser_stylesheet.hpp \
permutate.hpp \
plugins.hpp \
position.hpp \
offset.hpp \
remove_placeholders.hpp \
sass.hpp \
sass_context.hpp \
sass_functions.hpp \
sass_values.hpp \
scanner_line.hpp \
scanner_span.hpp \
scanner_string.hpp \
serialize.hpp \
source_map.hpp \
source_state.hpp \
source_span.hpp \
stylesheet.hpp \
units.hpp \
utf8_string.hpp \
util.hpp \
util_string.hpp \
values.hpp \
visitor_css.hpp \
visitor_expression.hpp \
visitor_selector.hpp \
visitor_statement.hpp \
visitor_value.hpp \
var_stack.hpp

SOURCES = \
ast.cpp \
ast_css.cpp \
ast_values.cpp \
ast_supports.cpp \
ast_sel_cmp.cpp \
@@ -17,56 +116,71 @@ SOURCES = \
context.cpp \
constants.cpp \
fn_utils.cpp \
fn_miscs.cpp \
fn_maps.cpp \
fn_lists.cpp \
fn_colors.cpp \
fn_numbers.cpp \
fn_strings.cpp \
fn_selectors.cpp \
fn_meta.cpp \
color_maps.cpp \
environment.cpp \
ast_fwd_decl.cpp \
bind.cpp \
file.cpp \
util.cpp \
util_string.cpp \
logger.cpp \
json.cpp \
units.cpp \
values.cpp \
plugins.cpp \
position.cpp \
lexer.cpp \
parser.cpp \
parser_selectors.cpp \
prelexer.cpp \
offset.cpp \
serialize.cpp \
eval.cpp \
eval_selectors.cpp \
expand.cpp \
evaluate.cpp \
listize.cpp \
randomize.cpp \
cssize.cpp \
extender.cpp \
extension.cpp \
stylesheet.cpp \
interpolation.cpp \
parser.cpp \
parser_css.cpp \
parser_base.cpp \
parser_scss.cpp \
parser_sass.cpp \
parser_selector.cpp \
parser_stylesheet.cpp \
parser_expression.cpp \
parser_media_query.cpp \
parser_at_root_query.cpp \
parser_keyframe_selector.cpp \
source.cpp \
output.cpp \
inspect.cpp \
emitter.cpp \
check_nesting.cpp \
scanner_span.cpp \
scanner_line.cpp \
scanner_string.cpp \
remove_placeholders.cpp \
sass.cpp \
sass_values.cpp \
sass_context.cpp \
sass_functions.cpp \
sass2scss.cpp \
backtrace.cpp \
operators.cpp \
ast2c.cpp \
c2ast.cpp \
to_value.cpp \
var_stack.cpp \
source_map.cpp \
source_state.cpp \
source_span.cpp \
error_handling.cpp \
memory/allocator.cpp \
memory/shared_ptr.cpp \
LUrlParser/LUrlParser.cpp \
utf8_string.cpp \
base64vlq.cpp

@@ -1,4 +1,4 @@
os: Visual Studio 2013
os: Visual Studio 2015

environment:
CTEST_OUTPUT_ON_FAILURE: 1
@@ -33,7 +33,7 @@ cache:

install:
- git clone https://github.com/sass/sassc.git
- git clone https://github.com/sass/sass-spec.git
- git clone https://github.com/mgreter/sass-spec.git --branch feature/libsass-parser-backport
- set PATH=C:\Ruby%ruby_version%\bin;%PATH%
- ps: |
if(!(gem which minitest 2>$nul)) { gem install minitest --no-ri --no-rdoc }
@@ -66,17 +66,6 @@ build_script:
test_script:
- ps: |
$PRNR = $env:APPVEYOR_PULL_REQUEST_NUMBER
if ($PRNR) {
echo "Fetching info for PR $PRNR"
wget https://api.github.com/repos/sass/libsass/pulls/$PRNR -OutFile pr.json
$json = cat pr.json -Raw
$SPEC_PR = [regex]::match($json,'sass\/sass-spec(#|\/pull\/)([0-9]+)').Groups[2].Value
if ($SPEC_PR) {
echo "Checkout sass spec PR $SPEC_PR"
git -C sass-spec fetch -q -u origin pull/$SPEC_PR/head:ci-spec-pr-$SPEC_PR
git -C sass-spec checkout -q --force ci-spec-pr-$SPEC_PR
}
}
$env:TargetPath = Join-Path $pwd.Path $env:TargetPath
If (Test-Path "$env:TargetPath") {
ruby sass-spec/sass-spec.rb --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
@@ -88,18 +88,23 @@ the --with-sass-spec-dir=<dir> argument.
case $sass_spec_dir in
/*)
SASS_SPEC_PATH=`$RUBY -e "require 'pathname'; puts Pathname.new('$sass_spec_dir').relative_path_from(Pathname.new('$PWD')).to_s"`
SASS_SPEC_ROOT="$sass_spec_dir"
;;
*)
SASS_SPEC_PATH="$sass_spec_dir"
SASS_SPEC_ROOT="$sass_spec_dir"
;;
esac
AC_SUBST(SASS_SPEC_PATH)
AC_SUBST(SASS_SPEC_ROOT)
else
# we do not really need these paths for non test build
# but automake may error if we do not define them here
SASS_SPEC_PATH=sass-spec
SASS_SPEC_ROOT=sass-spec
SASS_SASSC_PATH=sassc
AC_SUBST(SASS_SPEC_PATH)
AC_SUBST(SASS_SPEC_ROOT)
AC_SUBST(SASS_SASSC_PATH)
fi

@@ -28,7 +28,6 @@ This should install these files
/usr/lib/libsass.so.0.0.9
# $ ls -la /usr/include/sass*
/usr/include/sass.h
/usr/include/sass2scss.h
/usr/include/sass/context.h
/usr/include/sass/functions.h
/usr/include/sass/values.h
@@ -9,7 +9,6 @@
#include <sass/values.h>
#include <sass/functions.h>
#include <sass/context.h>
#include <sass2scss.h>

#endif

@@ -68,7 +68,6 @@ enum Sass_Output_Style {
SASS_STYLE_COMPRESSED,
// only used internaly
SASS_STYLE_INSPECT,
SASS_STYLE_TO_SASS,
SASS_STYLE_TO_CSS
};

@@ -87,6 +86,9 @@ ADDAPI char* ADDCALL sass_string_unquote (const char* str);
// Hardcoded version 3.4 for time being
ADDAPI const char* ADDCALL libsass_version(void);

// Hardcoded until removed completely
ADDAPI const char* ADDCALL sass2scss_version(void);

// Get compiled libsass language
ADDAPI const char* ADDCALL libsass_language_version(void);

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.