Warning, /frameworks/syntax-highlighting/autotests/input/highlight.lex is written in an unsupported language. File is not indexed.
0001 /* This test file tests kates Lex/Flex highlighting */ 0002 0003 %option c++ 0004 %option yyclass="KateTester" 0005 %option yylineno 0006 0007 /* This is a C(++) comment */ 0008 0009 /* This one is a lex comment ! */ 0010 0011 %{ 0012 #include <iostream> 0013 #include "realparser.hpp" 0014 using namespace std; 0015 %} 0016 0017 /* Some definitions */ 0018 DIGIT [0-9] 0019 LETTER [_a-zA-Z] 0020 0021 %% 0022 0023 /* Comment *shall be indented here* */ 0024 [ \t\n\r]+ 0025 0026 /* Note: there is a bad } just here vvv */ 0027 \/\*([^\*]|\*[^/])*\*\/ { foo(a, b, c); } } 0028 0029 /* A start condition scope... */ 0030 <ESC>{ 0031 "a" { 0032 0033 /* C mode ! */ 0034 return 0; 0035 } 0036 0037 "b" %{ 0038 0039 /* C mode, too ! */ 0040 return 0; 0041 %} 0042 0043 "c" return 0; // C++ comment 0044 } 0045 0046 /* Big rule */ 0047 \"([^"\\]|\\.)*\" { 0048 0049 yylval.string_val = new char[strlen(yytext) + 1]; 0050 int j = 0, i = 1; 0051 0052 while (yytext[i] != '"') 0053 if (yytext[i] != '\\') 0054 yylval.string_val[j++] = yytext[i++]; 0055 else 0056 switch (yytext[i + 1]) 0057 { 0058 case 'n': 0059 yylval.string_val[j++] = '\n'; i += 2; 0060 break; 0061 default: 0062 yylval.string_val[j++] << yytext[i + 1], i += 2; 0063 } 0064 0065 yylval.string_val[j] = 0; 0066 return TOK_STRING; 0067 0068 } 0069 0070 /* Dot (match all) */ 0071 . {return yylval.int_val = yytext[0];} 0072 0073 %% 0074 0075 // Here is pure C(++) 0076 #include <iostream> 0077 0078 int main(void) 0079 { 0080 std::cout << "Hello, World\n"; 0081 return 0; 0082 }