summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-04-23 18:45:32 -0600
committerkotfu <kotfu@kotfu.net>2018-04-23 18:45:32 -0600
commit2534df2987a5aec226ce5bfd5b21f1d8f22ed3f2 (patch)
tree3179f760ef1a8c264eaccd535c05273a58f2d784 /cmd2/cmd2.py
parentf47568f8dfdf0a9c909c266b8de3233d1ae8a4fa (diff)
downloadcmd2-git-2534df2987a5aec226ce5bfd5b21f1d8f22ed3f2.tar.gz
No more importing pyparsing
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-xcmd2/cmd2.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index e34db7d5..8aed075b 100755
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -46,7 +46,6 @@ from typing import Callable, List, Optional, Union
import unittest
from code import InteractiveConsole
-import pyparsing
import pyperclip
# Set up readline
@@ -118,12 +117,6 @@ except ImportError:
__version__ = '0.9.0'
-# Pyparsing enablePackrat() can greatly speed up parsing, but problems have been seen in Python 3 in the past
-pyparsing.ParserElement.enablePackrat()
-
-# Override the default whitespace chars in Pyparsing so that newlines are not treated as whitespace
-pyparsing.ParserElement.setDefaultWhitespaceChars(' \t')
-
# The next 2 variables and associated setter functions effect how arguments are parsed for decorated commands
# which use one of the decorators: @with_argument_list, @with_argparser, or @with_argparser_and_unknown_args
@@ -385,24 +378,6 @@ def write_to_paste_buffer(txt: str) -> None:
"""
pyperclip.copy(txt)
-
-# deleteme
-# class ParsedString(str):
-# """Subclass of str which also stores a pyparsing.ParseResults object containing structured parse results."""
-# # pyarsing.ParseResults - structured parse results, to provide multiple means of access to the parsed data
-# parsed = None
-
-# # Function which did the parsing
-# parser = None
-
-# def full_parsed_statement(self):
-# """Used to reconstruct the full parsed statement when a command isn't recognized."""
-# new = ParsedString('%s %s' % (self.parsed.command, self.parsed.args))
-# new.parsed = self.parsed
-# new.parser = self.parser
-# return new
-
-
def replace_with_file_contents(fname: str) -> str:
"""Action to perform when successfully matching parse element definition for inputFrom parser.
@@ -703,11 +678,7 @@ class Cmd(cmd.Cmd):
"""
# Attributes used to configure the ParserManager (all are not dynamically settable at runtime)
blankLinesAllowed = False
- commentGrammars = pyparsing.Or([pyparsing.pythonStyleComment, pyparsing.cStyleComment]) # deleteme
- commentInProgress = pyparsing.Literal('/*') + pyparsing.SkipTo(pyparsing.stringEnd ^ '*/') # deleteme
- legalChars = u'!#$%.:?@_-' + pyparsing.alphanums + pyparsing.alphas8bit # deleteme
multilineCommands = []
- prefixParser = pyparsing.Empty() #deleteme
redirector = '>' # for sending output to file
shortcuts = {'?': 'help', '!': 'shell', '@': 'load', '@@': '_relative_load'}
aliases = dict()
@@ -807,13 +778,6 @@ class Cmd(cmd.Cmd):
aliases=self.aliases,
shortcuts=self.shortcuts,
)
- # self.parser_manager = ParserManager(redirector=self.redirector, terminators=self.terminators,
- # multilineCommands=self.multilineCommands,
- # legalChars=self.legalChars, commentGrammars=self.commentGrammars,
- # commentInProgress=self.commentInProgress,
- # blankLinesAllowed=self.blankLinesAllowed, prefixParser=self.prefixParser,
- # preparse=self.preparse, postparse=self.postparse, aliases=self.aliases,
- # shortcuts=self.shortcuts)
self._transcript_files = transcript_files
# Used to enable the ability for a Python script to quit the application
@@ -897,7 +861,6 @@ class Cmd(cmd.Cmd):
return strip_ansi(self.prompt)
def _finalize_app_parameters(self):
- self.commentGrammars.ignore(pyparsing.quotedString).setParseAction(lambda x: '')
# noinspection PyUnresolvedReferences
self.shortcuts = sorted(self.shortcuts.items(), reverse=True)