Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector false positive #3438

Merged
merged 2 commits into from Dec 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -15,6 +15,7 @@ These changes should be for the better and should not be super noticeable but if
Grammars:

- enh(php) add PHP 8.1 keywords [Wojciech Kania][]
- fix(cpp) fix `vector<<` template false positive (#3437) [Josh Goebel][]
- enh(php) support First-class Callable Syntax (#3427) [Wojciech Kania][]
- enh(php) support class constructor call (#3427) [Wojciech Kania][]
- enh(php) support function invoke (#3427) [Wojciech Kania][]
Expand Down
2 changes: 1 addition & 1 deletion src/languages/cpp.js
Expand Up @@ -558,7 +558,7 @@ export default function(hljs) {
[
PREPROCESSOR,
{ // containers: ie, `vector <int> rooms (9);`
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<',
begin: '\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function)\\s*<(?!<)',
end: '>',
keywords: CPP_KEYWORDS,
contains: [
Expand Down
6 changes: 6 additions & 0 deletions test/markup/cpp/bugs.expect.txt
@@ -0,0 +1,6 @@
<span class="hljs-comment">//4. 对角矩阵</span>
<span class="hljs-comment">//4.1 构造对角矩阵</span>
<span class="hljs-function">Eigen::VectorXd <span class="hljs-title">vector</span><span class="hljs-params">(<span class="hljs-number">5</span>)</span></span>; <span class="hljs-comment">//构建5维向量</span>
vector&lt;&lt;<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>; <span class="hljs-comment">//向量赋值</span>
<span class="hljs-function">Eigen::MatrixXd <span class="hljs-title">C</span><span class="hljs-params">(vector.asDiagonal())</span></span>; <span class="hljs-comment">//使用向量生成对角阵</span>
std::cout &lt;&lt; <span class="hljs-string">&quot;\nC= \n&quot;</span> &lt;&lt; C &lt;&lt; std::endl;
6 changes: 6 additions & 0 deletions test/markup/cpp/bugs.txt
@@ -0,0 +1,6 @@
//4. 对角矩阵
//4.1 构造对角矩阵
Eigen::VectorXd vector(5); //构建5维向量
vector<<1,2,3,4,5; //向量赋值
Eigen::MatrixXd C(vector.asDiagonal()); //使用向量生成对角阵
std::cout << "\nC= \n" << C << std::endl;