Skip to content

Commit

Permalink
Revert "Add class name literals."
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Feb 18, 2021
1 parent 4a594ed commit 9677aaa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 60 deletions.
47 changes: 0 additions & 47 deletions src/diagrams/class/classDiagram.spec.js
Expand Up @@ -8,14 +8,6 @@ describe('class diagram, ', function () {
parser.yy = classDb;
});

it('should handle backquoted class names', function() {
const str =
'classDiagram\n' +
'class `Car`';

parser.parse(str);
});

it('should handle relation definitions', function () {
const str =
'classDiagram\n' +
Expand All @@ -28,18 +20,6 @@ describe('class diagram, ', function () {
parser.parse(str);
});

it('should handle backquoted relation definitions', function () {
const str =
'classDiagram\n' +
'`Class01` <|-- Class02\n' +
'Class03 *-- Class04\n' +
'Class05 o-- Class06\n' +
'Class07 .. Class08\n' +
'Class09 -- Class1';

parser.parse(str);
});

it('should handle relation definition of different types and directions', function () {
const str =
'classDiagram\n' +
Expand Down Expand Up @@ -87,17 +67,6 @@ describe('class diagram, ', function () {
parser.parse(str);
});

it('should handle generic class with a literal name', function() {
const str =
'classDiagram\n' +
'class `Car`~T~\n' +
'Driver -- `Car` : drives >\n' +
'`Car` *-- Wheel : have 4 >\n' +
'`Car` -- Person : < owns';

parser.parse(str);
});

it('should break when another `{`is encountered before closing the first one while defining generic class with brackets', function() {
const str =
'classDiagram\n' +
Expand Down Expand Up @@ -156,22 +125,6 @@ describe('class diagram, ', function () {
parser.parse(str);
});

it('should handle generic class with brackets and a literal name', function() {
const str =
'classDiagram\n' +
'class `Dummy_Class`~T~ {\n' +
'String data\n' +
' void methods()\n' +
'}\n' +
'\n' +
'class Flight {\n' +
' flightNumber : Integer\n' +
' departureTime : Date\n' +
'}';

parser.parse(str);
});

it('should handle class definitions', function() {
const str =
'classDiagram\n' +
Expand Down
14 changes: 1 addition & 13 deletions src/diagrams/class/parser/classDiagram.jison
Expand Up @@ -7,7 +7,6 @@
/* lexical grammar */
%lex
%x string
%x bqstring
%x generic
%x struct
%x href
Expand Down Expand Up @@ -50,10 +49,6 @@
<string>["] this.popState();
<string>[^"]* return "STR";

[`] this.begin("bqstring");
<bqstring>[`] this.popState();
<bqstring>[^`]+ return "BQUOTE_STR";

/*
---interactivity command---
'href' adds a link to the specified node. 'href' can only be specified when the
Expand Down Expand Up @@ -219,15 +214,10 @@ statements
;

className
:
| alphaNumToken { $$=$1; }
| classLiteralName { $$=$1; }
: alphaNumToken { $$=$1; }
| alphaNumToken className { $$=$1+$2; }
| classLiteralName className { $$=$1+$2; }
| alphaNumToken GENERICTYPE className { $$=$1+'~'+$2+$3; }
| classLiteralName GENERICTYPE className { $$=$1+'~'+$2+$3; }
| alphaNumToken GENERICTYPE { $$=$1+'~'+$2; }
| classLiteralName GENERICTYPE { $$=$1+'~'+$2; }
;

statement
Expand Down Expand Up @@ -319,6 +309,4 @@ textNoTagsToken: alphaNumToken | SPACE | MINUS | keywords ;

alphaNumToken : UNICODE_TEXT | NUM | ALPHA;

classLiteralName : BQUOTE_STR;

%%

0 comments on commit 9677aaa

Please sign in to comment.