sassc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.gitmodules +3 -0
- data/.travis.yml +9 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +24 -0
- data/Rakefile +21 -0
- data/ext/libsass/.editorconfig +15 -0
- data/ext/libsass/.gitattributes +2 -0
- data/ext/libsass/.gitignore +61 -0
- data/ext/libsass/.travis.yml +38 -0
- data/ext/libsass/COPYING +25 -0
- data/ext/libsass/INSTALL +1 -0
- data/ext/libsass/LICENSE +25 -0
- data/ext/libsass/Makefile +223 -0
- data/ext/libsass/Makefile.am +145 -0
- data/ext/libsass/Readme.md +93 -0
- data/ext/libsass/appveyor.yml +76 -0
- data/ext/libsass/ast.cpp +581 -0
- data/ext/libsass/ast.hpp +1949 -0
- data/ext/libsass/ast_def_macros.hpp +16 -0
- data/ext/libsass/ast_factory.hpp +87 -0
- data/ext/libsass/ast_fwd_decl.hpp +72 -0
- data/ext/libsass/b64/cencode.h +32 -0
- data/ext/libsass/b64/encode.h +77 -0
- data/ext/libsass/backtrace.hpp +81 -0
- data/ext/libsass/base64vlq.cpp +43 -0
- data/ext/libsass/base64vlq.hpp +28 -0
- data/ext/libsass/bind.cpp +187 -0
- data/ext/libsass/bind.hpp +18 -0
- data/ext/libsass/cencode.c +102 -0
- data/ext/libsass/color_names.hpp +324 -0
- data/ext/libsass/configure.ac +130 -0
- data/ext/libsass/constants.cpp +144 -0
- data/ext/libsass/constants.hpp +145 -0
- data/ext/libsass/context.cpp +507 -0
- data/ext/libsass/context.hpp +150 -0
- data/ext/libsass/contextualize.cpp +157 -0
- data/ext/libsass/contextualize.hpp +65 -0
- data/ext/libsass/copy_c_str.cpp +13 -0
- data/ext/libsass/copy_c_str.hpp +5 -0
- data/ext/libsass/debug.hpp +39 -0
- data/ext/libsass/environment.hpp +75 -0
- data/ext/libsass/error_handling.cpp +28 -0
- data/ext/libsass/error_handling.hpp +28 -0
- data/ext/libsass/eval.cpp +1149 -0
- data/ext/libsass/eval.hpp +80 -0
- data/ext/libsass/expand.cpp +430 -0
- data/ext/libsass/expand.hpp +77 -0
- data/ext/libsass/extconf.rb +6 -0
- data/ext/libsass/extend.cpp +1962 -0
- data/ext/libsass/extend.hpp +50 -0
- data/ext/libsass/file.cpp +291 -0
- data/ext/libsass/file.hpp +18 -0
- data/ext/libsass/functions.cpp +1565 -0
- data/ext/libsass/functions.hpp +187 -0
- data/ext/libsass/inspect.cpp +727 -0
- data/ext/libsass/inspect.hpp +108 -0
- data/ext/libsass/json.cpp +1411 -0
- data/ext/libsass/json.hpp +117 -0
- data/ext/libsass/kwd_arg_macros.hpp +23 -0
- data/ext/libsass/m4/.gitkeep +0 -0
- data/ext/libsass/mapping.hpp +17 -0
- data/ext/libsass/memory_manager.hpp +54 -0
- data/ext/libsass/node.cpp +251 -0
- data/ext/libsass/node.hpp +122 -0
- data/ext/libsass/operation.hpp +153 -0
- data/ext/libsass/output_compressed.cpp +401 -0
- data/ext/libsass/output_compressed.hpp +95 -0
- data/ext/libsass/output_nested.cpp +364 -0
- data/ext/libsass/output_nested.hpp +108 -0
- data/ext/libsass/parser.cpp +2016 -0
- data/ext/libsass/parser.hpp +264 -0
- data/ext/libsass/paths.hpp +69 -0
- data/ext/libsass/position.hpp +22 -0
- data/ext/libsass/posix/getopt.c +562 -0
- data/ext/libsass/posix/getopt.h +95 -0
- data/ext/libsass/prelexer.cpp +688 -0
- data/ext/libsass/prelexer.hpp +513 -0
- data/ext/libsass/remove_placeholders.cpp +59 -0
- data/ext/libsass/remove_placeholders.hpp +43 -0
- data/ext/libsass/res/resource.rc +35 -0
- data/ext/libsass/sass.cpp +33 -0
- data/ext/libsass/sass.h +60 -0
- data/ext/libsass/sass2scss.cpp +834 -0
- data/ext/libsass/sass2scss.h +110 -0
- data/ext/libsass/sass_context.cpp +709 -0
- data/ext/libsass/sass_context.h +120 -0
- data/ext/libsass/sass_functions.cpp +137 -0
- data/ext/libsass/sass_functions.h +90 -0
- data/ext/libsass/sass_interface.cpp +277 -0
- data/ext/libsass/sass_interface.h +97 -0
- data/ext/libsass/sass_util.cpp +136 -0
- data/ext/libsass/sass_util.hpp +259 -0
- data/ext/libsass/sass_values.cpp +337 -0
- data/ext/libsass/sass_values.h +124 -0
- data/ext/libsass/script/bootstrap +10 -0
- data/ext/libsass/script/branding +10 -0
- data/ext/libsass/script/ci-build-libsass +72 -0
- data/ext/libsass/script/ci-install-compiler +4 -0
- data/ext/libsass/script/ci-install-deps +19 -0
- data/ext/libsass/script/ci-report-coverage +25 -0
- data/ext/libsass/script/coveralls-debug +32 -0
- data/ext/libsass/script/spec +5 -0
- data/ext/libsass/script/tap-driver +652 -0
- data/ext/libsass/script/tap-runner +1 -0
- data/ext/libsass/source_map.cpp +133 -0
- data/ext/libsass/source_map.hpp +46 -0
- data/ext/libsass/subset_map.hpp +145 -0
- data/ext/libsass/support/libsass.pc.in +11 -0
- data/ext/libsass/test-driver +127 -0
- data/ext/libsass/test/test_node.cpp +98 -0
- data/ext/libsass/test/test_paths.cpp +29 -0
- data/ext/libsass/test/test_selector_difference.cpp +28 -0
- data/ext/libsass/test/test_specificity.cpp +28 -0
- data/ext/libsass/test/test_subset_map.cpp +472 -0
- data/ext/libsass/test/test_superselector.cpp +71 -0
- data/ext/libsass/test/test_unification.cpp +33 -0
- data/ext/libsass/to_c.cpp +61 -0
- data/ext/libsass/to_c.hpp +44 -0
- data/ext/libsass/to_string.cpp +29 -0
- data/ext/libsass/to_string.hpp +32 -0
- data/ext/libsass/token.hpp +32 -0
- data/ext/libsass/units.cpp +54 -0
- data/ext/libsass/units.hpp +10 -0
- data/ext/libsass/utf8.h +34 -0
- data/ext/libsass/utf8/checked.h +327 -0
- data/ext/libsass/utf8/core.h +329 -0
- data/ext/libsass/utf8/unchecked.h +228 -0
- data/ext/libsass/utf8_string.cpp +102 -0
- data/ext/libsass/utf8_string.hpp +36 -0
- data/ext/libsass/util.cpp +189 -0
- data/ext/libsass/util.hpp +26 -0
- data/ext/libsass/win/libsass.filters +291 -0
- data/ext/libsass/win/libsass.sln +28 -0
- data/ext/libsass/win/libsass.vcxproj +255 -0
- data/lib/sassc.rb +6 -0
- data/lib/sassc/engine.rb +13 -0
- data/lib/sassc/native.rb +44 -0
- data/lib/sassc/native/native_context_api.rb +140 -0
- data/lib/sassc/native/native_functions_api.rb +41 -0
- data/lib/sassc/native/sass_input_style.rb +11 -0
- data/lib/sassc/native/sass_output_style.rb +10 -0
- data/lib/sassc/native/sass_value.rb +95 -0
- data/lib/sassc/native/string_list.rb +8 -0
- data/lib/sassc/version.rb +3 -0
- data/sassc.gemspec +43 -0
- data/test/smoke_test.rb +171 -0
- data/test/test_helper.rb +4 -0
- metadata +281 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$@ | tapout tap
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#include "source_map.hpp"
|
|
2
|
+
#include "json.hpp"
|
|
3
|
+
|
|
4
|
+
#ifndef SASS_CONTEXT
|
|
5
|
+
#include "context.hpp"
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#include <string>
|
|
9
|
+
#include <sstream>
|
|
10
|
+
#include <cstddef>
|
|
11
|
+
#include <iomanip>
|
|
12
|
+
|
|
13
|
+
namespace Sass {
|
|
14
|
+
using std::ptrdiff_t;
|
|
15
|
+
SourceMap::SourceMap(const string& file) : current_position(Position(1, 1)), file(file) { }
|
|
16
|
+
|
|
17
|
+
string SourceMap::generate_source_map(Context &ctx) {
|
|
18
|
+
|
|
19
|
+
const bool include_sources = ctx.source_map_contents;
|
|
20
|
+
const vector<string> includes = ctx.include_links;
|
|
21
|
+
const vector<const char*> sources = ctx.sources;
|
|
22
|
+
|
|
23
|
+
JsonNode *json_srcmap = json_mkobject();
|
|
24
|
+
|
|
25
|
+
json_append_member(json_srcmap, "version", json_mknumber(3));
|
|
26
|
+
|
|
27
|
+
const char *include = file.c_str();
|
|
28
|
+
JsonNode *json_include = json_mkstring(include);
|
|
29
|
+
json_append_member(json_srcmap, "file", json_include);
|
|
30
|
+
|
|
31
|
+
JsonNode *json_includes = json_mkarray();
|
|
32
|
+
for (size_t i = 0; i < source_index.size(); ++i) {
|
|
33
|
+
const char *include = includes[source_index[i]].c_str();
|
|
34
|
+
JsonNode *json_include = json_mkstring(include);
|
|
35
|
+
json_append_element(json_includes, json_include);
|
|
36
|
+
}
|
|
37
|
+
json_append_member(json_srcmap, "sources", json_includes);
|
|
38
|
+
|
|
39
|
+
JsonNode *json_contents = json_mkarray();
|
|
40
|
+
if (include_sources) {
|
|
41
|
+
for (size_t i = 0; i < source_index.size(); ++i) {
|
|
42
|
+
const char *content = sources[source_index[i]];
|
|
43
|
+
JsonNode *json_content = json_mkstring(content);
|
|
44
|
+
json_append_element(json_contents, json_content);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
json_append_member(json_srcmap, "sourcesContent", json_contents);
|
|
48
|
+
|
|
49
|
+
string mappings = serialize_mappings();
|
|
50
|
+
JsonNode *json_mappings = json_mkstring(mappings.c_str());
|
|
51
|
+
json_append_member(json_srcmap, "mappings", json_mappings);
|
|
52
|
+
|
|
53
|
+
JsonNode *json_names = json_mkarray();
|
|
54
|
+
// so far we have no implementation for names
|
|
55
|
+
// no problem as we do not alter any identifiers
|
|
56
|
+
json_append_member(json_srcmap, "names", json_names);
|
|
57
|
+
|
|
58
|
+
char *str = json_stringify(json_srcmap, "\t");
|
|
59
|
+
string result = string(str);
|
|
60
|
+
free(str);
|
|
61
|
+
json_delete(json_srcmap);
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
string SourceMap::serialize_mappings() {
|
|
66
|
+
string result = "";
|
|
67
|
+
|
|
68
|
+
size_t previous_generated_line = 0;
|
|
69
|
+
size_t previous_generated_column = 0;
|
|
70
|
+
size_t previous_original_line = 0;
|
|
71
|
+
size_t previous_original_column = 0;
|
|
72
|
+
size_t previous_original_file = 0;
|
|
73
|
+
for (size_t i = 0; i < mappings.size(); ++i) {
|
|
74
|
+
const size_t generated_line = mappings[i].generated_position.line - 1;
|
|
75
|
+
const size_t generated_column = mappings[i].generated_position.column - 1;
|
|
76
|
+
const size_t original_line = mappings[i].original_position.line - 1;
|
|
77
|
+
const size_t original_column = mappings[i].original_position.column - 1;
|
|
78
|
+
const size_t original_file = mappings[i].original_position.file - 1;
|
|
79
|
+
|
|
80
|
+
if (generated_line != previous_generated_line) {
|
|
81
|
+
previous_generated_column = 0;
|
|
82
|
+
if (generated_line > previous_generated_line) {
|
|
83
|
+
result += std::string(generated_line - previous_generated_line, ';');
|
|
84
|
+
previous_generated_line = generated_line;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
else if (i > 0) {
|
|
88
|
+
result += ",";
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// generated column
|
|
92
|
+
result += base64vlq.encode(static_cast<int>(generated_column) - static_cast<int>(previous_generated_column));
|
|
93
|
+
previous_generated_column = generated_column;
|
|
94
|
+
// file
|
|
95
|
+
result += base64vlq.encode(static_cast<int>(original_file) - static_cast<int>(previous_original_file));
|
|
96
|
+
previous_original_file = original_file;
|
|
97
|
+
// source line
|
|
98
|
+
result += base64vlq.encode(static_cast<int>(original_line) - static_cast<int>(previous_original_line));
|
|
99
|
+
previous_original_line = original_line;
|
|
100
|
+
// source column
|
|
101
|
+
result += base64vlq.encode(static_cast<int>(original_column) - static_cast<int>(previous_original_column));
|
|
102
|
+
previous_original_column = original_column;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
void SourceMap::remove_line()
|
|
109
|
+
{
|
|
110
|
+
// prevent removing non existing lines
|
|
111
|
+
if (current_position.line > 1) {
|
|
112
|
+
current_position.line -= 1;
|
|
113
|
+
current_position.column = 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void SourceMap::update_column(const string& str)
|
|
118
|
+
{
|
|
119
|
+
const ptrdiff_t new_line_count = std::count(str.begin(), str.end(), '\n');
|
|
120
|
+
current_position.line += new_line_count;
|
|
121
|
+
if (new_line_count > 0) {
|
|
122
|
+
current_position.column = str.size() - str.find_last_of('\n');
|
|
123
|
+
} else {
|
|
124
|
+
current_position.column += str.size();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
void SourceMap::add_mapping(AST_Node* node)
|
|
129
|
+
{
|
|
130
|
+
mappings.push_back(Mapping(node->position(), current_position));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#define SASS_SOURCE_MAP
|
|
2
|
+
|
|
3
|
+
#include <vector>
|
|
4
|
+
|
|
5
|
+
#ifndef SASS_MAPPING
|
|
6
|
+
#include "mapping.hpp"
|
|
7
|
+
#endif
|
|
8
|
+
|
|
9
|
+
#ifndef SASS_AST
|
|
10
|
+
#include "ast.hpp"
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#ifndef SASSS_BASE64VLQ
|
|
14
|
+
#include "base64vlq.hpp"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
namespace Sass {
|
|
20
|
+
using std::vector;
|
|
21
|
+
|
|
22
|
+
struct Context;
|
|
23
|
+
|
|
24
|
+
class SourceMap {
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
vector<size_t> source_index;
|
|
28
|
+
SourceMap(const string& file);
|
|
29
|
+
|
|
30
|
+
void remove_line();
|
|
31
|
+
void update_column(const string& str);
|
|
32
|
+
void add_mapping(AST_Node* node);
|
|
33
|
+
|
|
34
|
+
string generate_source_map(Context &ctx);
|
|
35
|
+
|
|
36
|
+
private:
|
|
37
|
+
|
|
38
|
+
string serialize_mappings();
|
|
39
|
+
|
|
40
|
+
vector<Mapping> mappings;
|
|
41
|
+
Position current_position;
|
|
42
|
+
string file;
|
|
43
|
+
Base64VLQ base64vlq;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#define SASS_SUBSET_MAP
|
|
2
|
+
|
|
3
|
+
#include <vector>
|
|
4
|
+
#include <map>
|
|
5
|
+
#include <set>
|
|
6
|
+
#include <algorithm>
|
|
7
|
+
#include <iterator>
|
|
8
|
+
#include <iostream>
|
|
9
|
+
#include <sstream>
|
|
10
|
+
|
|
11
|
+
// using namespace std;
|
|
12
|
+
|
|
13
|
+
// template<typename T>
|
|
14
|
+
// string vector_to_string(vector<T> v)
|
|
15
|
+
// {
|
|
16
|
+
// stringstream buffer;
|
|
17
|
+
// buffer << "[";
|
|
18
|
+
|
|
19
|
+
// if (!v.empty())
|
|
20
|
+
// { buffer << v[0]; }
|
|
21
|
+
// else
|
|
22
|
+
// { buffer << "]"; }
|
|
23
|
+
|
|
24
|
+
// if (v.size() == 1)
|
|
25
|
+
// { buffer << "]"; }
|
|
26
|
+
// else
|
|
27
|
+
// {
|
|
28
|
+
// for (size_t i = 1, S = v.size(); i < S; ++i) buffer << ", " << v[i];
|
|
29
|
+
// buffer << "]";
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
// return buffer.str();
|
|
33
|
+
// }
|
|
34
|
+
|
|
35
|
+
// template<typename T>
|
|
36
|
+
// string set_to_string(set<T> v)
|
|
37
|
+
// {
|
|
38
|
+
// stringstream buffer;
|
|
39
|
+
// buffer << "[";
|
|
40
|
+
// typename set<T>::iterator i = v.begin();
|
|
41
|
+
// if (!v.empty())
|
|
42
|
+
// { buffer << *i; }
|
|
43
|
+
// else
|
|
44
|
+
// { buffer << "]"; }
|
|
45
|
+
|
|
46
|
+
// if (v.size() == 1)
|
|
47
|
+
// { buffer << "]"; }
|
|
48
|
+
// else
|
|
49
|
+
// {
|
|
50
|
+
// for (++i; i != v.end(); ++i) buffer << ", " << *i;
|
|
51
|
+
// buffer << "]";
|
|
52
|
+
// }
|
|
53
|
+
|
|
54
|
+
// return buffer.str();
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
namespace Sass {
|
|
58
|
+
using namespace std;
|
|
59
|
+
|
|
60
|
+
template<typename F, typename S, typename T>
|
|
61
|
+
struct triple {
|
|
62
|
+
F first;
|
|
63
|
+
S second;
|
|
64
|
+
T third;
|
|
65
|
+
|
|
66
|
+
triple(const F& f, const S& s, const T& t) : first(f), second(s), third(t) { }
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
template<typename F, typename S, typename T>
|
|
70
|
+
triple<F, S, T> make_triple(const F& f, const S& s, const T& t)
|
|
71
|
+
{ return triple<F, S, T>(f, s, t); }
|
|
72
|
+
|
|
73
|
+
template<typename K, typename V>
|
|
74
|
+
class Subset_Map {
|
|
75
|
+
private:
|
|
76
|
+
vector<V> values_;
|
|
77
|
+
map<K, vector<triple<vector<K>, set<K>, size_t> > > hash_;
|
|
78
|
+
public:
|
|
79
|
+
void put(const vector<K>& s, const V& value);
|
|
80
|
+
vector<pair<V, vector<K> > > get_kv(const vector<K>& s);
|
|
81
|
+
vector<V> get_v(const vector<K>& s);
|
|
82
|
+
bool empty() { return values_.empty(); }
|
|
83
|
+
void clear() { values_.clear(); hash_.clear(); }
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
template<typename K, typename V>
|
|
87
|
+
void Subset_Map<K, V>::put(const vector<K>& s, const V& value)
|
|
88
|
+
{
|
|
89
|
+
if (s.empty()) throw "internal error: subset map keys may not be empty";
|
|
90
|
+
size_t index = values_.size();
|
|
91
|
+
values_.push_back(value);
|
|
92
|
+
set<K> ss;
|
|
93
|
+
for (size_t i = 0, S = s.size(); i < S; ++i)
|
|
94
|
+
{ ss.insert(s[i]); }
|
|
95
|
+
for (size_t i = 0, S = s.size(); i < S; ++i)
|
|
96
|
+
{
|
|
97
|
+
hash_[s[i]];
|
|
98
|
+
hash_[s[i]].push_back(make_triple(s, ss, index));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
template<typename K, typename V>
|
|
103
|
+
vector<pair<V, vector<K> > > Subset_Map<K, V>::get_kv(const vector<K>& s)
|
|
104
|
+
{
|
|
105
|
+
vector<K> sorted = s;
|
|
106
|
+
sort(sorted.begin(), sorted.end());
|
|
107
|
+
vector<pair<size_t, vector<K> > > indices;
|
|
108
|
+
for (size_t i = 0, S = s.size(); i < S; ++i) {
|
|
109
|
+
// cerr << "looking for " << s[i] << endl;
|
|
110
|
+
if (!hash_.count(s[i])) {
|
|
111
|
+
// cerr << "didn't find " << s[i] << endl;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
vector<triple<vector<K>, set<K>, size_t> > subsets = hash_[s[i]];
|
|
115
|
+
// cerr << "length of subsets: " << subsets.size() << endl;
|
|
116
|
+
for (size_t j = 0, T = subsets.size(); j < T; ++j) {
|
|
117
|
+
if (!includes(sorted.begin(), sorted.end(), subsets[j].second.begin(), subsets[j].second.end())) {
|
|
118
|
+
// cout << vector_to_string(s) << " doesn't include " << set_to_string(subsets[j].second) << endl;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
indices.push_back(make_pair(subsets[j].third, subsets[j].first));
|
|
122
|
+
// cerr << "pushed " << subsets[j].third << " and " << vector_to_string(subsets[j].first) << " onto indices" << endl;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
sort(indices.begin(), indices.end());
|
|
126
|
+
typename vector<pair<size_t, vector<K> > >::iterator indices_end = unique(indices.begin(), indices.end());
|
|
127
|
+
indices.resize(distance(indices.begin(), indices_end));
|
|
128
|
+
|
|
129
|
+
vector<pair<V, vector<K> > > results;
|
|
130
|
+
for (size_t i = 0, S = indices.size(); i < S; ++i) {
|
|
131
|
+
results.push_back(make_pair(values_[indices[i].first], indices[i].second));
|
|
132
|
+
}
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
template<typename K, typename V>
|
|
137
|
+
vector<V> Subset_Map<K, V>::get_v(const vector<K>& s)
|
|
138
|
+
{
|
|
139
|
+
vector<pair<V, vector<K> > > kvs = get_kv(s);
|
|
140
|
+
vector<V> results;
|
|
141
|
+
for (size_t i = 0, S = kvs.size(); i < S; ++i) results.push_back(kvs[i].first);
|
|
142
|
+
return results;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
prefix=@prefix@
|
|
2
|
+
exec_prefix=@exec_prefix@
|
|
3
|
+
libdir=@libdir@
|
|
4
|
+
includedir=@includedir@
|
|
5
|
+
|
|
6
|
+
Name: libsass
|
|
7
|
+
URL: https://github.com/sass/libsass
|
|
8
|
+
Description: A C implementation of a Sass compiler
|
|
9
|
+
Version: @VERSION@
|
|
10
|
+
Libs: -L${libdir} -lsass
|
|
11
|
+
Cflags: -I${includedir}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
# test-driver - basic testsuite driver script.
|
|
3
|
+
|
|
4
|
+
scriptversion=2012-06-27.10; # UTC
|
|
5
|
+
|
|
6
|
+
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
|
7
|
+
#
|
|
8
|
+
# This program is free software; you can redistribute it and/or modify
|
|
9
|
+
# it under the terms of the GNU General Public License as published by
|
|
10
|
+
# the Free Software Foundation; either version 2, or (at your option)
|
|
11
|
+
# any later version.
|
|
12
|
+
#
|
|
13
|
+
# This program is distributed in the hope that it will be useful,
|
|
14
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
# GNU General Public License for more details.
|
|
17
|
+
#
|
|
18
|
+
# You should have received a copy of the GNU General Public License
|
|
19
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
|
|
21
|
+
# As a special exception to the GNU General Public License, if you
|
|
22
|
+
# distribute this file as part of a program that contains a
|
|
23
|
+
# configuration script generated by Autoconf, you may include it under
|
|
24
|
+
# the same distribution terms that you use for the rest of that program.
|
|
25
|
+
|
|
26
|
+
# This file is maintained in Automake, please report
|
|
27
|
+
# bugs to <bug-automake@gnu.org> or send patches to
|
|
28
|
+
# <automake-patches@gnu.org>.
|
|
29
|
+
|
|
30
|
+
# Make unconditional expansion of undefined variables an error. This
|
|
31
|
+
# helps a lot in preventing typo-related bugs.
|
|
32
|
+
set -u
|
|
33
|
+
|
|
34
|
+
usage_error ()
|
|
35
|
+
{
|
|
36
|
+
echo "$0: $*" >&2
|
|
37
|
+
print_usage >&2
|
|
38
|
+
exit 2
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
print_usage ()
|
|
42
|
+
{
|
|
43
|
+
cat <<END
|
|
44
|
+
Usage:
|
|
45
|
+
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
|
46
|
+
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
|
47
|
+
[--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
|
|
48
|
+
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
|
49
|
+
END
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
# TODO: better error handling in option parsing (in particular, ensure
|
|
53
|
+
# TODO: $log_file, $trs_file and $test_name are defined).
|
|
54
|
+
test_name= # Used for reporting.
|
|
55
|
+
log_file= # Where to save the output of the test script.
|
|
56
|
+
trs_file= # Where to save the metadata of the test run.
|
|
57
|
+
expect_failure=no
|
|
58
|
+
color_tests=no
|
|
59
|
+
enable_hard_errors=yes
|
|
60
|
+
while test $# -gt 0; do
|
|
61
|
+
case $1 in
|
|
62
|
+
--help) print_usage; exit $?;;
|
|
63
|
+
--version) echo "test-driver $scriptversion"; exit $?;;
|
|
64
|
+
--test-name) test_name=$2; shift;;
|
|
65
|
+
--log-file) log_file=$2; shift;;
|
|
66
|
+
--trs-file) trs_file=$2; shift;;
|
|
67
|
+
--color-tests) color_tests=$2; shift;;
|
|
68
|
+
--expect-failure) expect_failure=$2; shift;;
|
|
69
|
+
--enable-hard-errors) enable_hard_errors=$2; shift;;
|
|
70
|
+
--) shift; break;;
|
|
71
|
+
-*) usage_error "invalid option: '$1'";;
|
|
72
|
+
esac
|
|
73
|
+
shift
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
if test $color_tests = yes; then
|
|
77
|
+
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
|
|
78
|
+
red='[0;31m' # Red.
|
|
79
|
+
grn='[0;32m' # Green.
|
|
80
|
+
lgn='[1;32m' # Light green.
|
|
81
|
+
blu='[1;34m' # Blue.
|
|
82
|
+
mgn='[0;35m' # Magenta.
|
|
83
|
+
std='[m' # No color.
|
|
84
|
+
else
|
|
85
|
+
red= grn= lgn= blu= mgn= std=
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
|
|
89
|
+
trap "st=129; $do_exit" 1
|
|
90
|
+
trap "st=130; $do_exit" 2
|
|
91
|
+
trap "st=141; $do_exit" 13
|
|
92
|
+
trap "st=143; $do_exit" 15
|
|
93
|
+
|
|
94
|
+
# Test script is run here.
|
|
95
|
+
"$@" >$log_file 2>&1
|
|
96
|
+
estatus=$?
|
|
97
|
+
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
|
98
|
+
estatus=1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
case $estatus:$expect_failure in
|
|
102
|
+
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
|
|
103
|
+
0:*) col=$grn res=PASS recheck=no gcopy=no;;
|
|
104
|
+
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
|
|
105
|
+
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
|
|
106
|
+
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
|
|
107
|
+
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
|
|
108
|
+
esac
|
|
109
|
+
|
|
110
|
+
# Report outcome to console.
|
|
111
|
+
echo "${col}${res}${std}: $test_name"
|
|
112
|
+
|
|
113
|
+
# Register the test result, and other relevant metadata.
|
|
114
|
+
echo ":test-result: $res" > $trs_file
|
|
115
|
+
echo ":global-test-result: $res" >> $trs_file
|
|
116
|
+
echo ":recheck: $recheck" >> $trs_file
|
|
117
|
+
echo ":copy-in-global-log: $gcopy" >> $trs_file
|
|
118
|
+
|
|
119
|
+
# Local Variables:
|
|
120
|
+
# mode: shell-script
|
|
121
|
+
# sh-indentation: 2
|
|
122
|
+
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
123
|
+
# time-stamp-start: "scriptversion="
|
|
124
|
+
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
125
|
+
# time-stamp-time-zone: "UTC"
|
|
126
|
+
# time-stamp-end: "; # UTC"
|
|
127
|
+
# End:
|