Skip to content

Commit e55d250

Browse files
author
Viktor Chernev
committed
Work on features and bugs
1 parent 7acb74a commit e55d250

File tree

14 files changed

+623
-692
lines changed

14 files changed

+623
-692
lines changed

DescribeParser/Parsers/ParserFor10/Describe10Lexer.cs

Lines changed: 187 additions & 181 deletions
Large diffs are not rendered by default.

DescribeParser/Parsers/ParserFor10/Describe10Parser.cs

Lines changed: 107 additions & 105 deletions
Large diffs are not rendered by default.

DescribeParser/Parsers/ParserFor11/Describe11Lexer.cs

Lines changed: 211 additions & 205 deletions
Large diffs are not rendered by default.

DescribeParser/Parsers/ParserFor11/Describe11Parser.cs

Lines changed: 112 additions & 109 deletions
Large diffs are not rendered by default.

DescribeParser/Unfold/DescribeUnfold.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public partial class DescribeUnfold
4444
/// <summary>
4545
/// Gets or sets the dictionary of tildes (head item ID - body items ID's).
4646
/// </summary>
47-
public Dictionary<string, List<string>> Tildes { get; set; }
47+
//public Dictionary<string, List<string>> Tildes { get; set; }
4848

4949
/// <summary>
5050
/// Gets or sets the dictionary of translations (item ID - item Text).
@@ -75,6 +75,7 @@ public partial class DescribeUnfold
7575
public Dictionary<string, List<string>> ProdidFile { get; set; }
7676

7777

78+
7879
/// <summary>
7980
/// Initializes a new instance of the <see cref="DescribeUnfold"/> class.
8081
/// </summary>
@@ -88,7 +89,6 @@ public DescribeUnfold()
8889

8990
PrimaryProductions = new List<string>();
9091
Productions = new Dictionary<string, List<string>>();
91-
Tildes = new Dictionary<string, List<string>>();
9292
Translations = new Dictionary<string, string>();
9393
Links = new Dictionary<string, List<DescribeLink>>();
9494
Decorators = new Dictionary<string, List<DescribeDecorator>>();

DescribeParser/Unfold/DescribeUnfold_ToString.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public override string ToString()
3232
text += Translations_ToString();
3333
text += Links_ToString();
3434
text += Decorators_ToString();
35-
text += Tildes_ToString();
3635
text += Environment.NewLine;
3736

3837
//File Placement
@@ -131,36 +130,7 @@ private string Productions_ToString()
131130
text += Environment.NewLine;
132131
return text;
133132
}
134-
private string Tildes_ToString()
135-
{
136-
string text = INDENT + ".Tildes" + Environment.NewLine;
137-
if (Tildes.Count == 0) return text;
138133

139-
foreach (KeyValuePair<string, List<string>> kvp in Tildes)
140-
{
141-
text += INDENT + INDENT + '"' + kvp.Key + "\" -> ";
142-
if (kvp.Value.Count > 10)
143-
{
144-
text += Environment.NewLine + INDENT + INDENT + INDENT;
145-
for (int i = 0; i < kvp.Value.Count - 1; i++)
146-
{
147-
text += "\"" + kvp.Value[i] + "\", ";
148-
if ((i + 1) % 10 == 0) text += Environment.NewLine + INDENT + INDENT + INDENT;
149-
}
150-
}
151-
else
152-
{
153-
for (int i = 0; i < kvp.Value.Count - 1; i++)
154-
{
155-
text += "\"" + kvp.Value[i] + "\", ";
156-
}
157-
}
158-
if(kvp.Value.Count > 0) text += "\"" + kvp.Value[kvp.Value.Count - 1] + "\";";
159-
text += Environment.NewLine;
160-
}
161-
text += Environment.NewLine;
162-
return text;
163-
}
164134
private string Translations_ToString()
165135
{
166136
string text = INDENT + ".Translations" + Environment.NewLine;

DescribeParser/Visitors/VisitorsFor10/UnfoldVisitor10.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,10 @@ private string DoExpression(DescribeUnfold u, Describe10Parser.ExpressionContext
300300

301301
if (right.StartsWith('~'))
302302
{
303-
u.Tildes.Add(head, new List<string>() { right.Substring(1) });
304-
u.Productions.Add(head, new List<string>());
303+
u.Productions.Add(head, new List<string>() { right.Substring(1) });
305304
}
306305
else
307306
{
308-
u.Tildes.Add(head, new List<string>());
309307
u.Productions.Add(head, new List<string>() { right });
310308
}
311309
}
@@ -323,7 +321,6 @@ private string DoExpression(DescribeUnfold u, Describe10Parser.ExpressionContext
323321
prodfile + "\"";
324322
throw new Exception(message);
325323
}
326-
u.Tildes.Add(head, new List<string>());
327324
u.Productions.Add(head, new List<string>() { right });
328325
}
329326
else if (thirdChild is Describe10Parser.Item_or_expression_listContext)
@@ -341,14 +338,12 @@ private string DoExpression(DescribeUnfold u, Describe10Parser.ExpressionContext
341338
throw new Exception(message);
342339
}
343340

344-
List<string> tildes = new List<string>();
345341
List<string> items = new List<string>();
346342
for (int i = 0; i < rights.Length; i++)
347343
{
348-
if (rights[i].StartsWith('~')) tildes.Add(rights[i].Substring(1));
344+
if (rights[i].StartsWith('~')) items.Add(rights[i].Substring(1));
349345
else items.Add(rights[i]);
350346
}
351-
u.Tildes.Add(head, tildes);
352347
u.Productions.Add(head, items);
353348
}
354349
else

DescribeParser/Visitors/VisitorsFor11/UnfoldVisitor11.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,10 @@ private string DoExpression(DescribeUnfold u, Describe11Parser.ExpressionContext
298298

299299
if (right.StartsWith('~'))
300300
{
301-
u.Tildes.Add(head, new List<string>() { right.Substring(1) });
302-
u.Productions.Add(head, new List<string>());
301+
u.Productions.Add(head, new List<string>() { right.Substring(1) });
303302
}
304303
else
305304
{
306-
u.Tildes.Add(head, new List<string>());
307305
u.Productions.Add(head, new List<string>() { right });
308306
}
309307
}
@@ -321,7 +319,6 @@ private string DoExpression(DescribeUnfold u, Describe11Parser.ExpressionContext
321319
prodfile + "\"";
322320
throw new Exception(message);
323321
}
324-
u.Tildes.Add(head, new List<string>());
325322
u.Productions.Add(head, new List<string>() { right });
326323
}
327324
else if (thirdChild is Describe11Parser.Item_or_expression_listContext)
@@ -339,14 +336,12 @@ private string DoExpression(DescribeUnfold u, Describe11Parser.ExpressionContext
339336
throw new Exception(message);
340337
}
341338

342-
List<string> tildes = new List<string>();
343339
List<string> items = new List<string>();
344340
for (int i = 0; i < rights.Length; i++)
345341
{
346-
if (rights[i].StartsWith('~')) tildes.Add(rights[i].Substring(1));
342+
if (rights[i].StartsWith('~')) items.Add(rights[i].Substring(1));
347343
else items.Add(rights[i]);
348344
}
349-
u.Tildes.Add(head, tildes);
350345
u.Productions.Add(head, items);
351346
}
352347
else

DescribeTranspiler/Translators/Translators/Html/HtmlBasicTranslator.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,20 +270,12 @@ string TranslateProduction(DescribeUnfold u, string id)
270270
List<string> li = new List<string>();
271271
if (u.Productions.ContainsKey(id)) li = u.Productions[id];
272272

273-
List<string> ti = new List<string>();
274-
if (u.Tildes.ContainsKey(id)) ti = u.Tildes[id];
275-
276273
string items = "";
277274
foreach (string s in li)
278275
{
279276
string z = TranslateProductionOrItem(u, s);
280277
items += z;
281278
}
282-
foreach (string s in ti)
283-
{
284-
string z = TranslateProductionOrItem(u, s);
285-
items += z;
286-
}
287279

288280
//do links
289281
//we are assuming there would be no backslashes in links

DescribeTranspiler/Translators/Translators/Html/HtmlPageTranslator.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,20 +272,12 @@ string TranslateProduction(DescribeUnfold u, string id)
272272
List<string> li = new List<string>();
273273
if (u.Productions.ContainsKey(id)) li = u.Productions[id];
274274

275-
List<string> ti = new List<string>();
276-
if (u.Tildes.ContainsKey(id)) ti = u.Tildes[id];
277-
278275
string items = "";
279276
foreach (string s in li)
280277
{
281278
string z = TranslateProductionOrItem(u, s);
282279
items += z;
283280
}
284-
foreach (string s in ti)
285-
{
286-
string z = TranslateProductionOrItem(u, s);
287-
items += z;
288-
}
289281

290282
//do links
291283
//we are assuming there would be no backslashes in links

0 commit comments

Comments
 (0)