| Index: third_party/WebKit/Source/build/scripts/templates/macros.tmpl
|
| diff --git a/third_party/WebKit/Source/build/scripts/templates/macros.tmpl b/third_party/WebKit/Source/build/scripts/templates/macros.tmpl
|
| index 064dd985221d257994df2387b101d11eb14a634d..17a9f4952f510ce1664c028439103e7c6cf4fc56 100644
|
| --- a/third_party/WebKit/Source/build/scripts/templates/macros.tmpl
|
| +++ b/third_party/WebKit/Source/build/scripts/templates/macros.tmpl
|
| @@ -6,3 +6,52 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| {%- endmacro %}
|
| +
|
| +
|
| +{% macro trie_leaf(index, object, return_macro, lowercase_data) %}
|
| +{% set name, value = object.items()[0] %}
|
| +{% if name|length %}
|
| +if (
|
| + {%- for c in name -%}
|
| + {%- if lowercase_data -%}
|
| + {{ " && " if not loop.first }}toASCIILower(data[{{index + loop.index0}}]) == '{{c}}'
|
| + {%- else -%}
|
| + {{ " && " if not loop.first }}data[{{index + loop.index0}}] == '{{c}}'
|
| + {%- endif -%}
|
| + {%- endfor -%}
|
| + )
|
| + return {{ return_macro(value) }};
|
| +break;
|
| +{% else %}
|
| +return {{ return_macro(value) }};
|
| +{% endif %}
|
| +{% endmacro %}
|
| +
|
| +
|
| +{% macro trie_switch(trie, index, return_macro, lowercase_data) %}
|
| +{% if trie|length == 1 and trie.values()[0] is string %}
|
| +{{ trie_leaf(index, trie, return_macro, lowercase_data) -}}
|
| +{% else %}
|
| + {% if lowercase_data %}
|
| +switch (toASCIILower(data[{{index}}])) {
|
| + {% else %}
|
| +switch (data[{{index}}]) {
|
| + {% endif %}
|
| + {% for char, value in trie.items()|sort %}
|
| +case '{{char}}':
|
| + {{ trie_switch(value, index + 1, return_macro, lowercase_data) | indent(4) }}
|
| + {% endfor %}
|
| +}
|
| +break;
|
| +{% endif %}
|
| +{% endmacro %}
|
| +
|
| +
|
| +{% macro trie_length_switch(length_tries, return_macro, lowercase_data) %}
|
| +switch (length) {
|
| +{% for length, trie in length_tries %}
|
| +case {{ length }}:
|
| + {{ trie_switch(trie, 0, return_macro, lowercase_data) | indent(4) }}
|
| +{% endfor %}
|
| +}
|
| +{% endmacro %}
|
|
|