Skip to content

Commit b0ab13c

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

File tree

221 files changed

+31159
-20691
lines changed

Some content is hidden

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

221 files changed

+31159
-20691
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

.travis.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,11 @@ sudo: required
2020

2121
matrix:
2222
include :
23-
- os: linux
24-
compiler: gcc
25-
env: AUTOTOOLS=no COVERAGE=yes BUILD=static
26-
- os: linux
27-
compiler: g++-5
28-
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
29-
addons:
30-
apt:
31-
sources:
32-
- ubuntu-toolchain-r-test
33-
packages:
34-
- g++-5
35-
- os: linux
36-
compiler: g++-8
37-
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
38-
addons:
39-
apt:
40-
sources:
41-
- ubuntu-toolchain-r-test
42-
packages:
43-
- g++-8
4423
- os: linux
4524
compiler: clang
4625
# This build runs with ASan and we set `detect_odr_violation=0`
4726
# to work around https://bugs.llvm.org/show_bug.cgi?id=37545.
4827
env: AUTOTOOLS=no COVERAGE=no BUILD=static ASAN_OPTIONS=detect_odr_violation=0
49-
- os: linux
50-
compiler: clang
51-
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
52-
- os: osx
53-
compiler: clang
54-
env: AUTOTOOLS=no COVERAGE=no BUILD=shared
55-
- os: osx
56-
compiler: clang
57-
env: AUTOTOOLS=no COVERAGE=no BUILD=static
58-
- os: osx
59-
compiler: clang
60-
env: AUTOTOOLS=yes COVERAGE=no BUILD=shared
6128

6229
script:
6330
- ./script/ci-build-libsass

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

8104
SOURCES = \
9105
ast.cpp \
106+
ast_css.cpp \
10107
ast_values.cpp \
11108
ast_supports.cpp \
12109
ast_sel_cmp.cpp \
@@ -17,56 +114,71 @@ SOURCES = \
17114
context.cpp \
18115
constants.cpp \
19116
fn_utils.cpp \
20-
fn_miscs.cpp \
21117
fn_maps.cpp \
22118
fn_lists.cpp \
23119
fn_colors.cpp \
24120
fn_numbers.cpp \
25121
fn_strings.cpp \
26122
fn_selectors.cpp \
123+
fn_meta.cpp \
27124
color_maps.cpp \
28125
environment.cpp \
29126
ast_fwd_decl.cpp \
30-
bind.cpp \
31127
file.cpp \
32128
util.cpp \
33129
util_string.cpp \
130+
logger.cpp \
34131
json.cpp \
35132
units.cpp \
36133
values.cpp \
37134
plugins.cpp \
38135
position.cpp \
39-
lexer.cpp \
40-
parser.cpp \
41-
parser_selectors.cpp \
42-
prelexer.cpp \
136+
offset.cpp \
137+
serialize.cpp \
43138
eval.cpp \
44-
eval_selectors.cpp \
45-
expand.cpp \
139+
evaluate.cpp \
46140
listize.cpp \
141+
randomize.cpp \
47142
cssize.cpp \
48143
extender.cpp \
49144
extension.cpp \
50145
stylesheet.cpp \
146+
interpolation.cpp \
147+
parser.cpp \
148+
parser_css.cpp \
149+
parser_base.cpp \
150+
parser_scss.cpp \
151+
parser_sass.cpp \
152+
parser_selector.cpp \
153+
parser_stylesheet.cpp \
154+
parser_expression.cpp \
155+
parser_media_query.cpp \
156+
parser_at_root_query.cpp \
157+
parser_keyframe_selector.cpp \
158+
source.cpp \
51159
output.cpp \
52160
inspect.cpp \
53161
emitter.cpp \
54-
check_nesting.cpp \
162+
scanner_span.cpp \
163+
scanner_line.cpp \
164+
scanner_string.cpp \
55165
remove_placeholders.cpp \
56166
sass.cpp \
57167
sass_values.cpp \
58168
sass_context.cpp \
59169
sass_functions.cpp \
60-
sass2scss.cpp \
61170
backtrace.cpp \
62171
operators.cpp \
63172
ast2c.cpp \
64173
c2ast.cpp \
65-
to_value.cpp \
174+
var_stack.cpp \
66175
source_map.cpp \
176+
source_state.cpp \
177+
source_span.cpp \
67178
error_handling.cpp \
68179
memory/allocator.cpp \
69180
memory/shared_ptr.cpp \
181+
LUrlParser/LUrlParser.cpp \
70182
utf8_string.cpp \
71183
base64vlq.cpp
72184

0 commit comments

Comments
 (0)