Skip to content

Commit

Permalink
[codegen[python] remove more overriding of config settings
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Aug 26, 2023
1 parent e521107 commit 630af55
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
6 changes: 0 additions & 6 deletions tatsu/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ def __init__(self, text, /, config: ParserConfig = None, **settings):
config = ParserConfig.new(
config,
owner=self,
whitespace=None,
nameguard=None,
comments_re='(?sm)[(][*](?:.|\\n)*?[*][)]',
eol_comments_re='#[^\\n]*$',
ignorecase=False,
namechars='',
parseinfo=True,
Expand All @@ -48,10 +45,7 @@ def __init__(self, /, config: ParserConfig = None, **settings):
config = ParserConfig.new(
config,
owner=self,
whitespace=None,
nameguard=None,
comments_re='(?sm)[(][*](?:.|\\n)*?[*][)]',
eol_comments_re='#[^\\n]*$',
ignorecase=False,
namechars='',
parseinfo=True,
Expand Down
11 changes: 1 addition & 10 deletions tatsu/codegen/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,11 @@ def render_fields(self, fields):
else:
nameguard = 'None'

comments_re = repr(self.node.config.comments)
eol_comments_re = repr(self.node.config.eol_comments)
ignorecase = self.node.config.ignorecase
left_recursion = self.node.config.left_recursion
parseinfo = self.node.config.parseinfo
namechars = repr(self.node.config.namechars or '')
eol_comments = eol_comments_re = self.config.eol_comments_re

rules = '\n'.join([
self.get_renderer(rule).render() for rule in self.node.rules
Expand All @@ -492,8 +491,6 @@ def render_fields(self, fields):
whitespace=whitespace,
nameguard=nameguard,
ignorecase=ignorecase,
comments_re=comments_re,
eol_comments_re=eol_comments_re,
left_recursion=left_recursion,
parseinfo=parseinfo,
keywords=keywords,
Expand Down Expand Up @@ -537,10 +534,7 @@ def __init__(self, text, /, config: ParserConfig = None, **settings):
config = ParserConfig.new(
config,
owner=self,
whitespace={whitespace},
nameguard={nameguard},
comments_re={comments_re},
eol_comments_re={eol_comments_re},
ignorecase={ignorecase},
namechars={namechars},
parseinfo={parseinfo},
Expand All @@ -554,10 +548,7 @@ def __init__(self, /, config: ParserConfig = None, **settings):
config = ParserConfig.new(
config,
owner=self,
whitespace={whitespace},
nameguard={nameguard},
comments_re={comments_re},
eol_comments_re={eol_comments_re},
ignorecase={ignorecase},
namechars={namechars},
parseinfo={parseinfo},
Expand Down

0 comments on commit 630af55

Please sign in to comment.