diff options
| author | mitchell <unknown> | 2019-09-20 17:57:42 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2019-09-20 17:57:42 -0400 |
| commit | fe75f635a82e9d94b06f1946bbfafd425477d713 (patch) | |
| tree | 57b6b586bf0f607b90643eef5bb771fb1d9b8ffd /lexlua/ansi_c.lua | |
| parent | 6c40cce450334058993dd5dda238b407a60e97ba (diff) | |
| download | scintilla-mirror-fe75f635a82e9d94b06f1946bbfafd425477d713.tar.gz | |
lexlua: C lexer recognizes indented preprocessor words.
Diffstat (limited to 'lexlua/ansi_c.lua')
| -rw-r--r-- | lexlua/ansi_c.lua | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lexlua/ansi_c.lua b/lexlua/ansi_c.lua index 8b7707495..da898fd5d 100644 --- a/lexlua/ansi_c.lua +++ b/lexlua/ansi_c.lua @@ -55,10 +55,8 @@ lex:add_rule('string', token(lexer.STRING, sq_str + dq_str)) -- Comments. local line_comment = '//' * lexer.nonnewline_esc^0 local block_comment = '/*' * (lexer.any - '*/')^0 * P('*/')^-1 + - lexer.starts_line('#if') * S(' \t')^0 * '0' * - lexer.space * - (lexer.any - lexer.starts_line('#endif'))^0 * - (lexer.starts_line('#endif'))^-1 + '#if' * S(' \t')^0 * '0' * lexer.space * + (lexer.any - '#endif')^0 * P('#endif')^-1 lex:add_rule('comment', token(lexer.COMMENT, line_comment + block_comment)) -- Numbers. @@ -69,7 +67,6 @@ local preproc_word = word_match[[ define elif else endif if ifdef ifndef line pragma undef ]] lex:add_rule('preprocessor', - #lexer.starts_line('#') * (token(lexer.PREPROCESSOR, '#' * S('\t ')^0 * preproc_word) + token(lexer.PREPROCESSOR, '#' * S('\t ')^0 * 'include') * (token(lexer.WHITESPACE, S('\t ')^1) * |
