Skip to content

Commit f1cfd65

Browse files
committed
[WIP] [DNM] Backport dart sass parser and more
1 parent d911058 commit f1cfd65

File tree

224 files changed

+32202
-21099
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+32202
-21099
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ libsass/*
5353
*.lo
5454
*.so
5555
*.dll
56+
*.h.gch
57+
*.h.pch
58+
*.hpp.gch
59+
*.hpp.pch
5660
*.a
5761
*.suo
5862
*.sdf

GNUmakefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ if ENABLE_TESTS
2929

3030
SASS_SASSC_PATH ?= $(top_srcdir)/sassc
3131
SASS_SPEC_PATH ?= $(top_srcdir)/sass-spec
32+
SASS_SPEC_ROOT ?= $(top_srcdir)/sass-spec
3233

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

5456
SASS_TESTER = $(RUBY) $(SASS_SPEC_PATH)/sass-spec.rb

Makefile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,24 @@ CFLAGS ?= -Wall
1616
CXXFLAGS ?= -Wall
1717
LDFLAGS ?= -Wall
1818
ifndef COVERAGE
19-
CFLAGS += -O2
20-
CXXFLAGS += -O2
21-
LDFLAGS += -O2
19+
CFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
20+
CXXFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
21+
LDFLAGS += -O3 -pipe -DNDEBUG -fomit-frame-pointer
2222
else
2323
CFLAGS += -O1 -fno-omit-frame-pointer
2424
CXXFLAGS += -O1 -fno-omit-frame-pointer
2525
LDFLAGS += -O1 -fno-omit-frame-pointer
2626
endif
27+
ifeq "$(LIBSASS_GPO)" "generate"
28+
CFLAGS += -fprofile-generate
29+
CXXFLAGS += -fprofile-generate
30+
LDFLAGS += -fprofile-generate -Wl,-fprofile-instr-generate
31+
endif
32+
ifeq "$(LIBSASS_GPO)" "use"
33+
CFLAGS += -fprofile-use
34+
CXXFLAGS += -fprofile-use
35+
LDFLAGS += -fprofile-use -Wl,-fprofile-instr-use
36+
endif
2737
CAT ?= $(if $(filter $(OS),Windows_NT),type,cat)
2838

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

180191
DEBUG_LVL ?= NONE
@@ -183,6 +194,7 @@ CLEANUPS ?=
183194
CLEANUPS += $(RCOBJECTS)
184195
CLEANUPS += $(COBJECTS)
185196
CLEANUPS += $(OBJECTS)
197+
CLEANUPS += $(HEADOBJS)
186198
CLEANUPS += $(LIBSASS_LIB)
187199

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

219-
%.o: %.c
220-
$(CC) $(CFLAGS) -c -o $@ $<
221-
222-
%.o: %.rc
231+
$(RCOBJECTS): %.o: %.rc
223232
$(WINDRES) -i $< -o $@
224233

225-
%.o: %.cpp
234+
$(OBJECTS): %.o: %.cpp $(HEADOBJS)
226235
$(CXX) $(CXXFLAGS) -c -o $@ $<
227236

237+
$(COBJECTS): %.o: %.c $(HEADOBJS)
238+
$(CC) $(CFLAGS) -c -o $@ $<
239+
240+
$(HEADOBJS): %.hpp.gch: %.hpp
241+
$(CXX) $(CXXFLAGS) -x c++-header -c -o $@ $<
242+
228243
%: %.o static
229244
$(CXX) $(CXXFLAGS) -o $@ $+ $(LDFLAGS) $(LDLIBS)
230245

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

252267
install-headers: $(DESTDIR)$(PREFIX)/include/sass.h \
253-
$(DESTDIR)$(PREFIX)/include/sass2scss.h \
254268
$(DESTDIR)$(PREFIX)/include/sass/base.h \
255269
$(DESTDIR)$(PREFIX)/include/sass/version.h \
256270
$(DESTDIR)$(PREFIX)/include/sass/values.h \

Makefile.conf

Lines changed: 123 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,68 +4,180 @@
44
# in parallel. But we also want to mix them a little too avoid
55
# heavy RAM usage peaks. Other than that the order is arbitrary.
66

7+
HPPFILES = \
8+
ast.hpp \
9+
ast2c.hpp \
10+
ast_css.hpp \
11+
ast_def_macros.hpp \
12+
ast_fwd_decl.hpp \
13+
ast_helpers.hpp \
14+
ast_selectors.hpp \
15+
ast_supports.hpp \
16+
ast_values.hpp \
17+
allocator.hpp \
18+
backtrace.hpp \
19+
base64vlq.hpp \
20+
c2ast.hpp \
21+
character.hpp \
22+
charcode.hpp \
23+
color_maps.hpp \
24+
constants.hpp \
25+
context.hpp \
26+
cssize.hpp \
27+
dart_helpers.hpp \
28+
debug.hpp \
29+
debugger.hpp \
30+
emitter.hpp \
31+
environment.hpp \
32+
error_handling.hpp \
33+
memory_pool.hpp \
34+
MurmurHash2.hpp \
35+
eval.hpp \
36+
evaluate.hpp \
37+
extender.hpp \
38+
extension.hpp \
39+
file.hpp \
40+
fn_colors.hpp \
41+
fn_lists.hpp \
42+
fn_maps.hpp \
43+
fn_meta.hpp \
44+
fn_numbers.hpp \
45+
fn_selectors.hpp \
46+
fn_strings.hpp \
47+
fn_utils.hpp \
48+
inspect.hpp \
49+
interpolation.hpp \
50+
logger.hpp \
51+
json.hpp \
52+
kwd_arg_macros.hpp \
53+
listize.hpp \
54+
randomize.hpp \
55+
mapping.hpp \
56+
operation.hpp \
57+
operators.hpp \
58+
ordered_map.hpp \
59+
source.hpp \
60+
output.hpp \
61+
parser.hpp \
62+
parser_base.hpp \
63+
parser_css.hpp \
64+
parser_expression.hpp \
65+
parser_media_query.hpp \
66+
parser_at_root_query.hpp \
67+
parser_keyframe_selector.hpp \
68+
parser_sass.hpp \
69+
parser_scss.hpp \
70+
parser_selector.hpp \
71+
parser_stylesheet.hpp \
72+
permutate.hpp \
73+
plugins.hpp \
74+
position.hpp \
75+
offset.hpp \
76+
remove_placeholders.hpp \
77+
sass.hpp \
78+
sass_context.hpp \
79+
sass_functions.hpp \
80+
sass_values.hpp \
81+
scanner_line.hpp \
82+
scanner_span.hpp \
83+
scanner_string.hpp \
84+
serialize.hpp \
85+
source_map.hpp \
86+
source_state.hpp \
87+
source_span.hpp \
88+
stylesheet.hpp \
89+
units.hpp \
90+
utf8_string.hpp \
91+
util.hpp \
92+
util_string.hpp \
93+
values.hpp \
94+
visitor_css.hpp \
95+
visitor_expression.hpp \
96+
visitor_selector.hpp \
97+
visitor_statement.hpp \
98+
visitor_value.hpp \
99+
var_stack.hpp
7100

8101
SOURCES = \
9102
ast.cpp \
103+
ast_css.cpp \
10104
ast_values.cpp \
11105
ast_supports.cpp \
12106
ast_sel_cmp.cpp \
13107
ast_sel_unify.cpp \
14108
ast_sel_super.cpp \
15109
ast_sel_weave.cpp \
16110
ast_selectors.cpp \
111+
allocator.cpp \
17112
context.cpp \
18113
constants.cpp \
19114
fn_utils.cpp \
20-
fn_miscs.cpp \
21115
fn_maps.cpp \
22116
fn_lists.cpp \
23117
fn_colors.cpp \
24118
fn_numbers.cpp \
25119
fn_strings.cpp \
26120
fn_selectors.cpp \
121+
fn_meta.cpp \
27122
color_maps.cpp \
28123
environment.cpp \
29124
ast_fwd_decl.cpp \
30-
bind.cpp \
31125
file.cpp \
32126
util.cpp \
33127
util_string.cpp \
128+
logger.cpp \
34129
json.cpp \
35130
units.cpp \
36131
values.cpp \
37132
plugins.cpp \
38133
position.cpp \
39-
lexer.cpp \
40-
parser.cpp \
41-
parser_selectors.cpp \
42-
prelexer.cpp \
134+
offset.cpp \
135+
serialize.cpp \
43136
eval.cpp \
44-
eval_selectors.cpp \
45-
expand.cpp \
137+
evaluate.cpp \
46138
listize.cpp \
139+
randomize.cpp \
47140
cssize.cpp \
48141
extender.cpp \
49142
extension.cpp \
50143
stylesheet.cpp \
144+
interpolation.cpp \
145+
parser.cpp \
146+
parser_css.cpp \
147+
parser_base.cpp \
148+
parser_scss.cpp \
149+
parser_sass.cpp \
150+
parser_selector.cpp \
151+
parser_stylesheet.cpp \
152+
parser_expression.cpp \
153+
parser_media_query.cpp \
154+
parser_at_root_query.cpp \
155+
parser_keyframe_selector.cpp \
156+
source.cpp \
51157
output.cpp \
52158
inspect.cpp \
53159
emitter.cpp \
54-
check_nesting.cpp \
160+
scanner_span.cpp \
161+
scanner_line.cpp \
162+
scanner_string.cpp \
55163
remove_placeholders.cpp \
56164
sass.cpp \
57165
sass_values.cpp \
58166
sass_context.cpp \
59167
sass_functions.cpp \
60-
sass2scss.cpp \
61168
backtrace.cpp \
62169
operators.cpp \
63170
ast2c.cpp \
64171
c2ast.cpp \
65-
to_value.cpp \
172+
var_stack.cpp \
66173
source_map.cpp \
174+
source_state.cpp \
175+
source_span.cpp \
67176
error_handling.cpp \
177+
MurmurHash2.cpp \
68178
memory/SharedPtr.cpp \
179+
memory_pool.cpp \
180+
LUrlParser/LUrlParser.cpp \
69181
utf8_string.cpp \
70182
base64vlq.cpp
71183

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test_script:
7979
}
8080
$env:TargetPath = Join-Path $pwd.Path $env:TargetPath
8181
If (Test-Path "$env:TargetPath") {
82-
ruby sass-spec/sass-spec.rb --probe-todo --impl libsass -c $env:TargetPath -s sass-spec/spec
82+
ruby sass-spec/sass-spec.rb --probe-todo --impl libsass --cmd-args "-I sass-spec/spec" -c $env:TargetPath -s sass-spec/spec
8383
if(-not($?)) {
8484
echo "sass-spec tests failed"
8585
exit 1

configure.ac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,23 @@ the --with-sass-spec-dir=<dir> argument.
8888
case $sass_spec_dir in
8989
/*)
9090
SASS_SPEC_PATH=`$RUBY -e "require 'pathname'; puts Pathname.new('$sass_spec_dir').relative_path_from(Pathname.new('$PWD')).to_s"`
91+
SASS_SPEC_ROOT="$sass_spec_dir"
9192
;;
9293
*)
9394
SASS_SPEC_PATH="$sass_spec_dir"
95+
SASS_SPEC_ROOT="$sass_spec_dir"
9496
;;
9597
esac
9698
AC_SUBST(SASS_SPEC_PATH)
99+
AC_SUBST(SASS_SPEC_ROOT)
97100
else
98101
# we do not really need these paths for non test build
99102
# but automake may error if we do not define them here
100103
SASS_SPEC_PATH=sass-spec
104+
SASS_SPEC_ROOT=sass-spec
101105
SASS_SASSC_PATH=sassc
102106
AC_SUBST(SASS_SPEC_PATH)
107+
AC_SUBST(SASS_SPEC_ROOT)
103108
AC_SUBST(SASS_SASSC_PATH)
104109
fi
105110

docs/build-shared-library.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ This should install these files
2828
/usr/lib/libsass.so.0.0.9
2929
# $ ls -la /usr/include/sass*
3030
/usr/include/sass.h
31-
/usr/include/sass2scss.h
3231
/usr/include/sass/context.h
3332
/usr/include/sass/functions.h
3433
/usr/include/sass/values.h

include/sass.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <sass/values.h>
1010
#include <sass/functions.h>
1111
#include <sass/context.h>
12-
#include <sass2scss.h>
1312

1413
#endif
1514

include/sass/base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ ADDAPI char* ADDCALL sass_string_unquote (const char* str);
8787
// Hardcoded version 3.4 for time being
8888
ADDAPI const char* ADDCALL libsass_version(void);
8989

90+
// Hardcoded until removed completely
91+
ADDAPI const char* ADDCALL sass2scss_version(void);
92+
9093
// Get compiled libsass language
9194
ADDAPI const char* ADDCALL libsass_language_version(void);
9295

0 commit comments

Comments
 (0)