diff --git a/stix2/pattern_visitor.py b/stix2/pattern_visitor.py
index 5b8300f..c4deb64 100644
--- a/stix2/pattern_visitor.py
+++ b/stix2/pattern_visitor.py
@@ -49,6 +49,9 @@ def check_for_valid_timetamp_syntax(timestamp_string):
     return _TIMESTAMP_RE.match(timestamp_string)
 
 
+def same_boolean_operator(current_op, op_token):
+    return current_op == op_token.symbol.text
+
 
 class STIXPatternVisitorForSTIX2():
     classes = {}
@@ -131,7 +134,7 @@ class STIXPatternVisitorForSTIX2():
         if len(children) == 1:
             return children[0]
         else:
-            if isinstance(children[0], _BooleanExpression):
+            if isinstance(children[0], _BooleanExpression) and same_boolean_operator(children[0].operator, children[1]):
                 children[0].operands.append(children[2])
                 return children[0]
             else:

Pattern AST creation bug
Comparison expression ORs can get changed to ANDs:

```python
from stix2.pattern_visitor import create_pattern_object

ast = create_pattern_object(pattern="[a:b=1 AND a:b=2 OR a:b=3]")

print(ast)
```
produces
```
[a:b = 1 AND a:b = 2 AND a:b = 3]
```

diff --git a/stix2/test/v20/test_pattern_expressions.py b/stix2/test/v20/test_pattern_expressions.py
index a96d3b8..0e0a9ca 100644
--- a/stix2/test/v20/test_pattern_expressions.py
+++ b/stix2/test/v20/test_pattern_expressions.py
@@ -511,6 +511,16 @@ def test_parsing_start_stop_qualified_expression():
     ) == "[ipv4-addr:value = '1.2.3.4'] START '2016-06-01T00:00:00Z' STOP '2017-03-12T08:30:00Z'"
 
 
+def test_parsing_mixed_boolean_expression_1():
+    patt_obj = create_pattern_object("[a:b = 1 AND a:b = 2 OR a:b = 3]",)
+    assert str(patt_obj) == "[a:b = 1 AND a:b = 2 OR a:b = 3]"
+
+
+def test_parsing_mixed_boolean_expression_2():
+    patt_obj = create_pattern_object("[a:b = 1 OR a:b = 2 AND a:b = 3]",)
+    assert str(patt_obj) == "[a:b = 1 OR a:b = 2 AND a:b = 3]"
+
+
 def test_parsing_illegal_start_stop_qualified_expression():
     with pytest.raises(ValueError):
         create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START '2016-06-01' STOP '2017-03-12T08:30:00Z'", version="2.0")
diff --git a/stix2/test/v21/test_pattern_expressions.py b/stix2/test/v21/test_pattern_expressions.py
index 8294a41..b574e05 100644
--- a/stix2/test/v21/test_pattern_expressions.py
+++ b/stix2/test/v21/test_pattern_expressions.py
@@ -644,6 +644,16 @@ def test_parsing_boolean():
     assert str(patt_obj) == "[network-traffic:is_active = true]"
 
 
+def test_parsing_mixed_boolean_expression_1():
+    patt_obj = create_pattern_object("[a:b = 1 AND a:b = 2 OR a:b = 3]",)
+    assert str(patt_obj) == "[a:b = 1 AND a:b = 2 OR a:b = 3]"
+
+
+def test_parsing_mixed_boolean_expression_2():
+    patt_obj = create_pattern_object("[a:b = 1 OR a:b = 2 AND a:b = 3]",)
+    assert str(patt_obj) == "[a:b = 1 OR a:b = 2 AND a:b = 3]"
+
+
 def test_parsing_multiple_slashes_quotes():
     patt_obj = create_pattern_object("[ file:name = 'weird_name\\'' ]", version="2.1")
     assert str(patt_obj) == "[file:name = 'weird_name\\'']"

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
antlr4-python3-runtime==4.9.3
attrs==24.2.0
Babel==2.14.0
backcall==0.2.0
beautifulsoup4==4.13.3
bleach==6.0.0
bump2version==1.0.1
bumpversion==0.6.0
cachetools==5.5.2
certifi @ file:///croot/certifi_1671487769961/work/certifi
cfgv==3.3.1
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.2.7
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.17.1
entrypoints==0.4
exceptiongroup==1.2.2
execnet==2.0.2
fastjsonschema==2.21.1
filelock==3.12.2
identify==2.5.24
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
importlib-resources==5.12.0
iniconfig==2.0.0
ipython==7.34.0
jedi==0.19.2
Jinja2==3.1.6
jsonschema==4.17.3
jupyter_client==7.4.9
jupyter_core==4.12.0
jupyterlab-pygments==0.2.2
MarkupSafe==2.1.5
matplotlib-inline==0.1.6
mistune==3.0.2
nbclient==0.7.4
nbconvert==7.6.0
nbformat==5.8.0
nbsphinx==0.4.3
nest-asyncio==1.6.0
nodeenv==1.9.1
packaging==24.0
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pkgutil_resolve_name==1.3.10
platformdirs==4.0.0
pluggy==1.2.0
pre-commit==2.21.0
prompt_toolkit==3.0.48
ptyprocess==0.7.0
Pygments==2.17.2
pyproject-api==1.5.3
pyrsistent==0.19.3
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-xdist==3.5.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
pyzmq==26.2.1
requests==2.31.0
simplejson==3.20.1
six==1.17.0
snowballstemmer==2.2.0
soupsieve==2.4.1
Sphinx==1.8.6
sphinx-prompt==1.5.0
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-websupport==1.2.4
-e git+https://github.com/oasis-open/cti-python-stix2.git@bb82beeec109e5e45d3ee19da97f4cd145b3491d#egg=stix2
stix2-patterns==2.0.0
tinycss2==1.2.1
tomli==2.0.1
tornado==6.2
tox==4.8.0
traitlets==5.9.0
typing_extensions==4.7.1
urllib3==2.0.7
virtualenv==20.26.6
wcwidth==0.2.13
webencodings==0.5.1
zipp==3.15.0

name: cti-python-stix2
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - antlr4-python3-runtime==4.9.3
      - attrs==24.2.0
      - babel==2.14.0
      - backcall==0.2.0
      - beautifulsoup4==4.13.3
      - bleach==6.0.0
      - bump2version==1.0.1
      - bumpversion==0.6.0
      - cachetools==5.5.2
      - cfgv==3.3.1
      - chardet==5.2.0
      - charset-normalizer==3.4.1
      - colorama==0.4.6
      - coverage==7.2.7
      - decorator==5.1.1
      - defusedxml==0.7.1
      - distlib==0.3.9
      - docutils==0.17.1
      - entrypoints==0.4
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - fastjsonschema==2.21.1
      - filelock==3.12.2
      - identify==2.5.24
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==6.7.0
      - importlib-resources==5.12.0
      - iniconfig==2.0.0
      - ipython==7.34.0
      - jedi==0.19.2
      - jinja2==3.1.6
      - jsonschema==4.17.3
      - jupyter-client==7.4.9
      - jupyter-core==4.12.0
      - jupyterlab-pygments==0.2.2
      - markupsafe==2.1.5
      - matplotlib-inline==0.1.6
      - mistune==3.0.2
      - nbclient==0.7.4
      - nbconvert==7.6.0
      - nbformat==5.8.0
      - nbsphinx==0.4.3
      - nest-asyncio==1.6.0
      - nodeenv==1.9.1
      - packaging==24.0
      - pandocfilters==1.5.1
      - parso==0.8.4
      - pexpect==4.9.0
      - pickleshare==0.7.5
      - pkgutil-resolve-name==1.3.10
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pre-commit==2.21.0
      - prompt-toolkit==3.0.48
      - ptyprocess==0.7.0
      - pygments==2.17.2
      - pyproject-api==1.5.3
      - pyrsistent==0.19.3
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyyaml==6.0.1
      - pyzmq==26.2.1
      - requests==2.31.0
      - simplejson==3.20.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - soupsieve==2.4.1
      - sphinx==1.8.6
      - sphinx-prompt==1.5.0
      - sphinxcontrib-serializinghtml==1.1.5
      - sphinxcontrib-websupport==1.2.4
      - stix2-patterns==2.0.0
      - tinycss2==1.2.1
      - tomli==2.0.1
      - tornado==6.2
      - tox==4.8.0
      - traitlets==5.9.0
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - virtualenv==20.26.6
      - wcwidth==0.2.13
      - webencodings==0.5.1
      - zipp==3.15.0
prefix: /opt/conda/envs/cti-python-stix2

stix2/test/v20/test_pattern_expressions.py::test_parsing_mixed_boolean_expression_1 stix2/test/v21/test_pattern_expressions.py::test_parsing_mixed_boolean_expression_1
stix2/test/v20/test_pattern_expressions.py::test_create_comparison_expression stix2/test/v20/test_pattern_expressions.py::test_boolean_expression stix2/test/v20/test_pattern_expressions.py::test_boolean_expression_with_parentheses stix2/test/v20/test_pattern_expressions.py::test_hash_followed_by_registryKey_expression_python_constant stix2/test/v20/test_pattern_expressions.py::test_hash_followed_by_registryKey_expression stix2/test/v20/test_pattern_expressions.py::test_file_observable_expression stix2/test/v20/test_pattern_expressions.py::test_multiple_file_observable_expression[AndObservationExpression-AND] stix2/test/v20/test_pattern_expressions.py::test_multiple_file_observable_expression[OrObservationExpression-OR] stix2/test/v20/test_pattern_expressions.py::test_root_types stix2/test/v20/test_pattern_expressions.py::test_artifact_payload stix2/test/v20/test_pattern_expressions.py::test_greater_than_python_constant stix2/test/v20/test_pattern_expressions.py::test_greater_than stix2/test/v20/test_pattern_expressions.py::test_less_than stix2/test/v20/test_pattern_expressions.py::test_greater_than_or_equal stix2/test/v20/test_pattern_expressions.py::test_less_than_or_equal stix2/test/v20/test_pattern_expressions.py::test_not stix2/test/v20/test_pattern_expressions.py::test_and_observable_expression stix2/test/v20/test_pattern_expressions.py::test_invalid_and_observable_expression stix2/test/v20/test_pattern_expressions.py::test_hex stix2/test/v20/test_pattern_expressions.py::test_multiple_qualifiers stix2/test/v20/test_pattern_expressions.py::test_set_op stix2/test/v20/test_pattern_expressions.py::test_timestamp stix2/test/v20/test_pattern_expressions.py::test_boolean stix2/test/v20/test_pattern_expressions.py::test_binary stix2/test/v20/test_pattern_expressions.py::test_list stix2/test/v20/test_pattern_expressions.py::test_list2 stix2/test/v20/test_pattern_expressions.py::test_invalid_constant_type stix2/test/v20/test_pattern_expressions.py::test_invalid_integer_constant stix2/test/v20/test_pattern_expressions.py::test_invalid_float_constant stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[True-True0] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[False-False0] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[True-True1] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[False-False1] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[true-True] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[false-False] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[t-True] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[f-False] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[T-True] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[F-False] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[1-True] stix2/test/v20/test_pattern_expressions.py::test_boolean_constant[0-False] stix2/test/v20/test_pattern_expressions.py::test_invalid_boolean_constant stix2/test/v20/test_pattern_expressions.py::test_invalid_hash_constant[MD5-zzz] stix2/test/v20/test_pattern_expressions.py::test_invalid_hash_constant[ssdeep-zzz==] stix2/test/v20/test_pattern_expressions.py::test_invalid_hex_constant stix2/test/v20/test_pattern_expressions.py::test_invalid_binary_constant stix2/test/v20/test_pattern_expressions.py::test_escape_quotes_and_backslashes stix2/test/v20/test_pattern_expressions.py::test_like stix2/test/v20/test_pattern_expressions.py::test_issuperset stix2/test/v20/test_pattern_expressions.py::test_repeat_qualifier stix2/test/v20/test_pattern_expressions.py::test_invalid_repeat_qualifier stix2/test/v20/test_pattern_expressions.py::test_invalid_within_qualifier stix2/test/v20/test_pattern_expressions.py::test_startstop_qualifier stix2/test/v20/test_pattern_expressions.py::test_invalid_startstop_qualifier stix2/test/v20/test_pattern_expressions.py::test_make_constant_already_a_constant stix2/test/v20/test_pattern_expressions.py::test_parsing_comparison_expression stix2/test/v20/test_pattern_expressions.py::test_parsing_qualified_expression stix2/test/v20/test_pattern_expressions.py::test_parsing_start_stop_qualified_expression stix2/test/v20/test_pattern_expressions.py::test_parsing_mixed_boolean_expression_2 stix2/test/v20/test_pattern_expressions.py::test_parsing_illegal_start_stop_qualified_expression stix2/test/v20/test_pattern_expressions.py::test_list_constant stix2/test/v21/test_pattern_expressions.py::test_create_comparison_expression stix2/test/v21/test_pattern_expressions.py::test_boolean_expression stix2/test/v21/test_pattern_expressions.py::test_boolean_expression_with_parentheses stix2/test/v21/test_pattern_expressions.py::test_hash_followed_by_registryKey_expression_python_constant stix2/test/v21/test_pattern_expressions.py::test_hash_followed_by_registryKey_expression stix2/test/v21/test_pattern_expressions.py::test_file_observable_expression stix2/test/v21/test_pattern_expressions.py::test_multiple_file_observable_expression[AndObservationExpression-AND] stix2/test/v21/test_pattern_expressions.py::test_multiple_file_observable_expression[OrObservationExpression-OR] stix2/test/v21/test_pattern_expressions.py::test_root_types stix2/test/v21/test_pattern_expressions.py::test_artifact_payload stix2/test/v21/test_pattern_expressions.py::test_greater_than_python_constant stix2/test/v21/test_pattern_expressions.py::test_greater_than stix2/test/v21/test_pattern_expressions.py::test_parsing_greater_than stix2/test/v21/test_pattern_expressions.py::test_less_than stix2/test/v21/test_pattern_expressions.py::test_parsing_less_than stix2/test/v21/test_pattern_expressions.py::test_greater_than_or_equal stix2/test/v21/test_pattern_expressions.py::test_parsing_greater_than_or_equal stix2/test/v21/test_pattern_expressions.py::test_less_than_or_equal stix2/test/v21/test_pattern_expressions.py::test_parsing_less_than_or_equal stix2/test/v21/test_pattern_expressions.py::test_parsing_issubset stix2/test/v21/test_pattern_expressions.py::test_parsing_issuperset stix2/test/v21/test_pattern_expressions.py::test_parsing_like stix2/test/v21/test_pattern_expressions.py::test_parsing_match stix2/test/v21/test_pattern_expressions.py::test_parsing_followed_by stix2/test/v21/test_pattern_expressions.py::test_not stix2/test/v21/test_pattern_expressions.py::test_and_observable_expression stix2/test/v21/test_pattern_expressions.py::test_parsing_and_observable_expression stix2/test/v21/test_pattern_expressions.py::test_or_observable_expression stix2/test/v21/test_pattern_expressions.py::test_parsing_or_observable_expression stix2/test/v21/test_pattern_expressions.py::test_invalid_and_observable_expression stix2/test/v21/test_pattern_expressions.py::test_hex stix2/test/v21/test_pattern_expressions.py::test_parsing_hex stix2/test/v21/test_pattern_expressions.py::test_multiple_qualifiers stix2/test/v21/test_pattern_expressions.py::test_set_op stix2/test/v21/test_pattern_expressions.py::test_timestamp stix2/test/v21/test_pattern_expressions.py::test_boolean stix2/test/v21/test_pattern_expressions.py::test_binary stix2/test/v21/test_pattern_expressions.py::test_parsing_binary stix2/test/v21/test_pattern_expressions.py::test_list stix2/test/v21/test_pattern_expressions.py::test_list2 stix2/test/v21/test_pattern_expressions.py::test_invalid_constant_type stix2/test/v21/test_pattern_expressions.py::test_invalid_integer_constant stix2/test/v21/test_pattern_expressions.py::test_invalid_timestamp_constant stix2/test/v21/test_pattern_expressions.py::test_invalid_float_constant stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[True-True0] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[False-False0] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[True-True1] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[False-False1] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[true-True] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[false-False] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[t-True] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[f-False] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[T-True] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[F-False] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[1-True] stix2/test/v21/test_pattern_expressions.py::test_boolean_constant[0-False] stix2/test/v21/test_pattern_expressions.py::test_invalid_boolean_constant stix2/test/v21/test_pattern_expressions.py::test_invalid_hash_constant[MD5-zzz] stix2/test/v21/test_pattern_expressions.py::test_invalid_hash_constant[SSDEEP-zzz==] stix2/test/v21/test_pattern_expressions.py::test_invalid_hex_constant stix2/test/v21/test_pattern_expressions.py::test_invalid_binary_constant stix2/test/v21/test_pattern_expressions.py::test_escape_quotes_and_backslashes stix2/test/v21/test_pattern_expressions.py::test_like stix2/test/v21/test_pattern_expressions.py::test_issuperset stix2/test/v21/test_pattern_expressions.py::test_repeat_qualifier stix2/test/v21/test_pattern_expressions.py::test_invalid_repeat_qualifier stix2/test/v21/test_pattern_expressions.py::test_invalid_within_qualifier stix2/test/v21/test_pattern_expressions.py::test_startstop_qualifier stix2/test/v21/test_pattern_expressions.py::test_invalid_startstop_qualifier stix2/test/v21/test_pattern_expressions.py::test_make_constant_already_a_constant stix2/test/v21/test_pattern_expressions.py::test_parsing_comparison_expression stix2/test/v21/test_pattern_expressions.py::test_parsing_repeat_and_within_qualified_expression stix2/test/v21/test_pattern_expressions.py::test_parsing_start_stop_qualified_expression stix2/test/v21/test_pattern_expressions.py::test_list_constant stix2/test/v21/test_pattern_expressions.py::test_parsing_boolean stix2/test/v21/test_pattern_expressions.py::test_parsing_mixed_boolean_expression_2 stix2/test/v21/test_pattern_expressions.py::test_parsing_multiple_slashes_quotes stix2/test/v21/test_pattern_expressions.py::test_parse_error
stix2/pattern_visitor.py
stix2/pattern_visitor.py