Skip to content

Commit 76ba227

Browse files
[WIP] Added prefix on assingment, gonna start implement logic for builder
1 parent f2d35e2 commit 76ba227

17 files changed

Lines changed: 212 additions & 182 deletions

File tree

Resources/kebnf.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ element
3131
;
3232

3333
assignment
34-
: property=dotted_id op=(ASSIGN | ADD_ASSIGN | BOOL_ASSIGN) content=element_core (suffix=suffix_op)?
34+
: property=dotted_id op=(ASSIGN | ADD_ASSIGN | BOOL_ASSIGN) (prefix=TILDE)?content=element_core (suffix=suffix_op)?
3535
;
3636

3737
non_parsing_assignment

SysML2.NET.CodeGenerator.Tests/Grammar/TextualNotationSpecificationVisitorTestFixture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace SysML2.NET.CodeGenerator.Tests.Grammar
2222
{
2323
using System;
2424
using System.IO;
25+
using System.Linq;
2526

2627
using Antlr4.Runtime;
2728

@@ -54,6 +55,7 @@ public void VerifyCanParseGrammar(string modelName)
5455
{
5556
Assert.That(rules, Is.Not.Null);
5657
Assert.That(rules, Is.Not.Empty);
58+
Assert.That(rules.DistinctBy(x => x.RuleName), Is.EquivalentTo(rules));
5759
}
5860

5961
Console.WriteLine($"Found {rules.Count} rules");

SysML2.NET.CodeGenerator/Generators/UmlHandleBarsGenerators/UmlCoreTextualNotationBuilderGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private async Task GenerateBuilderClassesInternal(XmiReaderResult xmiReaderResul
152152

153153
foreach (var umlClass in classes)
154154
{
155-
var generatedBuilder = template(umlClass);
155+
var generatedBuilder = template(new {ClassContext = umlClass, Rules = textualNotationSpecification.Rules});
156156
generatedBuilder = this.CodeCleanup(generatedBuilder);
157157

158158
var fileName = $"{umlClass.Name.CapitalizeFirstLetter()}TextualNotationBuilder.cs";

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.interp

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
token literal names:
2+
null
3+
'*'
4+
'+'
5+
'?'
6+
'true'
7+
'false'
8+
'this'
9+
'[QualifiedName]'
10+
null
11+
'+='
12+
'?='
13+
'|'
14+
':'
15+
';'
16+
','
17+
'('
18+
')'
19+
'['
20+
']'
21+
'{'
22+
'}'
23+
'.'
24+
'~'
25+
null
26+
null
27+
null
28+
null
29+
null
30+
null
31+
null
32+
33+
token symbolic names:
34+
null
35+
null
36+
null
37+
null
38+
null
39+
null
40+
null
41+
null
42+
ASSIGN
43+
ADD_ASSIGN
44+
BOOL_ASSIGN
45+
PIPE
46+
COLON
47+
SEMICOLON
48+
COMMA
49+
LPAREN
50+
RPAREN
51+
LBRACK
52+
RBRACK
53+
LBRACE
54+
RBRACE
55+
DOT
56+
TILDE
57+
ID
58+
INT
59+
STRING
60+
COMMENT
61+
WS
62+
CONTINUATION
63+
NL
64+
65+
rule names:
66+
specification
67+
rule_definition
68+
parameter_list
69+
alternatives
70+
alternative
71+
element
72+
assignment
73+
non_parsing_assignment
74+
non_parsing_empty
75+
cross_reference
76+
group
77+
terminal
78+
non_terminal
79+
element_core
80+
dotted_id
81+
suffix_op
82+
value_literal
83+
84+
85+
atn:
86+
[4, 1, 29, 152, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 1, 0, 5, 0, 36, 8, 0, 10, 0, 12, 0, 39, 9, 0, 1, 0, 4, 0, 42, 8, 0, 11, 0, 12, 0, 43, 1, 0, 1, 0, 1, 1, 1, 1, 3, 1, 50, 8, 1, 1, 1, 1, 1, 3, 1, 54, 8, 1, 1, 1, 1, 1, 1, 1, 3, 1, 59, 8, 1, 1, 1, 4, 1, 62, 8, 1, 11, 1, 12, 1, 63, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 75, 8, 3, 10, 3, 12, 3, 78, 9, 3, 1, 4, 5, 4, 81, 8, 4, 10, 4, 12, 4, 84, 9, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 3, 5, 93, 8, 5, 1, 6, 1, 6, 1, 6, 3, 6, 98, 8, 6, 1, 6, 1, 6, 3, 6, 102, 8, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 9, 3, 9, 114, 8, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 3, 10, 124, 8, 10, 1, 11, 1, 11, 3, 11, 128, 8, 11, 1, 12, 1, 12, 3, 12, 132, 8, 12, 1, 13, 1, 13, 1, 13, 1, 13, 3, 13, 138, 8, 13, 1, 14, 1, 14, 1, 14, 5, 14, 143, 8, 14, 10, 14, 12, 14, 146, 9, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 0, 0, 17, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 0, 4, 1, 0, 8, 10, 1, 0, 8, 9, 1, 0, 1, 3, 2, 0, 4, 7, 23, 25, 158, 0, 37, 1, 0, 0, 0, 2, 47, 1, 0, 0, 0, 4, 65, 1, 0, 0, 0, 6, 71, 1, 0, 0, 0, 8, 82, 1, 0, 0, 0, 10, 92, 1, 0, 0, 0, 12, 94, 1, 0, 0, 0, 14, 103, 1, 0, 0, 0, 16, 109, 1, 0, 0, 0, 18, 113, 1, 0, 0, 0, 20, 119, 1, 0, 0, 0, 22, 125, 1, 0, 0, 0, 24, 129, 1, 0, 0, 0, 26, 137, 1, 0, 0, 0, 28, 139, 1, 0, 0, 0, 30, 147, 1, 0, 0, 0, 32, 149, 1, 0, 0, 0, 34, 36, 5, 29, 0, 0, 35, 34, 1, 0, 0, 0, 36, 39, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 42, 3, 2, 1, 0, 41, 40, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 41, 1, 0, 0, 0, 43, 44, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 46, 5, 0, 0, 1, 46, 1, 1, 0, 0, 0, 47, 49, 5, 23, 0, 0, 48, 50, 3, 4, 2, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 53, 1, 0, 0, 0, 51, 52, 5, 12, 0, 0, 52, 54, 5, 23, 0, 0, 53, 51, 1, 0, 0, 0, 53, 54, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 56, 5, 8, 0, 0, 56, 58, 3, 6, 3, 0, 57, 59, 5, 13, 0, 0, 58, 57, 1, 0, 0, 0, 58, 59, 1, 0, 0, 0, 59, 61, 1, 0, 0, 0, 60, 62, 5, 29, 0, 0, 61, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 61, 1, 0, 0, 0, 63, 64, 1, 0, 0, 0, 64, 3, 1, 0, 0, 0, 65, 66, 5, 15, 0, 0, 66, 67, 5, 23, 0, 0, 67, 68, 5, 12, 0, 0, 68, 69, 5, 23, 0, 0, 69, 70, 5, 16, 0, 0, 70, 5, 1, 0, 0, 0, 71, 76, 3, 8, 4, 0, 72, 73, 5, 11, 0, 0, 73, 75, 3, 8, 4, 0, 74, 72, 1, 0, 0, 0, 75, 78, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 7, 1, 0, 0, 0, 78, 76, 1, 0, 0, 0, 79, 81, 3, 10, 5, 0, 80, 79, 1, 0, 0, 0, 81, 84, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 9, 1, 0, 0, 0, 84, 82, 1, 0, 0, 0, 85, 93, 3, 12, 6, 0, 86, 93, 3, 14, 7, 0, 87, 93, 3, 16, 8, 0, 88, 93, 3, 18, 9, 0, 89, 93, 3, 20, 10, 0, 90, 93, 3, 22, 11, 0, 91, 93, 3, 24, 12, 0, 92, 85, 1, 0, 0, 0, 92, 86, 1, 0, 0, 0, 92, 87, 1, 0, 0, 0, 92, 88, 1, 0, 0, 0, 92, 89, 1, 0, 0, 0, 92, 90, 1, 0, 0, 0, 92, 91, 1, 0, 0, 0, 93, 11, 1, 0, 0, 0, 94, 95, 3, 28, 14, 0, 95, 97, 7, 0, 0, 0, 96, 98, 5, 22, 0, 0, 97, 96, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 99, 1, 0, 0, 0, 99, 101, 3, 26, 13, 0, 100, 102, 3, 30, 15, 0, 101, 100, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 13, 1, 0, 0, 0, 103, 104, 5, 19, 0, 0, 104, 105, 3, 28, 14, 0, 105, 106, 7, 1, 0, 0, 106, 107, 3, 32, 16, 0, 107, 108, 5, 20, 0, 0, 108, 15, 1, 0, 0, 0, 109, 110, 5, 19, 0, 0, 110, 111, 5, 20, 0, 0, 111, 17, 1, 0, 0, 0, 112, 114, 5, 22, 0, 0, 113, 112, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 115, 1, 0, 0, 0, 115, 116, 5, 17, 0, 0, 116, 117, 5, 23, 0, 0, 117, 118, 5, 18, 0, 0, 118, 19, 1, 0, 0, 0, 119, 120, 5, 15, 0, 0, 120, 121, 3, 6, 3, 0, 121, 123, 5, 16, 0, 0, 122, 124, 3, 30, 15, 0, 123, 122, 1, 0, 0, 0, 123, 124, 1, 0, 0, 0, 124, 21, 1, 0, 0, 0, 125, 127, 3, 32, 16, 0, 126, 128, 3, 30, 15, 0, 127, 126, 1, 0, 0, 0, 127, 128, 1, 0, 0, 0, 128, 23, 1, 0, 0, 0, 129, 131, 5, 23, 0, 0, 130, 132, 3, 30, 15, 0, 131, 130, 1, 0, 0, 0, 131, 132, 1, 0, 0, 0, 132, 25, 1, 0, 0, 0, 133, 138, 3, 18, 9, 0, 134, 138, 3, 20, 10, 0, 135, 138, 3, 22, 11, 0, 136, 138, 3, 24, 12, 0, 137, 133, 1, 0, 0, 0, 137, 134, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 137, 136, 1, 0, 0, 0, 138, 27, 1, 0, 0, 0, 139, 144, 5, 23, 0, 0, 140, 141, 5, 21, 0, 0, 141, 143, 5, 23, 0, 0, 142, 140, 1, 0, 0, 0, 143, 146, 1, 0, 0, 0, 144, 142, 1, 0, 0, 0, 144, 145, 1, 0, 0, 0, 145, 29, 1, 0, 0, 0, 146, 144, 1, 0, 0, 0, 147, 148, 7, 2, 0, 0, 148, 31, 1, 0, 0, 0, 149, 150, 7, 3, 0, 0, 150, 33, 1, 0, 0, 0, 17, 37, 43, 49, 53, 58, 63, 76, 82, 92, 97, 101, 113, 123, 127, 131, 137, 144]

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnf.tokens renamed to SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/kebnf.tokens

File renamed without changes.

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseListener.cs renamed to SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/kebnfBaseListener.cs

File renamed without changes.

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfBaseVisitor.cs renamed to SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/kebnfBaseVisitor.cs

File renamed without changes.

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.cs renamed to SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/kebnfLexer.cs

File renamed without changes.

SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/SysML2/NET/CodeGenerator/Grammar/kebnfLexer.interp renamed to SysML2.NET.CodeGenerator/Grammar/AutoGenGrammar/kebnfLexer.interp

File renamed without changes.

0 commit comments

Comments
 (0)