File: GrcSymTable.cpp

package info (click to toggle)
grcompiler 4.2-7
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,108 kB
  • sloc: cpp: 45,565; sh: 4,425; ansic: 4,377; makefile: 188; xml: 175; perl: 127
file content (1764 lines) | stat: -rw-r--r-- 60,470 bytes parent folder | download | duplicates (4)
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
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
/*--------------------------------------------------------------------*//*:Ignore this sentence.
Copyright (C) 1999, 2001 SIL International. All rights reserved.

Distributable under the terms of either the Common Public License or the
GNU Lesser General Public License, as specified in the LICENSING.txt file.

File: GrcSymTable.cpp
Responsibility: Sharon Correll
Last reviewed: Not yet.

Description:
    Implementation of the parser/compiler symbol table.
-------------------------------------------------------------------------------*//*:End Ignore*/

/***********************************************************************************************
	Include files
***********************************************************************************************/
#include "main.h"

#ifdef _MSC_VER
#pragma hdrstop
#endif
#undef THIS_FILE
DEFINE_THIS_FILE

/***********************************************************************************************
	Forward declarations
***********************************************************************************************/

/***********************************************************************************************
	Local Constants and static variables
***********************************************************************************************/

/***********************************************************************************************
	Methods
***********************************************************************************************/

/*----------------------------------------------------------------------------------------------
    Destructors
----------------------------------------------------------------------------------------------*/
GrcSymbolTable::~GrcSymbolTable()
{
	m_psymParent = NULL;

	for (SymbolTableMap::iterator it = EntriesBegin();
		it != EntriesEnd();
		++it)
	{
		delete it->second; // GetValue();
		//delete it->GetValue();
	}
}


GrcSymbolTableEntry::~GrcSymbolTableEntry()
{
	delete m_psymtblSubTable;
}


/*----------------------------------------------------------------------------------------------
    Add a symbol to the main symbol table in the normal way, assuming there is nothing
	special to do.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddSymbol(const GrcStructName & xns, SymbolType symt,
	GrpLineAndFile const& lnf)
{
	Assert(m_cLevel == 0);
	return AddSymbolAux(xns, symt, ksymtInvalid, lnf);
}


/*----------------------------------------------------------------------------------------------
    Add a symbol that is the name of a class to the main symbol table (if it is not already
	there). Also, ensure that it has an GdlGlyphClassDefn as its data.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddClassSymbol(const GrcStructName & xns, GrpLineAndFile const& lnf)
{
	Assert(m_cLevel == 0);
	Assert(xns.NumFields() == 1);

	Symbol psymAdded = AddSymbolAux(xns, ksymtClass, ksymtInvalid, lnf);
	if (!psymAdded->HasData())
	{
		GdlGlyphClassDefn * pglfc = new GdlGlyphClassDefn();
		pglfc->SetLineAndFile(lnf);
		psymAdded->SetData(pglfc);
	}

	return psymAdded;
}


/*----------------------------------------------------------------------------------------------
    Add a symbol that is the name of a feature to the main symbol table (if it is not already
	there). Also, ensure that it has an GdlFeatureDefn as its data.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddFeatureSymbol(const GrcStructName & xns, GrpLineAndFile const& lnf)
{
	Assert(m_cLevel == 0);
	Assert(xns.NumFields() == 1);

	Symbol psymAdded = AddSymbolAux(xns, ksymtFeature, ksymtInvalid, lnf);
	if (!psymAdded->HasData())
	{
		GdlFeatureDefn * pfeat = new GdlFeatureDefn();
		pfeat->SetLineAndFile(lnf);
		psymAdded->SetData(pfeat);
	}
	psymAdded->SetExpType(kexptNumber);

	return psymAdded;
}


/*----------------------------------------------------------------------------------------------
    Add a symbol that is the name of a feature to the main symbol table (if it is not already
	there). Also, ensure that it has an GdlFeatureDefn as its data.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddLanguageSymbol(const GrcStructName & xns, GrpLineAndFile const& lnf)
{
	Assert(m_cLevel == 0);
	Assert(xns.NumFields() == 1);

	Symbol psymAdded = AddSymbolAux(xns, ksymtLanguage, ksymtInvalid, lnf);
	if (!psymAdded->HasData())
	{
		GdlLanguageDefn * plang = new GdlLanguageDefn();
		plang->SetLineAndFile(lnf);
		psymAdded->SetData(plang);
	}
	psymAdded->SetExpType(kexptNumber);

	return psymAdded;
}


/*----------------------------------------------------------------------------------------------
    Add a symbol that is the name of a class's glyph attribute to the main symbol table
	(if it is not already there).
	Ensure that there is a generic version of the glyph attribute in the symbol table
	(minus the class name),	and set a pointer to it.
	If it is one of the standard attributes, set its expression type.
	If is a component glyph attribute, create a corresponding ".ref" slot attribute.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddGlyphAttrSymbol(const GrcStructName & xns, GrpLineAndFile const& lnf,
	ExpressionType expt, bool fMetric)
{
	Assert(m_cLevel == 0);
	SymbolType symt = (fMetric) ? ksymtGlyphMetric : ksymtGlyphAttr;
	SymbolType symtOther = (fMetric) ? ksymtInvalid : ksymtInvalidGlyphAttr;
	Symbol psymAdded = AddSymbolAux(xns, symt, symtOther, lnf);
	psymAdded->AdjustExpTypeIfPossible(expt);

	//	Find or add the generic version of the glyph attribute (without the class name).
	GrcStructName xnsGeneric;
	xns.CopyMinusFirstField(xnsGeneric);	// take off the class name
	Symbol psymGeneric = FindSymbol(xnsGeneric);
	if (psymGeneric)
	{
		if (psymGeneric->m_symt == ksymtGlyphMetric && !fMetric)
		{
			std::string staMsg("Cannot set the value of a glyph metric: ");
			std::string staName = psymGeneric->FullName();
			staMsg.append(staName);
			g_errorList.AddItem(true, 1184, NULL, &lnf, staMsg); // fatal error
			return NULL;
		}
		if (psymGeneric->m_symt == ksymtInvalid)
		{
			//	previously undefined symbol, now we know it is a glyph attribute or metric
			psymGeneric->m_fGeneric = true;
			psymGeneric->m_symt = symt;
		}
		Assert(psymGeneric->m_fGeneric);
		if (!psymGeneric->FitsSymbolType(symt))
		{
			//	Symbol being used as a glyph attribute was previously used as something else.
			Assert(false);
			return psymAdded;
		}

		psymGeneric->AdjustExpTypeIfPossible(expt);
		psymAdded->SetExpType(psymGeneric->ExpType());
	}
	else
	{
		Assert(!fMetric); // all metrics should be defined from the outset

		psymGeneric = AddSymbolAux(xnsGeneric, symt, symtOther, lnf);
		psymGeneric->m_fGeneric = true;
		psymGeneric->AdjustExpTypeIfPossible(expt);
	}

	psymAdded->SetGeneric(psymGeneric);

	//	For component attributes, define the corresponding component.?.ref attribute, and
	//	link up the generic version of the base ligature symbol.
	if (psymGeneric->IsComponentBoxField())
	{
		GrcStructName xnsCompRef(xnsGeneric);
		xnsCompRef.DeleteField(xnsCompRef.NumFields() - 1);
		xnsCompRef.InsertField(xnsCompRef.NumFields(), "reference");
		Symbol psymCompRef = AddSymbolAux(xnsCompRef, ksymtSlotAttr, ksymtSlotAttr, lnf);
		psymCompRef->m_expt = kexptSlotRef;

		Symbol psymBaseLig = psymAdded->BaseLigComponent();
		Assert(psymBaseLig);
		Symbol psymGenericBaseLig = psymGeneric->BaseLigComponent();
		psymGenericBaseLig->m_fGeneric = true;
		psymBaseLig->SetGeneric(psymGenericBaseLig);
	}
		
	return psymAdded;
}


/*----------------------------------------------------------------------------------------------
    Add a symbol that is of the form <class>.component.<X>.... to the main symbol table
	(if it is not already there). CURRENTLY NOT USED
----------------------------------------------------------------------------------------------*/
#if 0
Symbol GrcSymbolTable::AddComponentField(const GrcStructName & xns, GrpLineAndFile const& lnf)
{
	Assert(m_cLevel == 0);
	Assert(xns.FieldEquals(1, "component"));

	SymbolType symt;
	if (xns.FieldEquals(3, "top") ||
			xns.FieldEquals(3, "bottom") ||
			xns.FieldEquals(3, "left") ||
			xns.FieldEquals(3, "right"))
		symt = ksymtGlyphAttr;	// valid component glyph attribute

	else if (xns.FieldEquals(3, "reference"))
		symt = ksymtSlotAttr;	// valid component slot attribute
	else

	{
		//	Invalid use of component attribute.
		Assert(false);
		return NULL;
	}

	Symbol psymAdded = AddGlyphAttrSymbol(xns, lnf, kexptMeas);
	Symbol psymGeneric = psymAdded->Generic();
	Assert(psymGeneric->m_fGeneric);
	ExpressionType exptGeneric = psymGeneric->ExpType();

	if (symt == ksymtGlyphAttr)
	{
		Assert(exptGeneric == kexptUnknown || exptGeneric == kexptMeas);
		psymGeneric->SetExpType(kexptMeas);
		psymAdded->SetExpType(kexptMeas);
	}
	else // symt == ksymtSlotAttr
	{
		Assert(exptGeneric == kexptUnknown || exptGeneric == kexptSlotRef);
		psymGeneric->SetExpType(kexptSlotRef);
		psymAdded->SetExpType(kexptSlotRef);
	}		

	return psymAdded;
}
#endif // 0

/*----------------------------------------------------------------------------------------------
	Add a new unique class-name symbol to the table. Return the new symbol.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddAnonymousClassSymbol(GrpLineAndFile const& lnf)
{
	char rgch[20];
	itoa(m_csymAnonClass, rgch, 10);
	m_csymAnonClass++;

	std::string sta = "*GC";
	sta += rgch;
	sta += "*";
	Assert(!FindField(sta));

	GrcStructName xns(sta);
	return AddClassSymbol(xns, lnf);
}

/*----------------------------------------------------------------------------------------------
    Add a symbol to the table if it is not already there. Return an error code if the
	symbol is already there but is of a different type. (Nodes along the way may
	be of different types, but the final node may not.)

	Caller should ensure that if the symbol is already present it has the expected type,
	or raise an error.

	Arguments:
		xns				- structured name of symbol
		symtLeaf		- symbol type to use for leaf node
		symtOther		- symbol type to use for nodes along the way (generally ksymtInvalid
							or ksymtInvalidGlyphAttr)
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::AddSymbolAux(const GrcStructName & xns,
	SymbolType symtLeaf, SymbolType symtOther, GrpLineAndFile const& lnf)
{
	Symbol psym = NULL;
	GrcSymbolTable * psymtbl = this;

	for (int i = 0; i < xns.NumFields(); ++i)
	{
		std::string staField = xns.FieldAt(i);

		if (psymtbl == NULL)	// never true first time through
		{
			psymtbl = new GrcSymbolTable(false);
			psymtbl->MakeSubTableOf(psym);
		}

		psym = psymtbl->FindField(staField);
		if (psym == NULL)
		{
			psym = new GrcSymbolTableEntry(staField,
				((i == xns.NumFields() - 1) ? symtLeaf : symtOther),
				psymtbl);
			SymbolTablePair hmpair;
			hmpair.first = staField;
			hmpair.second = psym;
			psymtbl->m_hmstasymEntries.insert(hmpair);
			//psymtbl->m_hmstasymEntries.Insert(staField, psym);
		}
		psymtbl = psym->m_psymtblSubTable;
	}

	// TODO: if the symbol is of the form <class>.<predefined-glyph-attr>, define it
	// as a glyph attribute.

	if (psym->m_lnf.NotSet())
		psym->m_lnf = lnf;

	if (psym->m_symt == ksymtInvalid)
		psym->SetSymbolType(symtLeaf);

	Assert(psym->m_symt == symtLeaf);

	return psym;
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol fits the given type.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::FitsSymbolType(SymbolType symt)
{
	if (m_symt == symt || m_symt2 == symt)
		return true;

	//	Handle subtypes
	switch (symt)
	{
	case ksymtTable:
		if (FitsSymbolType(ksymtTableRule))
			return true;
		break;

	case ksymtGlyphData:
		if (FitsSymbolType(ksymtGlyphAttr))
			return true;
		if (FitsSymbolType(ksymtGlyphMetric))
			return true;
		break;

	case ksymtGlyphAttr:
		if (FitsSymbolType(ksymtGlyphAttrComp))
			return true;
		break;

	case ksymtInvalid:
		if (FitsSymbolType(ksymtInvalidGlyphAttr))
			return true;
		break;

	case ksymtSlotAttr:
		if (FitsSymbolType(ksymtSlotAttrPt))
			return true;
		if (FitsSymbolType(ksymtSlotAttrCompRef))
			return true;
		break;

	case ksymtSpecial:
		if (FitsSymbolType(ksymtSpecialAt))
			return true;
		if (FitsSymbolType(ksymtSpecialCaret))
			return true;
		if (FitsSymbolType(ksymtSpecialLb))
			return true;
		if (FitsSymbolType(ksymtSpecialUnderscore))
			return true;
		break;

	case ksymtOperator:
		if (FitsSymbolType(ksymtOpAssign))
			return true;
		break;

	default:
		;	// no subtypes
	}

	return false;
}


/*----------------------------------------------------------------------------------------------
    Return a pointer to the symbol indicated by the field, or NULL if it is not present in
	the table.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::FindField(std::string staField)
{
	SymbolTableMap::iterator hmit = m_hmstasymEntries.find(staField);
	if (hmit == m_hmstasymEntries.end())
		return NULL;
	else
		return hmit->second;

	//Symbol psymRet;
	//if (m_hmstasymEntries.Retrieve(staField, &psymRet))
	//	return psymRet;
	//else
	//	return NULL;
}

/*----------------------------------------------------------------------------------------------
    Return a pointer to the symbol indicated by the structured name, or NULL if the symbol
	is not present.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::FindSymbol(const GrcStructName & xns)
{
	GrcSymbolTable * psymtbl = this;
	Symbol psym = NULL;

	for (int i = 0; i < xns.NumFields(); ++i)
	{
		psym = psymtbl->FindField(xns.FieldAt(i));
		if (psym == NULL)
			return NULL;
		psymtbl = psym->m_psymtblSubTable;
		if (i < xns.NumFields() - 1 && psymtbl == NULL)
			return NULL;
	}
	return psym;
}

//	one-field version:
Symbol GrcSymbolTable::FindSymbol(const std::string staName)
{
	return FindField(staName);
}


/*----------------------------------------------------------------------------------------------
    Return the symbol corresponding to the slot attribute name. Return NULL if it is not
	a legal slot attribute. If it is of the form component.???.reference, add it to the
	symbol table.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::FindSlotAttr(const GrcStructName & xns, GrpLineAndFile const& lnf)
{
	Symbol psym = FindSymbol(xns);

	if (!psym && xns.NumFields() == 3 &&
		xns.FieldEquals(0, "component") && xns.FieldEquals(2, "reference"))
	{
		psym = AddSymbolAux(xns, ksymtSlotAttrCompRef, ksymtInvalidGlyphAttr, lnf);
		psym->SetExpType(kexptSlotRef);
	}

	if (!psym || !psym->FitsSymbolType(ksymtSlotAttr))
		return NULL;
	else
		return psym;
}


/*----------------------------------------------------------------------------------------------
    Answer true if the field at the given index is the given string.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::FieldIs(int i, std::string staField)
{
	Assert(i >= 0);

	if (i > Level())
		return false;

	Symbol psymCurr = this;
	while (psymCurr->Level() > i)
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	return (psymCurr->m_staFieldName == staField);
}

/*----------------------------------------------------------------------------------------------
    Answer the field at the given index, or an empty string if there are not
	that many fields.
----------------------------------------------------------------------------------------------*/
std::string GrcSymbolTableEntry::FieldAt(int i)
{
	Assert(i >= 0);

	if (i > Level())
		return "";

	Symbol psymCurr = this;
	while (psymCurr->Level() > i)
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	return psymCurr->m_staFieldName;
}

/*----------------------------------------------------------------------------------------------
    Answer the index  of the (first) field containing the given string, or -1 if it is not
	present.
----------------------------------------------------------------------------------------------*/
int GrcSymbolTableEntry::FieldIndex(std::string sta)
{
	int cRet = -1;
	Symbol psymCurr = this;
	while (psymCurr)
	{
		if (psymCurr->m_staFieldName == sta)
			cRet = psymCurr->Level();
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	}
	return cRet;
}

/*----------------------------------------------------------------------------------------------
    Answer the number of fields in the symbol.
----------------------------------------------------------------------------------------------*/
int	GrcSymbolTableEntry::FieldCount()
{
	return Level() + 1;
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is the given operator.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::MatchesOp(std::string sta)
{
	if (!FitsSymbolType(ksymtOperator))
		return false;
	return (m_staFieldName == sta);
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is a comparative operator.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsComparativeOp()
{
	if (!FitsSymbolType(ksymtOperator))
		return false;
	return (m_prec == kprecComparative);
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is a bogus slot attribute that is only present in symbol table
	to assist in error checking: advance/shift/kern.gpoint/gpath/xoffset/yoffset.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsBogusSlotAttr()
{
	Assert(FitsSymbolType(ksymtSlotAttr));

	if (FieldCount() != 2)
		return false;

	if (m_staFieldName == "gpoint" || m_staFieldName == "gpath" ||
		m_staFieldName == "xoffset" || m_staFieldName == "yoffset")
	{
		std::string sta = FieldAt(0);
		if (sta == "shift" || sta == "advance" || sta == "kern")
			return true;
	}
	return false;
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is a read-only slot attribute, ie, position, position.x, or
	position.y.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsReadOnlySlotAttr()
{
	Assert(FitsSymbolType(ksymtSlotAttr));

	return (FieldIs(0, "position"));
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is a write-only slot attribute, ie, kern, kern.x, or
	kern.y.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsWriteOnlySlotAttr()
{
	Assert(FitsSymbolType(ksymtSlotAttr));

	return (FieldIs(0, "kern"));
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is an indexed slot attribute, ie, component.XXX.reference or
	a user-definable slot attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsIndexedSlotAttr()
{
	Assert(FitsSymbolType(ksymtSlotAttr));

	if (FieldIs(0, "component") && LastFieldIs("reference"))
		return true;
	else if (IsUserDefinableSlotAttr())
		return true;
	else
		return false;
}


/*----------------------------------------------------------------------------------------------
    Answer true if the symbol is an indexed glyph attribute, ie, component.XXX....
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsIndexedGlyphAttr()
{
	Assert(FitsSymbolType(ksymtGlyphAttr));

	if (IsGeneric())
		return (FieldIs(0, "component"));
	else
		return Generic()->IsIndexedGlyphAttr();
}


/*----------------------------------------------------------------------------------------------
    Return the full dotted name of the symbol.
----------------------------------------------------------------------------------------------*/
std::string GrcSymbolTableEntry::FullName()
{
	std::string staRet = m_staFieldName;
	GrcSymbolTableEntry * psymCurr = m_psymtbl->m_psymParent;
	while (psymCurr)
	{
		std::string staTmp = psymCurr->m_staFieldName;
		staTmp += ".";
		staTmp += staRet;
		staRet = staTmp;
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	}
	return staRet;
}


/*----------------------------------------------------------------------------------------------
    Return the full dotted name of the symbol, using abbreviations.
----------------------------------------------------------------------------------------------*/
std::string GrcSymbolTableEntry::FullAbbrev()
{
	std::string staRet = Abbreviation(m_staFieldName);
	GrcSymbolTableEntry * psymCurr = m_psymtbl->m_psymParent;
	while (psymCurr)
	{
		std::string staTmp = Abbreviation(psymCurr->m_staFieldName);
		staTmp += ".";
		staTmp += staRet;
		staRet = staTmp;
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	}
	return staRet;
}


/*----------------------------------------------------------------------------------------------
    Return the full dotted name of the symbol, using abbreviations. Omit the given string,
	which should be the top level item. For instance, if "attach" is passed, return
	"with.x" instead of "attach.with.x".
----------------------------------------------------------------------------------------------*/
std::string GrcSymbolTableEntry::FullAbbrevOmit(std::string staOmit)
{
	std::string staRet = Abbreviation(m_staFieldName);
	GrcSymbolTableEntry * psymCurr = m_psymtbl->m_psymParent;
	while (psymCurr)
	{
		std::string staTmp = Abbreviation(psymCurr->m_staFieldName);
		if (staTmp == staOmit)
			break;
		staTmp += ".";
		staTmp += staRet;
		staRet = staTmp;
		psymCurr = psymCurr->m_psymtbl->m_psymParent;
	}
	return staRet;
}


/*----------------------------------------------------------------------------------------------
    Return the standard abbreviation for the keyword.
----------------------------------------------------------------------------------------------*/
std::string GrcSymbolTableEntry::Abbreviation(std::string staFieldName)
{
	if (staFieldName == "reference")
		return "ref";
	else if (staFieldName == "boundingbox")
		return "bb";
	else if (staFieldName == "advancewidth")
		return "aw";
	else if (staFieldName == "advanceheight")
		return "ah";
	else if (staFieldName == "leftsidebearing")
		return "lsb";
	else if (staFieldName == "rightsidebearing")
		return "rsb";
	else if (staFieldName == "directionality")
		return "dir";
	else if (staFieldName == "component")
		return "comp";
	else if (staFieldName == "breakweight")
		return "break";
	else
		return staFieldName;
}

/*----------------------------------------------------------------------------------------------
    Fill in the structured name with the name of the symbol.
----------------------------------------------------------------------------------------------*/
void GrcSymbolTableEntry::GetStructuredName(GrcStructName * pxns)
{
	GrcSymbolTableEntry * psymCurr = this;
	while (psymCurr)
	{
		pxns->InsertField(0, psymCurr->m_staFieldName);
		psymCurr = psymCurr->ParentSymbol();
	}
}

/*----------------------------------------------------------------------------------------------
    This symbol is a non-generic glyph attribute or feature setting. Return the symbol
	for the defining class or feature.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::BaseDefnForNonGeneric()
{
	Assert(FitsSymbolType(ksymtGlyphAttr) ||
		FitsSymbolType(ksymtFeatSetting) ||
		FitsSymbolType(ksymtInvalid));

	Symbol psymParent = ParentSymbol();
	Assert(psymParent);
	if (psymParent->FitsSymbolType(ksymtClass))
		return psymParent;
	else if (psymParent->FitsSymbolType(ksymtFeature))
		return psymParent;
	else
		return psymParent->BaseDefnForNonGeneric();
}

/*----------------------------------------------------------------------------------------------
    Return the symbol for the defining class, or NULL if this symbol is something other
	than a non-generic glyph attribute.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::BaseClassDefn()
{
	if (!FitsSymbolType(ksymtGlyphAttr))
		return NULL;

	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return NULL;

	if (psymParent->FitsSymbolType(ksymtClass))
		return psymParent;
	else
		return psymParent->BaseClassDefn();
}

/*----------------------------------------------------------------------------------------------
    This symbol is a feature setting value, eg someFeat.settings.opt1.id.
	Return the symbol for the feature setting someFeat.settings.opt1.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::BaseFeatSetting()
{
	Assert(FitsSymbolType(ksymtFeatSetting));

	Symbol psymParent = ParentSymbol();
	Assert(psymParent);
	if (psymParent->m_staFieldName == "setting")
		return this;
	else
		return psymParent->BaseFeatSetting();
}

/*----------------------------------------------------------------------------------------------
    This symbol is something like clsABC.component.A.top or component.A.ref.
	Return the symbol corresponding to the component itself: clsABC.component.A.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::BaseLigComponent()
{
	Assert(FitsSymbolType(ksymtGlyphAttr) ||
		FitsSymbolType(ksymtSlotAttr) ||
		FitsSymbolType(ksymtInvalidGlyphAttr));

	Symbol psymParent = ParentSymbol();
	Assert(psymParent);
	if (psymParent->m_staFieldName == "component")
		return this;
	else
		return psymParent->BaseLigComponent();
}

/*----------------------------------------------------------------------------------------------
    This symbol is something like clsABC.somePoint.x. Return the symbol corresponding to the
	point itself: clsABC.somePoint.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::BasePoint()
{
	Assert(FitsSymbolType(ksymtGlyphAttr));
	Assert(m_staFieldName == "x" || m_staFieldName == "y" ||
		m_staFieldName == "gpoint" || m_staFieldName == "gpath" ||
		m_staFieldName == "xoffset" || m_staFieldName == "yoffset");

	return ParentSymbol();
}

/*----------------------------------------------------------------------------------------------
    This symbol is something like clsABC.somePoint.x. Return the symbol corresponding to a
	sister field, ie, clsABC.somePoint.y. If such a symbol has not been defined, return NULL.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::PointSisterField(std::string staField)
{
	Assert(m_staFieldName == "x" || m_staFieldName == "y" ||
		m_staFieldName == "gpoint" || m_staFieldName == "gpath" ||
		m_staFieldName == "xoffset" || m_staFieldName == "yoffset");

	Symbol psymBase = BasePoint();
	Assert(psymBase);
	Symbol psymRet = psymBase->m_psymtblSubTable->FindField(staField);
	return psymRet;
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form ...component.???.reference.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsComponentRef()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	Symbol psymParent = ParentSymbol();
	return (m_staFieldName == "reference" &&
		psymParent && psymParent->ParentSymbol() &&
		psymParent->ParentSymbol()->m_staFieldName == "component");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form ...component.???.top/bottom/left/right
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsComponentBoxField()
{
	Symbol psymParent = ParentSymbol();
	return (psymParent && psymParent->ParentSymbol() &&
		psymParent->ParentSymbol()->m_staFieldName == "component" &&
		(m_staFieldName == "top" || m_staFieldName == "bottom" ||
			m_staFieldName == "left" || m_staFieldName == "right"));
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form ...component.???.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsComponentBase()
{
	return (ParentSymbol() && ParentSymbol()->m_staFieldName == "component");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form ...???.x or ???.y and there is a sister field
	with the appropriate name. Current only used for the debugger-xml output.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsPointField()
{
	if (m_staFieldName == "x")
		return PointSisterField("y") != NULL;
	else if (m_staFieldName == "y")
		return PointSisterField("x") != NULL;
	else if (m_staFieldName == "xoffset" || m_staFieldName == "yoffset")
		return (PointSisterField("x") != NULL && PointSisterField("y") != NULL)
			|| (PointSisterField("gpoint") != NULL);
	else if (m_staFieldName == "gpoint")
		return true;
	else
		return false;
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form "attach.to"
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachTo()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	Symbol psymParent = ParentSymbol();
	return (psymParent &&
		psymParent->m_staFieldName == "attach" && m_staFieldName == "to");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form "attach.at.???"
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachAtField()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	Symbol psymParent = ParentSymbol();
	return (psymParent && psymParent->ParentSymbol()
		&& psymParent->ParentSymbol()->m_staFieldName == "attach"
		&& psymParent->m_staFieldName == "at");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form "attach.with.???"
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachWithField()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	Symbol psymParent = ParentSymbol();
	return (psymParent && psymParent->ParentSymbol()
		&& psymParent->ParentSymbol()->m_staFieldName == "attach"
		&& psymParent->m_staFieldName == "with");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form "attach.at/with.x"
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachXField()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	Symbol psymParent = ParentSymbol();
	return ((psymParent && psymParent->ParentSymbol())
		&& (psymParent->ParentSymbol()->m_staFieldName == "attach")
		&& ((psymParent->m_staFieldName == "with") || (psymParent->m_staFieldName == "at"))
		&& m_staFieldName == "x");
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is of the form "attach.at/with.xoffset/yoffset"
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachOffsetField()
{
	Assert(FitsSymbolType(ksymtSlotAttr));
	// Symbol psymParent = ParentSymbol();
	return ((IsAttachWithField() || IsAttachAtField())
		&& (m_staFieldName == "xoffset" || m_staFieldName == "yoffset"));
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is an attachment attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsAttachment()
{
	if (m_staFieldName == "attach")
		return true;
	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return false;
	return (psymParent->IsAttachment());
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is an movement attribute: shift, advance, kern.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsMovement()
{
	if (m_staFieldName == "shift")
		return true;
	if (m_staFieldName == "kern")
		return true;
	if (m_staFieldName == "advance")
		return true;
	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return false;
	return (psymParent->IsMovement());
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is a justification-related attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::DoesJustification()
{
	if (m_staFieldName == "justify")
		return true;
	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return false;
	return (psymParent->DoesJustification());
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is a justification-related attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsMeasureAttr()
{
	if (m_staFieldName == "measure")
		return true;
	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return false;
	return (psymParent->IsMeasureAttr());
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is a mirroring-related attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsMirrorAttr()
{
	if (m_staFieldName == "mirror")
		return true;
	Symbol psymParent = ParentSymbol();
	if (!psymParent)
		return false;
	return (psymParent->IsMirrorAttr());
}

/*----------------------------------------------------------------------------------------------
    Return true if the symbol is a user-definable slot attribute.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::IsUserDefinableSlotAttr()
{
	if (m_staFieldName[0] == 'u' && m_staFieldName[1] == 's' &&
		m_staFieldName[2] == 'e' && m_staFieldName[3] == 'r')
	{
		return true;
	}
	else
		return false;
}

/*----------------------------------------------------------------------------------------------
    Return the number corresponding to the index of the user-definable slot attribute,
	or -1 if it is something invalid (does not parse to a number).
----------------------------------------------------------------------------------------------*/
int GrcSymbolTableEntry::UserDefinableSlotAttrIndex()
{
	Assert(IsUserDefinableSlotAttr());
	int nRet = 0;
	for (size_t ich = 4; ich < m_staFieldName.length(); ich++)
	{
		char ch = m_staFieldName[ich];
		if (ch < '0')
			return -1;
		if (ch > '9')
			return -1;
		nRet = (nRet * 10) + (ch - '0');
	}
	return nRet - 1;	// 0-based
}

/*----------------------------------------------------------------------------------------------
    For slot attributes that use points (eg, attach.at, shift), or for glyph attributes
	that define a point (eg, udap) return the sub-symbol that appends the given point field,
	or NULL if such a field does not exist.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTableEntry::SubField(std::string sta)
{
	Assert(FitsSymbolType(ksymtSlotAttrPt) || FitsSymbolType(ksymtGlyphAttr) ||
		FitsSymbolType(ksymtInvalidGlyphAttr)) ;
	Assert(m_psymtblSubTable);
	return m_psymtblSubTable->FindField(sta);
}

/*----------------------------------------------------------------------------------------------
    Return the class that is stored as data, or NULL.
----------------------------------------------------------------------------------------------*/
GdlGlyphClassDefn * GrcSymbolTableEntry::GlyphClassDefnData()
{
	if (!HasData())
		return NULL;

	GdlGlyphClassDefn * pglfc = dynamic_cast<GdlGlyphClassDefn *>(Data());
	return pglfc;
}

/*----------------------------------------------------------------------------------------------
    Return the feature that is stored as data, or NULL.
----------------------------------------------------------------------------------------------*/
GdlFeatureDefn * GrcSymbolTableEntry::FeatureDefnData()
{
	if (!HasData())
		return NULL;

	GdlFeatureDefn * pfeat = dynamic_cast<GdlFeatureDefn *>(Data());
	return pfeat;
}

/*----------------------------------------------------------------------------------------------
    Return the language-map that is stored as data, or NULL.
----------------------------------------------------------------------------------------------*/
GdlLanguageDefn * GrcSymbolTableEntry::LanguageDefnData()
{
	if (!HasData())
		return NULL;

	GdlLanguageDefn * plang = dynamic_cast<GdlLanguageDefn *>(Data());
	return plang;
}

/*----------------------------------------------------------------------------------------------
    Return the level of the justification symbol. Return -2 if this is not such a symbol;
	-1 if this has no level associated (eg, justify.stretch).
----------------------------------------------------------------------------------------------*/
int GrcSymbolTableEntry::JustificationLevel()
{
	if (!DoesJustification())
		return -2;

	std::string sta;
	int nLevel = 0;
	do {
		sta = FieldAt(nLevel);
		nLevel++;
	} while (sta != "justify");
	sta = FieldAt(nLevel);

	if (sta == "0")
		return 0;
	else if (sta == "1")
		return 1;
	else if (sta == "2")
		return 2;
	else if (sta == "3")
		return 3;
	else if (sta == "stretch" || sta == "stretchHW" || sta == "shrink" || sta == "step"
		|| sta == "weight" || sta == "width")
	{
		return -1; // no level specified
	}
	else
		return 4; // some invalid level
}

/*----------------------------------------------------------------------------------------------
    Adjust the expression type to be something more specific, if possible. If the new
	expression type does not fit within the constraints of the old, return false.
----------------------------------------------------------------------------------------------*/
bool GrcSymbolTableEntry::AdjustExpTypeIfPossible(ExpressionType expt)
{
	if (m_expt == kexptUnknown)
	{
		m_expt = expt;
		return true;
	}
	if (m_expt == expt)
	{
		return true;
	}
	if (m_expt == kexptZero && (expt == kexptNumber || expt == kexptMeas || expt == kexptBoolean))
	{
		m_expt = expt;
		return true;
	}
	if (m_expt == kexptOne && (expt == kexptNumber || expt == kexptBoolean))
	{
		m_expt = expt;
		return true;
	}
	return false;
}

/*----------------------------------------------------------------------------------------------
    For slot attributes, return the corresponding engine code operator.
----------------------------------------------------------------------------------------------*/
int GrcSymbolTableEntry::SlotAttrEngineCodeOp()
{
	Assert(FitsSymbolType(ksymtSlotAttr)) ;

	std::string staField0 = FieldAt(0);
	std::string staField1 = FieldAt(1);
	std::string staField2 = FieldAt(2);

	if (staField0 == "advance")
	{
		if (staField1 == "x")
			return kslatAdvX;
		else if (staField1 == "y")
			return kslatAdvY;
		else
		{
			Assert(false);
		}
	}
	else if (staField0 == "attach")
	{
		if (staField1 == "to")
			return kslatAttTo;

		else if (staField1 == "at")
		{
			if (staField2 == "x")
				return kslatAttAtX;
			else if (staField2 == "y")
				return kslatAttAtY;
			else if (staField2 == "gpoint")
				return kslatAttAtGpt;
			else if (staField2 == "xoffset")
				return kslatAttAtXoff;
			else if (staField2 == "yoffset")
				return kslatAttAtYoff;
			else
			{
				Assert(false);
			}
		}
		else if (staField1 == "with")
		{
			if (staField2 == "x")
				return kslatAttWithX;
			else if (staField2 == "y")
				return kslatAttWithY;
			else if (staField2 == "gpoint")
				return kslatAttWithGpt;
			else if (staField2 == "xoffset")
				return kslatAttWithXoff;
			else if (staField2 == "yoffset")
				return kslatAttWithYoff;
			else
			{
				Assert(false);
			}
		}

		else if (staField1 == "level")
			return kslatAttLevel;

		else
		{
			Assert(false);
		}
	}
	else if (staField0 == "breakweight")
		return kslatBreak;

	else if (staField0 == "component")
	{
		Assert(staField2 == "reference");
		return kslatCompRef;
	}

	else if (staField0 == "directionality")
		return kslatDir;

	else if (staField0 == "insert")
		return kslatInsert;

	else if (staField0 == "position")
	{
		if (staField1 == "x")
			return kslatPosX;
		else if (staField1 == "y")
			return kslatPosY;
		else
		{
			Assert(false);
		}
	}

	else if (staField0 == "shift")
	{
		if (staField1 == "x")
			return kslatShiftX;
		else if (staField1 == "y")
			return kslatShiftY;
		else
		{
			Assert(false);
		}
	}

	else if (staField0 == "measure")
	{
		if (staField1 == "startofline")
			return kslatMeasureSol;
		else if (staField1 == "endofline")
			return kslatMeasureEol;
		else
		{
			Assert(false);
		}
	}

	else if (staField0 == "justify")	// TODO: handle all the levels
	{
		if (staField1 == "stretch")
			return kslatJStretch;
		else if (staField1 == "shrink")
			return kslatJShrink;
		else if (staField1 == "step")
			return kslatJStep;
		else if (staField1 == "weight")
			return kslatJWeight;
		else if (staField1 == "width")
			return kslatJWidth;
		else if (staField1 == "0")
		{
			if (staField2 == "stretch")
				return kslatJStretch;
			else if (staField2 == "shrink")
				return kslatJShrink;
			else if (staField2 == "step")
				return kslatJStep;
			else if (staField2 == "weight")
				return kslatJWeight;
			else if (staField2 == "width")
				return kslatJWidth;
			else
			{
				Assert(false);
			}
		}
		else
		{
			Assert(false);
		}
	}

	else if (staField0 == "segsplit")
		return kslatSegSplit;

	else if (IsUserDefinableSlotAttr())
	{
		return kslatUserDefn;
	}

	else if (staField0[0] == 'u' && staField0[1] == 's' && 
		staField0[2] == 'e' && staField0[3] == 'r')
	{
		Assert(false);
		return kslatUserDefn;
	}

	else
	{
		Assert(false);
	}

	return -1;
}


/*----------------------------------------------------------------------------------------------
    For glyph metrics, return the corresponding engine code operator.
----------------------------------------------------------------------------------------------*/
int GrcSymbolTableEntry::GlyphMetricEngineCodeOp()
{
	if (!m_fGeneric && m_psymGeneric)
		return m_psymGeneric->GlyphMetricEngineCodeOp();

	Assert(FitsSymbolType(ksymtGlyphMetric)) ;

	std::string staField0 = FieldAt(0);
	std::string staField1 = FieldAt(1);
	std::string staField2 = FieldAt(2);

	if (staField0 == "leftsidebearing")
	{
		return kgmetLsb;
	}
	else if (staField0 == "rightsidebearing")
	{
		return kgmetRsb;
	}
	else if (staField0 == "boundingbox")
	{
		if (staField1 == "top")
			return kgmetBbTop;
		else if (staField1 == "bottom")
			return kgmetBbBottom;
		else if (staField1 == "left")
			return kgmetBbLeft;
		else if (staField1 == "right")
			return kgmetBbRight;
		else if (staField1 == "width")
			return kgmetBbWidth;
		else if (staField1 == "height")
			return kgmetBbHeight;
		else
		{
			Assert(false);
		}
	}
	else if (staField0 == "advancewidth")
	{
		return kgmetAdvWidth;
	}
	else if (staField0 == "advanceheight")
	{
		return kgmetAdvHeight;
	}
//	else if (staField0 == "advance")
//	{
//		if (staField1 == "width")
//			return kgmetAdvWidth;
//		else if (staField1 == "height")
//			return kgmetAdvHeight;
//		else
//			Assert(false);
//	}
	else if (staField0 == "ascent")
	{
		return kgmetAscent;
	}
	else if (staField0 == "descent")
	{
		return kgmetDescent;
	}
	else
	{
		Assert(false);
    }
	return -1;
}


/*----------------------------------------------------------------------------------------------
	Pre-define a system-defined symbol.
----------------------------------------------------------------------------------------------*/
Symbol GrcSymbolTable::PreDefineSymbol(const GrcStructName& xns, SymbolType symt,
	ExpressionType expt, OpPrec prec)
{
	Symbol psym = AddSymbolAux(xns, symt, ksymtInvalid, GrpLineAndFile());

	psym->m_expt = expt;
	psym->m_fUserDefined = false;
	psym->m_prec = prec;

	return psym;
}


/*----------------------------------------------------------------------------------------------
	Symbol table initialization
----------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitWithPreDefined()
{
	InitGlobals();
	InitDirectives();
	InitFeatureSettings();
	InitGlyphMetrics();
	InitOperators();
	InitSlotAttrs();
	InitGlyphAttrs();
	InitSpecial();
	InitTableTypes();
	InitUnits();
	InitProcStates();

	PreDefineSymbol(GrcStructName(GdlGlyphClassDefn::Undefined()), ksymtClass);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitGlobals()
{
	SymbolType kst = ksymtGlobal;

	PreDefineSymbol(GrcStructName("AutoPseudo"),			kst, kexptBoolean);
	PreDefineSymbol(GrcStructName("Bidi"),					kst, kexptBoolean);
	PreDefineSymbol(GrcStructName("ExtraAscent"),			kst, kexptMeas);
	PreDefineSymbol(GrcStructName("ExtraDescent"),			kst, kexptMeas);
	PreDefineSymbol(GrcStructName("ScriptDirection"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("ScriptDirections"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("ScriptTags"),			kst, kexptString);
	PreDefineSymbol(GrcStructName("ScriptTag"),				kst, kexptString);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitDirectives()
{
	SymbolType kst = ksymtDirective;

	PreDefineSymbol(GrcStructName("AttributeOverride"),		kst, kexptBoolean);
	PreDefineSymbol(GrcStructName("CodePage"),				kst, kexptNumber);
	PreDefineSymbol(GrcStructName("MaxBackup"),				kst, kexptNumber);
	PreDefineSymbol(GrcStructName("MaxRuleLoop"),			kst, kexptNumber);
	PreDefineSymbol(GrcStructName("MUnits"),				kst, kexptMeas);
	PreDefineSymbol(GrcStructName("PointRadius"),			kst, kexptMeas);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitFeatureSettings()
{
	SymbolType kst = ksymtFeatSetting;

	PreDefineSymbol(GrcStructName("id"),				kst, kexptNumber);
	PreDefineSymbol(GrcStructName("default"),			kst, kexptNumber);
	PreDefineSymbol(GrcStructName("settings"),			kst, kexptUnknown);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitGlyphMetrics()
{
	SymbolType kst = ksymtGlyphMetric;

	Symbol psym;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "top"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "bottom"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "left"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "right"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "height"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("boundingbox", "width"),	kst, kexptMeas);
	psym->m_fGeneric = true;

	psym = PreDefineSymbol(GrcStructName("advanceheight"),		kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("advancewidth"),		kst, kexptMeas);
	psym->m_fGeneric = true;

	psym = PreDefineSymbol(GrcStructName("leftsidebearing"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("rightsidebearing"),	kst, kexptMeas);	// = munits - lsb
	psym->m_fGeneric = true;

	psym = PreDefineSymbol(GrcStructName("ascent"),	kst, kexptMeas);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("descent"),	kst, kexptMeas);	// = font height - ascent
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("munits"),	kst, kexptNumber);
	psym->m_fGeneric = true;
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitOperators()
{
	SymbolType kst = ksymtOperator;
	ExpressionType kexpt = kexptUnknown;

	OpPrec kprec = GrcSymbolTableEntry::kprecFunctional;
	PreDefineSymbol(GrcStructName("min"),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("max"),	kst, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecAssignment;
	PreDefineSymbol(GrcStructName("="),		ksymtOpAssign, kexpt, kprec);
	PreDefineSymbol(GrcStructName("+="),	ksymtOpAssign, kexpt, kprec);
	PreDefineSymbol(GrcStructName("-="),	ksymtOpAssign, kexpt, kprec);
	PreDefineSymbol(GrcStructName("*="),	ksymtOpAssign, kexpt, kprec);
	PreDefineSymbol(GrcStructName("/="),	ksymtOpAssign, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecConditional;
	PreDefineSymbol(GrcStructName("?"),		kst, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecLogical;
	PreDefineSymbol(GrcStructName("||"),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("&&"),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("!"),		kst, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecComparative;
	PreDefineSymbol(GrcStructName("=="),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("!="),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("<"),		kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("<="),	kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName(">"),		kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName(">="),	kst, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecAdditive;
	PreDefineSymbol(GrcStructName("+"),		kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("-"),		kst, kexpt, kprec);

	kprec = GrcSymbolTableEntry::kprecMultiplicative;
	PreDefineSymbol(GrcStructName("*"),		kst, kexpt, kprec);
	PreDefineSymbol(GrcStructName("/"),		kst, kexpt, kprec);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitSlotAttrs()
{
	SymbolType kst = ksymtSlotAttr;
	SymbolType kstPt = ksymtSlotAttrPt;

	PreDefineSymbol(GrcStructName("attach", "to"),				kst, kexptSlotRef);
	PreDefineSymbol(GrcStructName("attach", "level"),			kst, kexptNumber);

	PreDefineSymbol(GrcStructName("attach", "at"),				kstPt, kexptPoint);
	PreDefineSymbol(GrcStructName("attach", "at", "x"),			kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "at", "y"),			kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "at", "gpath"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("attach", "at", "gpoint"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("attach", "at", "xoffset"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "at", "yoffset"),	kst, kexptMeas);

	PreDefineSymbol(GrcStructName("attach", "with"),			kstPt, kexptPoint);
	PreDefineSymbol(GrcStructName("attach", "with", "x"),		kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "with", "y"),		kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "with", "gpath"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("attach", "with", "gpoint"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("attach", "with", "xoffset"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("attach", "with", "yoffset"),	kst, kexptMeas);

	PreDefineSymbol(GrcStructName("breakweight"),	kst, kexptNumber);

	PreDefineSymbol(GrcStructName("component"),		kst);
	//	Specific component.?.reference attributes are added as component glyph attributes
	//	are defined, or as encountered.

	PreDefineSymbol(GrcStructName("directionality"),kst, kexptNumber);

	PreDefineSymbol(GrcStructName("user1"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user2"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user3"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user4"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user5"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user6"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user7"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user8"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user9"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user10"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user11"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user12"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user13"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user14"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user15"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("user16"),	kst, kexptNumber);

	PreDefineSymbol(GrcStructName("insert"),		kst, kexptBoolean);

	PreDefineSymbol(GrcStructName("advance"),		kstPt,	kexptPoint);
	PreDefineSymbol(GrcStructName("advance", "x"),	kst,	kexptMeas);
	PreDefineSymbol(GrcStructName("advance", "y"),	kst,	kexptMeas);
	//	bogus attributes for error detection:
	PreDefineSymbol(GrcStructName("advance", "gpath"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("advance", "gpoint"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("advance", "xoffset"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("advance", "yoffset"),	kst, kexptMeas);

	PreDefineSymbol(GrcStructName("kern"),				kstPt,	kexptPoint);
	PreDefineSymbol(GrcStructName("kern", "x"),			kst,	kexptMeas);
	PreDefineSymbol(GrcStructName("kern", "y"),			kst,	kexptMeas);
	//	bogus attributes for error detection:
	PreDefineSymbol(GrcStructName("kern", "gpath"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("kern", "gpoint"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("kern", "xoffset"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("kern", "yoffset"),	kst, kexptMeas);

	PreDefineSymbol(GrcStructName("position"),			kstPt,	kexptPoint);
	PreDefineSymbol(GrcStructName("position", "x"),		kst,	kexptMeas);
	PreDefineSymbol(GrcStructName("position", "y"),		kst,	kexptMeas);

	PreDefineSymbol(GrcStructName("shift"),				kstPt,	kexptPoint);
	PreDefineSymbol(GrcStructName("shift", "x"),		kst,	kexptMeas);
	PreDefineSymbol(GrcStructName("shift", "y"),		kst,	kexptMeas);
	//	bogus attributes for error detection:
	PreDefineSymbol(GrcStructName("shift", "gpath"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("shift", "gpoint"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("shift", "xoffset"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("shift", "yoffset"),	kst, kexptMeas);

	PreDefineSymbol(GrcStructName("measure", "startofline"),kst, kexptMeas);
	PreDefineSymbol(GrcStructName("measure", "endofline"),	kst, kexptMeas);

	//	TODO: handle all the levels.
	PreDefineSymbol(GrcStructName("justify", "stretch"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "stretchHW"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "shrink"),		kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "step"),		kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "weight"),		kst, kexptNumber);
	PreDefineSymbol(GrcStructName("justify", "width"),		kst, kexptMeas);

	PreDefineSymbol(GrcStructName("justify", "0", "stretch"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "0", "stretchHW"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "0", "shrink"),	kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "0", "step"),		kst, kexptMeas);
	PreDefineSymbol(GrcStructName("justify", "0", "weight"),	kst, kexptNumber);
	PreDefineSymbol(GrcStructName("justify", "0", "width"),		kst, kexptMeas);

	PreDefineSymbol(GrcStructName("segsplit"),	kst, kexptNumber);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitGlyphAttrs()
{
	//	These were first recorded as slot attributes:

	Symbol psym;
	psym = AddType2(GrcStructName("component"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("directionality"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("breakweight"), ksymtGlyphAttr);
	psym->m_fGeneric = true;

	//	TODO: handle all the levels
	psym = AddType2(GrcStructName("justify", "stretch"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "shrink"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "step"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "weight"), ksymtGlyphAttr);
	psym->m_fGeneric = true;

	psym = AddType2(GrcStructName("justify", "0", "stretch"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "0", "shrink"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "0", "step"), ksymtGlyphAttr);
	psym->m_fGeneric = true;
	psym = AddType2(GrcStructName("justify", "0", "weight"), ksymtGlyphAttr);
	psym->m_fGeneric = true;

	//	A fake glyph attribute that is used to store the actual glyph ID for pseudo-glyphs.
	psym = PreDefineSymbol(GrcStructName("*actualForPseudo*"), ksymtGlyphAttr, kexptNumber);
	psym->m_fGeneric = true;

	// These are just glyph attributes. These two must be in this order and contiguous,
	// so that the internal IDs are assigned correctly.

	psym = PreDefineSymbol(GrcStructName("mirror", "glyph"), ksymtGlyphAttr, kexptGlyphID);
	psym->m_fGeneric = true;
	psym = PreDefineSymbol(GrcStructName("mirror", "isEncoded"), ksymtGlyphAttr, kexptBoolean);
	psym->m_fGeneric = true;
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitSpecial()
{
	SymbolType kst = ksymtSpecial;

	PreDefineSymbol(GrcStructName("@"),	ksymtSpecialAt);
	PreDefineSymbol(GrcStructName("^"),	ksymtSpecialCaret);
	PreDefineSymbol(GrcStructName("#"),	ksymtSpecialLb);
	PreDefineSymbol(GrcStructName("_"), ksymtSpecialUnderscore);

	AddType2(GrcStructName("?"), kst);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitTableTypes()
{
	SymbolType kst = ksymtTableRule;

	PreDefineSymbol(GrcStructName("linebreak"),			kst);
	PreDefineSymbol(GrcStructName("substitution"),		kst);
	PreDefineSymbol(GrcStructName("justification"),		kst);
	PreDefineSymbol(GrcStructName("positioning"),		kst);

	kst = ksymtTable;

	PreDefineSymbol(GrcStructName("feature"),			kst);
	PreDefineSymbol(GrcStructName("glyph"),				kst);
	PreDefineSymbol(GrcStructName("name"),				kst);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitUnits()
{
	PreDefineSymbol(GrcStructName("m"),	ksymtUnit);
}

/*--------------------------------------------------------------------------------------------*/
void GrcSymbolTable::InitProcStates()
{
	SymbolType kst = ksymtProcState;

	PreDefineSymbol(GrcStructName("JustifyMode"),	kst, kexptNumber);
	//PreDefineSymbol(GrcStructName("JustifyLevel"),	kst, kexptNumber);
}