diff --git a/python/src/com/jetbrains/python/lexer/Python.flex b/python/src/com/jetbrains/python/lexer/Python.flex
index 2cf43f323e6d..884c23503c9e 100644
--- a/python/src/com/jetbrains/python/lexer/Python.flex
+++ b/python/src/com/jetbrains/python/lexer/Python.flex
@@ -73,8 +73,11 @@ TRIPLE_APOS_LITERAL = {THREE_APOS} {APOS_STRING_CHAR}* {THREE_APOS}?
%state IN_DOCSTRING_OWNER
%{
private int getSpaceLength(CharSequence string) {
-int i = Math.max(StringUtil.lastIndexOf(string, '"', 0, string.length()), StringUtil.lastIndexOf(string, '\'', 0, string.length()));
-return yylength()-i-1;
+String string1 = string.toString();
+string1 = StringUtil.trimEnd(string1, "\\");
+string1 = StringUtil.trimEnd(string1, ";");
+final String s = StringUtil.trimTrailing(string1);
+return yylength()-s.length();
}
%}
diff --git a/python/src/com/jetbrains/python/lexer/_PythonLexer.java b/python/src/com/jetbrains/python/lexer/_PythonLexer.java
index 346e6f65c156..75c7f6aa39d1 100644
--- a/python/src/com/jetbrains/python/lexer/_PythonLexer.java
+++ b/python/src/com/jetbrains/python/lexer/_PythonLexer.java
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.3 on 5/28/13 6:11 PM */
+/* The following code was generated by JFlex 1.4.3 on 5/28/13 7:15 PM */
/* It's an automatically generated code. Do not modify it. */
package com.jetbrains.python.lexer;
@@ -12,7 +12,7 @@ import com.intellij.openapi.util.text.StringUtil;
/**
* This class is a scanner generated by
* JFlex 1.4.3
- * on 5/28/13 6:11 PM from the specification file
+ * on 5/28/13 7:15 PM from the specification file
* /home/ktisha/IDEA/tools/lexer/../../python/src/com/jetbrains/python/lexer/Python.flex
*/
class _PythonLexer implements FlexLexer {
@@ -677,8 +677,11 @@ class _PythonLexer implements FlexLexer {
/* user code: */
private int getSpaceLength(CharSequence string) {
-int i = Math.max(StringUtil.lastIndexOf(string, '"', 0, string.length()), StringUtil.lastIndexOf(string, '\'', 0, string.length()));
-return yylength()-i-1;
+String string1 = string.toString();
+string1 = StringUtil.trimEnd(string1, "\\");
+string1 = StringUtil.trimEnd(string1, ";");
+final String s = StringUtil.trimTrailing(string1);
+return yylength()-s.length();
}