Начал реализовывать конвеер обработки строки перед передачей ее парсеру.

С помощью этого конвеера можно удалять комментарии, удалять ведущие пробельные символы и резолвить значения(макросы)
This commit is contained in:
Rustam Zaitov 2013-11-05 00:44:54 +04:00
parent 542c3cfc66
commit b3f7ff1f7b
8 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,6 @@
class CommentRemover:
def processLine(self, line):
assert line is not None

View File

@ -0,0 +1,5 @@
class Stripper:
def processLine(self, line):
assert line is not None
return line.strip(' \t\n\r')

1
scripts/Core/__init__.py Normal file
View File

@ -0,0 +1 @@
__author__ = 'rzaitov'

View File

@ -0,0 +1 @@
__author__ = 'rzaitov'

View File

@ -0,0 +1,13 @@
import unittest
from Core.LineConveyor.Stripper import Stripper
class TestStripper(unittest.TestCase):
def setUp(self):
self.stripper = Stripper()
def test_stripLine(self):
line = ' \tSome text \t\r\n'
newLine = self.stripper.processLine(line)
self.assertEqual('Some text', newLine)

View File

@ -9,7 +9,7 @@ baseDir = os.path.join(scriptDir, os.pardir)
os.chdir(baseDir)
from StepRunner.StepsRunner import StepsRunner
from Core.StepsRunner import StepsRunner
class TaskRunner: