mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[qfmap] Update script.py from io_object_mu
While not necessary for qf (at this stage), this brings in support for optionally not parsing strings and better utf-8 and wide char handling.
This commit is contained in:
parent
900728169e
commit
3413947e0c
1 changed files with 7 additions and 2 deletions
|
@ -25,10 +25,15 @@ class ScriptError(Exception):
|
|||
self.line = line
|
||||
|
||||
class Script:
|
||||
def __init__(self, filename, text, single="{}()':"):
|
||||
def __init__(self, filename, text, single="{}()':", quotes=True):
|
||||
self.filename = filename
|
||||
if text[0:3] == "\xef\xbb\xbf":
|
||||
text = text[3:]
|
||||
elif text[0] == u"\ufeff":
|
||||
text = text[1:]
|
||||
self.text = text
|
||||
self.single = single
|
||||
self.quotes = quotes
|
||||
self.pos = 0
|
||||
self.line = 1
|
||||
self.unget = False
|
||||
|
@ -87,7 +92,7 @@ class Script:
|
|||
if not crossline:
|
||||
self.error("line is incomplete")
|
||||
return None
|
||||
if self.text[self.pos] == "\"":
|
||||
if self.quotes and self.text[self.pos] == "\"":
|
||||
self.pos += 1
|
||||
start = self.pos
|
||||
if self.text[self.pos] == len(self.text):
|
||||
|
|
Loading…
Reference in a new issue