diff --git a/python/src/com/jetbrains/python/psi/types/PyType.flex b/python/src/com/jetbrains/python/psi/types/PyType.flex
index a0c74e16bff7..d340b102e809 100644
--- a/python/src/com/jetbrains/python/psi/types/PyType.flex
+++ b/python/src/com/jetbrains/python/psi/types/PyType.flex
@@ -26,6 +26,6 @@ import static com.jetbrains.python.psi.types.PyTypeTokenTypes.*;
[\r\n]+ { return NL; }
[\ \t] { return SPACE; }
(":py"?":class:`"[~!]?)|("`")|([A-Z]"{")|("}") { return MARKUP; }
-("or")|("of")|("from")|("to")|[,\(\)\.\[\]] { return OP; }
+("or")|("of")|("from")|("to")|[,\(\)\.\[\]|] { return OP; }
[T-Z] { return PARAMETER; }
[A-Za-z_][A-Za-z_0-9]* { return IDENTIFIER; }
diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeLexer.java b/python/src/com/jetbrains/python/psi/types/PyTypeLexer.java
index 3b3241b92e36..9d786f5373d1 100644
--- a/python/src/com/jetbrains/python/psi/types/PyTypeLexer.java
+++ b/python/src/com/jetbrains/python/psi/types/PyTypeLexer.java
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.3 on 7/18/13 7:23 PM */
+/* The following code was generated by JFlex 1.4.3 on 7/19/13 2:41 PM */
package com.jetbrains.python.psi.types;
@@ -11,7 +11,7 @@ import static com.jetbrains.python.psi.types.PyTypeTokenTypes.*;
/**
* This class is a scanner generated by
* JFlex 1.4.3
- * on 7/18/13 7:23 PM from the specification file
+ * on 7/19/13 2:41 PM from the specification file
* /home/user/src/idea/tools/lexer/../../python/src/com/jetbrains/python/psi/types/PyType.flex
*/
public class PyTypeLexer implements FlexLexer {
@@ -39,7 +39,7 @@ public class PyTypeLexer implements FlexLexer {
"\2\0\1\24\1\0\1\24\1\0\12\27\1\3\6\0\23\14\7\25"+
"\1\24\1\0\1\24\1\0\1\26\1\12\1\10\1\26\1\6\2\26"+
"\1\21\5\26\1\7\1\22\1\26\1\17\1\4\1\26\1\20\1\11"+
- "\1\23\4\26\1\5\1\26\1\15\1\0\1\16\1\13\uff81\0";
+ "\1\23\4\26\1\5\1\26\1\15\1\24\1\16\1\13\uff81\0";
/**
* Translates characters to character classes
diff --git a/python/src/com/jetbrains/python/psi/types/PyTypeParser.java b/python/src/com/jetbrains/python/psi/types/PyTypeParser.java
index 0967a86a644f..88d45ad11106 100644
--- a/python/src/com/jetbrains/python/psi/types/PyTypeParser.java
+++ b/python/src/com/jetbrains/python/psi/types/PyTypeParser.java
@@ -226,7 +226,7 @@ public class PyTypeParser {
.named("param-expr");
final FunctionalParser unionExpr =
- paramExpr.then(many(op("or").skipThen(paramExpr)))
+ paramExpr.then(many(op("or").or(op("|")).skipThen(paramExpr)))
.map(new Function>, ParseResult>() {
@Override
public ParseResult fun(Pair> value) {
diff --git a/python/testSrc/com/jetbrains/python/PyTypeParserTest.java b/python/testSrc/com/jetbrains/python/PyTypeParserTest.java
index ed9dffea4ae0..178482300029 100644
--- a/python/testSrc/com/jetbrains/python/PyTypeParserTest.java
+++ b/python/testSrc/com/jetbrains/python/PyTypeParserTest.java
@@ -215,4 +215,16 @@ public class PyTypeParserTest extends PyTestCase {
assertNotNull(second);
assertEquals("int", second.getName());
}
+
+ public void testUnionOrOperator() {
+ myFixture.configureByFile("typeParser/typeParser.py");
+ final PyUnionType type = (PyUnionType)PyTypeParser.getTypeByName(myFixture.getFile(), "MyObject | str | unicode");
+ assertNotNull(type);
+ final Collection members = type.getMembers();
+ assertEquals(3, members.size());
+ final List list = new ArrayList(members);
+ assertClassType(list.get(0), "MyObject");
+ assertClassType(list.get(1), "str");
+ assertClassType(list.get(2), "unicode");
+ }
}