diff --git a/crossplane/analyzer.py b/crossplane/analyzer.py
index f5a5ffb..ec89dab 100644
--- a/crossplane/analyzer.py
+++ b/crossplane/analyzer.py
@@ -1920,7 +1920,7 @@ def analyze(fname, stmt, term, ctx=()):
         reason = '"%s" directive is not allowed here' % directive
         raise NgxParserDirectiveContextError(reason, fname, line)
 
-    valid_flag = lambda x: x in ('on', 'off')
+    valid_flag = lambda x: x.lower() in ('on', 'off')
 
     # do this in reverse because we only throw errors at the end if no masks
     # are valid, and typically the first bit mask is what the parser expects
@@ -1942,6 +1942,8 @@ def analyze(fname, stmt, term, ctx=()):
             (mask & NGX_CONF_1MORE and n_args >= 1) or
             (mask & NGX_CONF_2MORE and n_args >= 2)):
             return
+        elif mask & NGX_CONF_FLAG and n_args == 1 and not valid_flag(args[0]):
+            reason = 'invalid value "%s" in "%%s" directive, it must be "on" or "off"' % args[0]
         else:
             reason = 'invalid number of arguments in "%s" directive'
 

NGINX_CONF_FLAG directives should support uppercase ON or OFF as args
`crossplane parse` throws an error for this config but `nginx` does not:
```nginx
events {
    accept_mutex OFF;
}
```
diff --git a/tests/test_analyze.py b/tests/test_analyze.py
index ccb4091..8c36815 100644
--- a/tests/test_analyze.py
+++ b/tests/test_analyze.py
@@ -31,3 +31,30 @@ def test_state_directive():
             raise Exception("bad context for 'state' passed: " + repr(ctx))
         except crossplane.errors.NgxParserDirectiveContextError:
             continue
+
+
+def test_flag_directive_args():
+    fname = '/path/to/nginx.conf'
+    ctx = ('events',)
+
+    # an NGINX_CONF_FLAG directive
+    stmt = {
+        'directive': 'accept_mutex',
+        'line': 2  # this is arbitrary
+    }
+
+    good_args = [['on'], ['off'], ['On'], ['Off'], ['ON'], ['OFF']]
+
+    for args in good_args:
+        stmt['args'] = args
+        crossplane.analyzer.analyze(fname, stmt, term=';', ctx=ctx)
+
+    bad_args = [['1'], ['0'], ['true'], ['okay'], ['']]
+
+    for args in bad_args:
+        stmt['args'] = args
+        try:
+            crossplane.analyzer.analyze(fname, stmt, term=';', ctx=ctx)
+            raise Exception('bad args for flag directive: ' + repr(args))
+        except crossplane.errors.NgxParserDirectiveArgumentsError as e:
+            assert e.strerror.endswith('it must be "on" or "off"')

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/nginxinc/crossplane.git@8709d938119f967ce938dd5163b233ce5439d30d#egg=crossplane
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: crossplane
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=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/crossplane

tests/test_analyze.py::test_flag_directive_args
tests/test_analyze.py::test_state_directive
crossplane/analyzer.py
crossplane/analyzer.py