Skip to content

Commit

Permalink
Add C++ platform-independent types (#1271)
Browse files Browse the repository at this point in the history
* Add platform-independent types

* Add tests and min
  • Loading branch information
isc30 authored and Golmote committed Jan 28, 2018
1 parent 1e5bcf7 commit 3da238f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions components/prism-cpp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Prism.languages.cpp = Prism.languages.extend('c', {
'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
'boolean': /\b(?:true|false)\b/,
'operator': /--?|\+\+?|!=?|<{1,2}=?|>{1,2}=?|->|:{1,2}|={1,2}|\^|~|%|&{1,2}|\|\|?|\?|\*|\/|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
});
Expand All @@ -17,4 +17,4 @@ Prism.languages.insertBefore('cpp', 'string', {
alias: 'string',
greedy: true
}
});
});
2 changes: 1 addition & 1 deletion components/prism-cpp.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion tests/languages/cpp/keyword_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ this thread_local throw try
typedef typeid typename union
unsigned using virtual void
volatile wchar_t while
int8_t int16_t int32_t int64_t
uint8_t uint16_t uint32_t uint64_t

----------------------------------------------------

Expand All @@ -37,7 +39,9 @@ volatile wchar_t while
["keyword", "this"], ["keyword", "thread_local"], ["keyword", "throw"], ["keyword", "try"],
["keyword", "typedef"], ["keyword", "typeid"], ["keyword", "typename"], ["keyword", "union"],
["keyword", "unsigned"], ["keyword", "using"], ["keyword", "virtual"], ["keyword", "void"],
["keyword", "volatile"], ["keyword", "wchar_t"], ["keyword", "while"]
["keyword", "volatile"], ["keyword", "wchar_t"], ["keyword", "while"],
["keyword", "int8_t"], ["keyword", "int16_t"], ["keyword", "int32_t"], ["keyword", "int64_t"],
["keyword", "uint8_t"], ["keyword", "uint16_t"], ["keyword", "uint32_t"], ["keyword", "uint64_t"]
]

----------------------------------------------------
Expand Down

0 comments on commit 3da238f

Please sign in to comment.