Ejemplo n.º 1
0
		private void FixupGroups(LoadContext context) {
			Debug.Assert(groupByStartSymbol.Count == 0);
			if (fileVersion == CgtVersion.V1_0) {
				List<Group> commentGroups = new List<Group>(1);
				foreach (Symbol blockStartSymbol in symbolTable) {
					if (blockStartSymbol.Kind == SymbolKind.BlockStart) {
						foreach (Symbol blockEndSymbol in symbolTable) {
							if (blockEndSymbol.Kind == SymbolKind.BlockEnd) {
								Group group = new Group(this, commentGroups.Count, "Block Comment", GroupAdvanceMode.Character, GroupEndingMode.Closed);
								commentGroups.Add(group);
								group.Initialize(blockStartSymbol, blockStartSymbol, blockEndSymbol, new Group[] { group });
								groupByStartSymbol.Add(blockStartSymbol, group); // this will fail if there was more than one end symbol of the type "CommentEnd" in the grammar
							}
						}
					}
				}
				groupTable = commentGroups.ToArray();
			} else {
				for (int i = 0; i < groupTable.Length; i++) {
					GroupInfo info = context.GroupInfos[i];
					Group[] nesting = new Group[info.Nesting.Length];
					for (int n = 0; n < nesting.Length; n++) {
						nesting[n] = groupTable[info.Nesting[n]];
					}
					Group group = groupTable[i];
					group.Initialize(GetSymbol(info.ContainerIndex), GetSymbol(info.StartIndex), GetSymbol(info.EndIndex), nesting);
					groupByStartSymbol.Add(group.StartSymbol, group);
				}
			}
		}