diff --git a/tatsu/buffering.py b/tatsu/buffering.py
index 571cc0c..abd303c 100644
--- a/tatsu/buffering.py
+++ b/tatsu/buffering.py
@@ -44,14 +44,13 @@ class Buffer(object):
         self.comments_re = comments_re
         self.eol_comments_re = eol_comments_re
         self.ignorecase = ignorecase
-        self.nameguard = (nameguard
-                          if nameguard is not None
-                          else bool(self.whitespace_re))
+        self.nameguard = (
+            nameguard if nameguard is not None
+            else bool(self.whitespace_re) or bool(namechars)
+        )
         self.comment_recovery = comment_recovery
-        self.namechars = namechars
-        self._namechar_set = set(namechars)
-        if namechars:
-            self.nameguard = True
+        self.namechars = namechars if namechars is not None else ''
+        self._namechar_set = set(self.namechars)
 
         self._pos = 0
         self._len = 0
diff --git a/tatsu/grammars.py b/tatsu/grammars.py
index 039cb22..3646fff 100644
--- a/tatsu/grammars.py
+++ b/tatsu/grammars.py
@@ -6,8 +6,10 @@ import functools
 from collections import defaultdict, Mapping
 from copy import copy
 
-from tatsu.util import indent, trim, ustr, urepr, strtype, compress_seq, chunks
-from tatsu.util import re
+from tatsu.util import (
+    indent, trim, ustr, urepr, strtype, compress_seq, chunks,
+    re, notnone,
+)
 from tatsu.exceptions import FailedRef, GrammarError
 from tatsu.ast import AST
 from tatsu.contexts import ParseContext
@@ -799,6 +801,7 @@ class Grammar(Model):
                  filename='Unknown',
                  whitespace=None,
                  nameguard=None,
+                 namechars=None,
                  left_recursion=None,
                  comments_re=None,
                  eol_comments_re=None,
@@ -829,6 +832,10 @@ class Grammar(Model):
             nameguard = directives.get('nameguard')
         self.nameguard = nameguard
 
+        if namechars is None:
+            namechars = directives.get('namechars')
+        self.namechars = namechars
+
         if left_recursion is None:
             left_recursion = directives.get('left_recursion', True)
         self.left_recursion = left_recursion
@@ -902,6 +909,8 @@ class Grammar(Model):
               comments_re=None,
               eol_comments_re=None,
               parseinfo=None,
+              nameguard=None,
+              namechars=None,
               **kwargs):
         start = start if start is not None else rule_name
         start = start if start is not None else self.rules[0].name
@@ -912,26 +921,17 @@ class Grammar(Model):
             keywords=self.keywords,
             **kwargs)
 
-        if semantics is None:
-            semantics = self.semantics
-
-        if whitespace is None:
-            whitespace = self.whitespace
+        semantics = notnone(semantics, self.semantics)
+        left_recursion = notnone(left_recursion, self.left_recursion)
+        parseinfo = notnone(parseinfo, self._use_parseinfo)
+        comments_re = notnone(comments_re, self.comments_re)
+        eol_comments_re = notnone(eol_comments_re, self.eol_comments_re)
+        nameguard = notnone(nameguard, self.nameguard)
+        namechars = notnone(namechars, self.namechars)
+        whitespace = notnone(whitespace, self.whitespace)
         if whitespace:
             whitespace = re.compile(whitespace)
 
-        if left_recursion is None:
-            left_recursion = self.left_recursion
-
-        if parseinfo is None:
-            parseinfo = self._use_parseinfo
-
-        if comments_re is None:
-            comments_re = self.comments_re
-
-        if eol_comments_re is None:
-            eol_comments_re = self.eol_comments_re
-
         return ctx.parse(
             text,
             rule_name=start,
@@ -943,6 +943,8 @@ class Grammar(Model):
             eol_comments_re=eol_comments_re,
             left_recursion=left_recursion,
             parseinfo=parseinfo,
+            nameguard=nameguard,
+            namechars=namechars,
             **kwargs
         )
 
diff --git a/tatsu/tool.py b/tatsu/tool.py
index 34f0621..5d32bb5 100644
--- a/tatsu/tool.py
+++ b/tatsu/tool.py
@@ -167,7 +167,7 @@ def compile(grammar, name=None, semantics=None, asmodel=False, **kwargs):
 
 
 def parse(grammar, input, start=None, name=None, semantics=None, asmodel=False, **kwargs):
-    model = compile(grammar, name=name, semantics=semantics, asmodel=asmodel, **kwargs)
+    model = compile(grammar, name=name, semantics=semantics, asmodel=asmodel)
     return model.parse(input, start=start, semantics=semantics, **kwargs)
 
 

@@nameguard not honored in simple grammar
I am puzzled by this behavior:

```
from pprint import pprint
from tatsu import parse

GRAMMAR = """
sequence = {fingering}+ ;
fingering = '1' | '2' | '3' | '4' | '5' | 'x' ;
"""

test = "22"
ast = parse(GRAMMAR, test)
pprint(ast)  # Prints ['2', '2']

test = "xx"
ast = parse(GRAMMAR, test)
pprint(ast)  # tatsu.exceptions.FailedParse: (1:1) no available options :
```

Setting the grammar to the following works as expected:

```
GRAMMAR = """
sequence = {fingering}+ ;
fingering = /[1-5x]/ ; 
"""
```

Am I missing something?
diff --git a/test/grammar/directive_test.py b/test/grammar/directive_test.py
index cbc1bd3..b91e86e 100644
--- a/test/grammar/directive_test.py
+++ b/test/grammar/directive_test.py
@@ -134,3 +134,19 @@ class DirectiveTests(unittest.TestCase):
         code = codegen(model)
         self.assertTrue('parseinfo=False' in code)
         compile(code, 'test.py', EXEC)
+
+    def test_nameguard_directive(self):
+        GRAMMAR = '''
+            @@grammar :: test
+            @@nameguard :: False
+            @@namechars :: ''
+
+            start = sequence $ ;
+            sequence = {digit}+ ;
+            digit = 'x' | '1' | '2' | '3' | '4' | '5' ;
+        '''
+
+        model = tatsu.compile(GRAMMAR)
+        self.assertFalse(model.nameguard)
+        self.assertEquals(['2', '3'], model.parse('23'))
+        self.assertEquals(['x', 'x'], model.parse('xx'))

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-flake8 pytest-mypy pytest-pylint
3.9
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
astroid==3.3.9
dill==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
flake8==7.2.0
iniconfig==2.1.0
isort==6.0.1
mccabe==0.7.0
mypy==1.15.0
mypy-extensions==1.0.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
pylint==3.3.6
pytest==8.3.5
pytest-flake8==1.3.0
pytest-mypy==1.0.0
pytest-pylint==0.21.0
-e git+https://github.com/neogeny/TatSu.git@9cae439febc26e686260a0a6c04e805f7f97a45c#egg=TatSu
tomli==2.2.1
tomlkit==0.13.2
typing_extensions==4.13.0

name: TatSu
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
  - 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=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - astroid==3.3.9
      - dill==0.3.9
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - flake8==7.2.0
      - iniconfig==2.1.0
      - isort==6.0.1
      - mccabe==0.7.0
      - mypy==1.15.0
      - mypy-extensions==1.0.0
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.1
      - pylint==3.3.6
      - pytest==8.3.5
      - pytest-flake8==1.3.0
      - pytest-mypy==1.0.0
      - pytest-pylint==0.21.0
      - tomli==2.2.1
      - tomlkit==0.13.2
      - typing-extensions==4.13.0
prefix: /opt/conda/envs/TatSu

test/grammar/directive_test.py::DirectiveTests::test_nameguard_directive
test/grammar/directive_test.py::DirectiveTests::test_eol_comments_re_directive test/grammar/directive_test.py::DirectiveTests::test_grammar_directive test/grammar/directive_test.py::DirectiveTests::test_left_recursion_directive test/grammar/directive_test.py::DirectiveTests::test_parseinfo_directive test/grammar/directive_test.py::DirectiveTests::test_whitespace_directive test/grammar/directive_test.py::DirectiveTests::test_whitespace_no_newlines
tatsu/buffering.py tatsu/tool.py tatsu/grammars.py
tatsu/buffering.py tatsu/tool.py tatsu/grammars.py