From dbae4b3e0fe5c1a230724ce6e30cbf353e04f2ba Mon Sep 17 00:00:00 2001 From: Pablo Emilio Escobar Gaviria Date: Tue, 2 Feb 2021 13:54:38 +0000 Subject: [PATCH] Marked adtional methods of Tokenise as private This methods are only useful internally and are not used by core anywhere --- mathics_scanner/tokeniser.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mathics_scanner/tokeniser.py b/mathics_scanner/tokeniser.py index c6fb01e..958efa2 100644 --- a/mathics_scanner/tokeniser.py +++ b/mathics_scanner/tokeniser.py @@ -367,10 +367,9 @@ def __init__(self, feeder): self.feeder = feeder self.prescanner = Prescanner(feeder) self.code = self.prescanner.scan() - self.change_mode("expr") + self._change_mode("expr") - # TODO: Turn this into a setter in the future? - def change_mode(self, mode): + def _change_mode(self, mode): """ Set the mode of the tokeniser """ @@ -396,7 +395,7 @@ def sntx_message(self, pos=None): # TODO: Convert this to __next__ in the future? def next(self): "Returns the next token" - self.skip_blank() + self._skip_blank() if self.pos >= len(self.code): return Token("END", "", len(self.code)) @@ -428,7 +427,7 @@ def next(self): self.pos = match.end(0) return Token(tag, text, match.start(0)) - def skip_blank(self): + def _skip_blank(self): "Skip whitespace and comments" comment = [] # start positions of comments while True: @@ -499,7 +498,7 @@ def _token_mode(self, match, tag, mode): "consume a token and switch mode" text = match.group(0) self.pos = match.end(0) - self.change_mode(mode) + self._change_mode(mode) return Token(tag, text, match.start(0)) def t_Get(self, match):