blob: cf7e6e19bfd676c30e372510743f28f6bcc48d16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
def parse_args(text):
#print "parsing: [%s]" %text
escape = False
string = False
result = []
token = str()
value = 0;
for c in text:
#print "[%s]%s: %s: %s" %(token, c, escape, string)
if c == '\\':
escape = True
continue
if escape:
if not string:
raise SyntaxError("escape found in no string: %s" %text);
#print "escaping[%s]" %c
escape = False
token += c
continue
if string:
if c == '\'' or c == '"':
string = False
token += c
continue
if c == '\'' or c == '"':
string = True
token += c
continue
if c == ',':
result.append(token.strip())
token = str()
continue
if c == ';': #comment, bailing out
break
token += c
#token = token.strip()
if len(token):
result.append(token)
#print result
return result
def compile(width, data):
print data
return data
|