diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch) | |
tree | 5ac38a06f3dde268dc7927dc155896926aaf7012 /kate/tests/highlight.lex | |
download | tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/tests/highlight.lex')
-rw-r--r-- | kate/tests/highlight.lex | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/kate/tests/highlight.lex b/kate/tests/highlight.lex new file mode 100644 index 000000000..33527bd22 --- /dev/null +++ b/kate/tests/highlight.lex @@ -0,0 +1,82 @@ +/* This test file tests kates Lex/Flex highlighting */ + +%option c++ +%option yyclass="KateTester" +%option yylineno + + /* This is a C(++) comment */ + +/* This one is a lex comment ! */ + +%{ +#include <iostream> +#include "realparser.hpp" +using namespace std; +%} + +/* Some definitions */ +DIGIT [0-9] +LETTER [_a-zA-Z] + +%% + + /* Comment *shall be indented here* */ +[ \t\n\r]+ + + /* Note: there is a bad } just here vvv */ +\/\*([^\*]|\*[^/])*\*\/ { foo(a, b, c); } } + + /* A start condition scope... */ +<ESC>{ + "a" { + + /* C mode ! */ + return 0; +} + + "b" %{ + + /* C mode, too ! */ + return 0; +%} + + "c" return 0; // C++ comment +} + + /* Big rule */ +\"([^"\\]|\\.)*\" { + + yylval.string_val = new char[strlen(yytext) + 1]; + int j = 0, i = 1; + + while (yytext[i] != '"') + if (yytext[i] != '\\') + yylval.string_val[j++] = yytext[i++]; + else + switch (yytext[i + 1]) + { + case 'n': + yylval.string_val[j++] = '\n'; i += 2; + break; + default: + yylval.string_val[j++] << yytext[i + 1], i += 2; + } + + yylval.string_val[j] = 0; + return TOK_STRING; + +} + + /* Dot (match all) */ +. {return yylval.int_val = yytext[0];} + +%% + +// Here is pure C(++) +#include <iostream> + +int main(void) +{ + std::cout << "Hello, World\n"; + return 0; +} |