我正在编辑WebStorm中的HTML页面。出于某种原因,它会将常规文本视为JavaScript语句,并在代码检查和预期换行符或分号时抛出错误。如果文本在锚标记内,则不会出错。
这是一个错误吗?我的JavaScript版本设置为ES6。
显示错误的HTML文字:
WebStorm代码检查错误:
答案 0 :(得分:1)
#include <iostream>
#include <type_traits>
#include <utility>
namespace detail {
template <typename Pack> struct sequence_traits;
template <typename T, template <T...> class Z, T... Is>
struct sequence_traits<Z<Is...>> {
using type = T;
template <T... Js>
using templ_type = Z<Js...>;
};
}
// accumulated_sums
template <typename T, typename Output, template <T...> class, T...> struct accumulated_sums_h;
template <typename T, template <T...> class Z, template <T...> class Q, T Sum, T... Is>
struct accumulated_sums_h<T, Z<Sum, Is...>, Q> {
using type = Q<Is..., Sum>;
};
template <typename T, template <T...> class Z, T Sum, T... Is, template <T...> class Q, T Next, T... Rest>
struct accumulated_sums_h<T, Z<Sum, Is...>, Q, Next, Rest...> :
accumulated_sums_h<T, Z<Sum + Next, Is..., Sum>, Q, Rest...> {};
template <typename Sequence,
template <typename detail::sequence_traits<Sequence>::type...> class = detail::sequence_traits<Sequence>::template templ_type>
struct accumulated_sums;
template <typename T, template <T...> class Z, T First, T... Rest, template <T...> class Q>
struct accumulated_sums<Z<First, Rest...>, Q> :
accumulated_sums_h<T, Z<First>, Q, Rest...> {};
// accumulated
template <typename T, typename Output, template <typename U, U...> class, T...> struct accumulated_h;
template <typename T, template <T...> class Z, template <typename U, U...> class Q, T Sum, T... Is>
struct accumulated_h<T, Z<Sum, Is...>, Q> {
using type = Q<T, Is..., Sum>;
};
template <typename T, template <T...> class Z, T Sum, T... Is, template <typename U, U...> class Q, T Next, T... Rest>
struct accumulated_h<T, Z<Sum, Is...>, Q, Next, Rest...> :
accumulated_h<T, Z<Sum + Next, Is..., Sum>, Q, Rest...> {};
template <typename Sequence, template <typename U, U...> class Q> struct accumulated;
template <typename T, template <T...> class Z, T First, T... Rest, template <typename U, U...> class Q>
struct accumulated<Z<First, Rest...>, Q> :
accumulated_h<T, Z<First>, Q, Rest...> {};
// Testing
template <int...> struct Z;
template <int...> struct Q;
template <std::size_t...> struct I;
int main() {
std::cout << std::boolalpha << std::is_same<
accumulated_sums<Z<1,2,3,4,5>, Q>::type,
Q<1,3,6,10,15>
>::value << '\n'; // true
std::cout << std::is_same<
accumulated_sums<Z<1,2,3,4,5>>::type,
Z<1,3,6,10,15>
>::value << '\n'; // true
std::cout << std::is_same<
accumulated<Z<1,2,3,4,5>, std::integer_sequence>::type,
std::integer_sequence<int, 1,3,6,10,15>
>::value << '\n'; // true
std::cout << std::is_same<
accumulated<I<1,2,3,4,5>, std::integer_sequence>::type,
std::index_sequence<1,3,6,10,15>
>::value << '\n'; // true
}
你以某种方式(意外地)创建了这样的错误注入规则,现在每个Settings/Preferences | Editor | Language Injections
标记都被视为AngularJS,因此警告。