diff --git a/CodeLite/PhpLexer.l b/CodeLite/PhpLexer.l index b52fb6894d..3da6230d9c 100644 --- a/CodeLite/PhpLexer.l +++ b/CodeLite/PhpLexer.l @@ -40,6 +40,8 @@ extern "C" int yywrap(void*) { return 1; } return x;\ } +int bracket_count = 0; + %} /* regex and modes */ @@ -55,6 +57,7 @@ extern "C" int yywrap(void*) { return 1; } %x HEREDOC %x DSTRING %x SINGLE_STRING +%x ATTRIBUTE identifier [a-zA-Z_][0-9a-zA-Z_]* @@ -196,6 +199,24 @@ horizontal_white [ ]|{h_tab} userData->AppendToComment(yytext[0]); } } +"#[" { + BEGIN(ATTRIBUTE); + bracket_count = 1; +} +"[" { + bracket_count++; +} +"]" { + bracket_count--; + if (bracket_count == 0) { + BEGIN(PHP); + return ATTRIBUTE; + } +} +"\n" { +} +. { +} "//"|"#" { BEGIN(CPP_COMMENT);