mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 15:48:21 +00:00
Internal code reorganization.
- Separate library loading code into a new module. parser.__init__() no longer loads the library; it accepts (but does not depend on) a library as a parameter. - Add an optional library argument to parse(). It's no longer mandatory to create a new parser for switching to a different builtins or seftable file. - Move warning() and types from lslparse to lslcommon. - Add .copy() to uses of base_keywords, to not rely on it being a frozen set. - Adjust the test suite.
This commit is contained in:
parent
1a1531cb40
commit
3f6f8ed8ad
7 changed files with 294 additions and 238 deletions
|
@ -24,7 +24,7 @@ from lslopt.lslparse import parser,EParseSyntax,EParseUEOF,EParseAlreadyDefined,
|
|||
EParseDuplicateLabel,EParseCantChangeState,EParseCodePathWithoutRet
|
||||
from lslopt.lsloutput import outscript
|
||||
from lslopt.lsloptimizer import optimizer
|
||||
from lslopt import lslfuncs
|
||||
from lslopt import lslfuncs, lslloadlib
|
||||
import unittest
|
||||
import os
|
||||
import lslopt.lslcommon
|
||||
|
@ -34,13 +34,13 @@ class UnitTestCase(unittest.TestCase):
|
|||
|
||||
class Test01_LibraryLoader(UnitTestCase):
|
||||
def test_coverage(self):
|
||||
parser(builtins='builtins-unittest.txt')
|
||||
parser()
|
||||
parser(lslloadlib.LoadLibrary(builtins='builtins-unittest.txt'))
|
||||
parser(lslloadlib.LoadLibrary())
|
||||
|
||||
|
||||
class Test02_Parser(UnitTestCase):
|
||||
def setUp(self):
|
||||
self.parser = parser()
|
||||
self.parser = parser(lslloadlib.LoadLibrary())
|
||||
self.outscript = outscript()
|
||||
|
||||
def test_coverage(self):
|
||||
|
@ -248,7 +248,7 @@ class Test02_Parser(UnitTestCase):
|
|||
|
||||
class Test03_Optimizer(UnitTestCase):
|
||||
def setUp(self):
|
||||
self.parser = parser()
|
||||
self.parser = parser(lslloadlib.LoadLibrary())
|
||||
self.opt = optimizer()
|
||||
self.outscript = outscript()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue