Files @ 5781a5a0b2fb
Branch filter:

Location: Diana/src/sgfParser.py - annotation

Laman
SGF nodes aware of their neighbours in the tree
  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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
5781a5a0b2fb
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
f0b8120281b9
import re


def skipWhitespace(s,start):
	i=start
	while i<len(s) and s[i].isspace(): i+=1
	return i


class Collection:
	def __init__(self,s):
		self.gameTrees=[]
		i,x=GameTree.create(s,0)
		if x is None:
			print("error when parsing Collection")
			return
		while x is not None:
			self.gameTrees.append(x)
			i,x=GameTree.create(s,i)

	def listGames(self):
		for tree in self.gameTrees:
			for game in tree.listGames(): yield game


class GameTree:
	def __init__(self):
		self.nodes=[]
		self.branches=[]

	@staticmethod
	def create(s,start):
		res=GameTree()
		i=skipWhitespace(s,start)
		if i>=len(s) or s[i]!="(":
			# print("error when parsing GameTree")
			return (start,None)
		i,x=Node.create(s,start+1)
		if x is None:
			# print("error when parsing GameTree")
			return (i,None)
		y=None
		while x is not None:
			res.nodes.append(x)
			if y: y.addChild(x)
			x.setParent(y)
			y=x
			i=skipWhitespace(s,i)
			i,x=Node.create(s,i)
		i=skipWhitespace(s,i)
		i,x=GameTree.create(s,i)
		while x is not None:
			res.branches.append(x)
			subroot=x.getNode(0)
			if subroot:
				subroot.setParent(y)
			if y: y.addChild(subroot)
			i=skipWhitespace(s,i)
			i,x=GameTree.create(s,i)
		if s[i]!=")":
			# print("error when parsing GameTree")
			return (i,None)
		return (i+1,res)

	## Expand multiple games into distinct GameTrees and yield each.
	def listGames(self):
		for node in self._listGINodes():
			yield self._buildSubtree(node)

	def getNode(self,i):
		if 0<=i<len(self.nodes):
			return self.nodes[i]
		return None

	## Create and return a new GameTree containing the provided Node.
	#
	# The Node objects are shared between the trees, not copied.
	def _buildSubtree(self,node):
		res=GameTree()

		return res
		# chci celou cestu ke kořeni a všechny podstromy nodu

	## Find and yield Game Info nodes.
	def _listGINodes(self):
		for node in self.nodes:
			if node.isGINode():
				yield node
		for tree in self.branches:
			for node in tree._listGINodes():
				yield node


class Node:
	def __init__(self):
		self.properties=dict()
		self._parent=None
		self._children=[]

	@staticmethod
	def create(s,start):
		res=Node()
		if s[start]!=";":
			# print("error when parsing Node")
			return (start,None)
		i=skipWhitespace(s,start+1)
		i,x=Property.create(s,start+1)
		while x is not None:
			if x.name in res.properties:
				print(res.properties)
				raise ParserError(0,0,'duplicate "{0}" property in node at position {1}. second value ignored'.format(x.name,start))
			else:
				res.properties[x.name]=x
			i=skipWhitespace(s,i)
			i,x=Property.create(s,i)
		return (i,res)

	def isGINode(self):
		return any(prop.type==Property.GAME_INFO for prop in self.properties.values())

	def setProperty(self,name,value):
		self.properties[name]=value
		# zkontrolovat typ value

	def setParent(self,node):
		self._parent=node

	def addChild(self,node):
		if node in self._children: return node
		self._children.append(node)
		return node

	def removeChild(self,node):
		if node not in self._children:
			return None
		del self._children[self._children.index(node)]
		return node

	def removeChildAt(self,i):
		if -len(self._children)<i<len(self._children):
			res=self._children[i]
			del self._children[i]
			return res
		return None
		
	def getProperty(self,name):
		if name in self.properties: return self.properties[name]
		else: return None
	
class Property:
	GAME_INFO=1
	UNKNOWN=99

	def __init__(self):
		self.name=""
		self.value=""

	@staticmethod
	def create(s,start):
		res=Property()
		i,x=Property.ident(s,start)
		if x is None:
			return (start,None)
		res.name=x
		i,x=PropValue.create(s,i,res.name)
		if x is None:
			print('error when parsing property "{0}" at position {1}'.format(res.name,i))
			return (start,None)
		res.value=x
		return (i,res)

	@staticmethod
	def ident(s,start):
		r=re.compile(r"[A-Z]+")
		m=r.match(s,start)
		if m is None: return (start,None)
		return (m.end(),m.group())

	@property
	def type(self):
		gameInfo={"AN","BR","BT","CP","DT","EV","GN","GC","ON","OT","PB","PC","PW","RE","RO","RU","SO","TM","US","WR","WT"}
		if self.name in gameInfo: return Property.GAME_INFO
		else: return Property.UNKNOWN

class PropValue:
	def __init__(self):
		self.type=""
		self.value=None

	patterns=dict()

	@staticmethod
	def create(s,start,name):
		if name in PropValue.patterns:
			return PropValue.patterns[name](s,start)
		else:
			print('warning, unknown property "{0}" at position {1}'.format(name,start))
			return PropValue.singleton(PropValue.anything)(s,start)

	def choose(*vTypes):
		def f(s,start):
			for vType in vTypes:
				i,x=vType(s,start)
				if x is not None: return (i,x)
			return (start,None)
		return f

	def singleton(vType):
		def f(s,start):
			if s[start]!="[":
				return (start,None)
			i,x=vType(s,start+1)
			if x is None: return (start,None)
			if s[i]!="]":
				return (start,None)
			return (i+1,x)
		return f

	def listOf(vType,allowEmpty=False):
		def f(s,start):
			res=[]
			single=PropValue.singleton(vType)
			i,x=single(s,start)
			while x!=None:
				res.append(x)
				i,x=single(s,i)
			if len(res)==0 and not allowEmpty: return (start,None)
			return (i,res)
		return f

	def compose(vTypeA,vTypeB):
		def f(s,start):
			i,a=vTypeA(s,start)
			# print(">",i,a)
			if a==None or s[i]!=":": return (start,None)
			i,b=vTypeB(s,i+1)
			# print(">",i,b)
			if b==None: return start,None
			return (i,(a,b))
		return f

	def number(s,start):
		r=re.compile(r"(\+|-|)\d+")
		m=r.match(s,start)
		if m is None: return (start,None)
		res=int(m.group(0))
		return (m.end(),res)

	def real(s,start):
		r=re.compile(r"(\+|-|)\d+(\.\d+)?")
		m=r.match(s,start)
		if m is None: return (start,None)
		res=float(m.group(0))
		return (m.end(),res)

	def double(s,start):
		r=re.compile(r"1|2")
		m=r.match(s,start)
		if m is None: return (start,None)
		res=int(m.group(0))
		return (m.end(),res)

	def color(s,start):
		r=re.compile(r"B|W")
		m=r.match(s,start)
		if m is None: return (start,None)
		return (m.end(),m.group(0))

	def text(simple=True,composed=False):
		def f(s,start):
			res=""
			esc=False
			lastC=""
			for i,c in enumerate(s[start:],start):
				if esc:
					if c!="\n" and c!="\r": res+=c
					esc=False
				elif (c=="\n" and lastC=="\r") or (c=="\r" and lastC=="\n"): pass
				elif c=="\r" or c=="\n" and not simple:
					res+="\n"
				elif c.isspace():
					res+=" "
				elif c=="\\":
					esc=True
				elif c=="]" or (c==":" and composed):
					break
				else:
					res+=c
				lastC=c
			return (i,res)
		return f

	def empty(s,start): return (start,"")

	def anything(s,start):
		esc=False
		for i,c in enumerate(s[start:],start):
			if esc: esc=False
			elif c=="\\": esc=True
			elif c=="]": break
		return (i,s[start:i])
	
	# go specific
	def point(s,start):
		r=re.compile(r"[a-zA-Z]{2}|") # !! limit to board size
		m=r.match(s,start)
		if m is None: return (start,None)
		if m.group(0)=="": # pass, !! tt
			return (m.end(),tuple())
		col=m.group(0)[0]
		row=m.group(0)[1]
		col=ord(col) - (ord("a") if "a"<=col<="z" else ord("A")-26)
		row=ord(row) - (ord("a") if "a"<=row<="z" else ord("A")-26)
		return (m.end(),(col,row))

	move=point
	stone=point
	
	patterns={
		"B":singleton(move),
		"KO":singleton(empty),
		"MN":singleton(number),
		"W":singleton(move),
		"AB":listOf(stone), #
		"AE":listOf(point), #
		"AW":listOf(stone), #
		"PL":singleton(color),
		"C":singleton(text(simple=False)),
		"DM":singleton(double),
		"GB":singleton(double),
		"GW":singleton(double),
		"HO":singleton(double),
		"N":singleton(text()),
		"UC":singleton(double),
		"V":singleton(real),
		"BM":singleton(double),
		"DO":singleton(empty),
		"IT":singleton(empty),
		"TE":singleton(double),
		"AR":listOf(compose(point,point)), #
		"CR":listOf(point), #
		"DD":listOf(point,allowEmpty=True), #
		"LB":listOf(compose(point,text())), #
		"LN":listOf(compose(point,point)), #
		"MA":listOf(point), #
		"SL":listOf(point), #
		"SQ":listOf(point), #
		"TR":listOf(point), #
		"AP":singleton(compose(text(composed=True),text())), #
		"CA":singleton(text()),
		"FF":singleton(number),
		"GM":singleton(number),
		"ST":singleton(number),
		"SZ":choose(singleton(number),singleton(compose(number,number))), #
		"AN":singleton(text()),
		"BR":singleton(text()),
		"BT":singleton(text()),
		"CP":singleton(text()),
		"DT":singleton(text()),
		"EV":singleton(text()),
		"GN":singleton(text()),
		"GC":singleton(text(simple=False)),
		"ON":singleton(text()),
		"OT":singleton(text()),
		"PB":singleton(text()),
		"PC":singleton(text()),
		"PW":singleton(text()),
		"RE":singleton(text()),
		"RO":singleton(text()),
		"RU":singleton(text()),
		"SO":singleton(text()),
		"TM":singleton(real),
		"US":singleton(text()),
		"WR":singleton(text()),
		"WT":singleton(text()),
		"BL":singleton(real),
		"OB":singleton(number),
		"OW":singleton(number),
		"WL":singleton(real),
		"FG":choose(singleton(empty),singleton(compose(number,text()))), #
		"PM":singleton(number),
		"VW":listOf(point,allowEmpty=True), #
		
		# go specific
		"HA":singleton(number),
		"KM":singleton(real),
		"TB":listOf(point,allowEmpty=True),
		"TW":listOf(point,allowEmpty=True)
	}

class ParserError(Exception):
	def __init__(self,line,col,message):
		self.line=line
		self.col=col
		self.message=message

# TODO:
# date


"""
# move
B	move
KO	none
MN	number
W	move

# setup
AB	list of stone
AE	list of point
AW	list of stone
PL	color

# node annotation
C	text
DM	double
GB	double
GW	double
HO	double
N	simpleText
UC	double
V	real

# move annotation
BM	double
DO	none
IT	none
TE	double

# markup
AR	list of composed point:point
CR	list of point
DD	elist of point
LB	list of composed point:simpleText
LN	list of composed point:point
MA	list of point
SL	list of point
SQ	list of point
TR	list of point

# root
AP	composed simpleText:simpleText
CA	simpleText
FF	number
GM	number
ST	number
SZ	number | composed number:number

# game info
AN	simpleText
BR	simpleText
BT	simpleText
CP	simpleText
DT	simpleText
EV	simpleText
GN	simpleText
GC	text
ON	simpleText
OT	simpleText
PB	simpleText
PC	simpleText
PW	simpleText
RE	simpleText
RO	simpleText
RU	simpleText
SO	simpleText
TM	real
US	simpleText
WR	simpleText
WT	simpleText

# timing
BL	real
OB	number
OW	number
WL	real

# misc
FG	none | composition of number:simpleText
PM	number
VW	elist of point
"""