aboutsummaryrefslogtreecommitdiff
path: root/lua/lexers/cpp.lua
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-02-25 20:48:51 +0100
committerMarc André Tanner <mat@brain-dump.org>2017-02-25 21:14:28 +0100
commit3751586e1fbf044fa798737e9c59a0235c5aaee7 (patch)
tree417e30516500092e4002d3a6c2dacdd6b3050d90 /lua/lexers/cpp.lua
parentb44f174cccd4cd2b1b975f2767335ce636ee273b (diff)
downloadvis-3751586e1fbf044fa798737e9c59a0235c5aaee7.tar.gz
vis-3751586e1fbf044fa798737e9c59a0235c5aaee7.tar.xz
lexers: sync with scintillua changeset 594 rev 6e29a8d2a783
Stuff which was left out / our local changes include: - lexer.lua: different loading mechanism and style handling - ansi_c.lua: for now we keep the separate token definitions with references to the respective standards. This should highlight file names after #include directives. It will also treat simple, non-nested occurrences of #if 0 ... #endif as a comment. - pkgbuild.lua: the arch specific fields have been kept - all scintilla $(style variables) have been replaced
Diffstat (limited to 'lua/lexers/cpp.lua')
-rw-r--r--lua/lexers/cpp.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/lua/lexers/cpp.lua b/lua/lexers/cpp.lua
index 6ee1ffb..ec3daad 100644
--- a/lua/lexers/cpp.lua
+++ b/lua/lexers/cpp.lua
@@ -26,10 +26,13 @@ local number = token(l.NUMBER, l.float + l.integer)
-- Preprocessor.
local preproc_word = word_match{
'define', 'elif', 'else', 'endif', 'error', 'if', 'ifdef', 'ifndef', 'import',
- 'include', 'line', 'pragma', 'undef', 'using', 'warning'
+ 'line', 'pragma', 'undef', 'using', 'warning'
}
-local preproc = token(l.PREPROCESSOR,
- l.starts_line('#') * S('\t ')^0 * preproc_word)
+local preproc = #l.starts_line('#') *
+ (token(l.PREPROCESSOR, '#' * S('\t ')^0 * preproc_word) +
+ token(l.PREPROCESSOR, '#' * S('\t ')^0 * 'include') *
+ (token(l.WHITESPACE, S('\t ')^1) *
+ token(l.STRING, l.delimited_range('<>', true, true)))^-1)
-- Keywords.
local keyword = token(l.KEYWORD, word_match{