Skip to content
Snippets Groups Projects
Commit eaa4e62e authored by Janis Daniel Dähne's avatar Janis Daniel Dähne
Browse files

- added notes support

parent d0efd576
Branches
No related tags found
No related merge requests found
No preview for this file type
......@@ -197,6 +197,7 @@ statement
| addToClassStatement
| interfaceDefinitionStatement
| enumDefinitionStatement
| noteDefinitionStatement
;
/* --- relations --- */
......@@ -309,10 +310,17 @@ maybeStereotype
| ANGEL_BRACKET_OPEN ANGEL_BRACKET_OPEN IDENT ANGEL_BRACKET_CLOSE ANGEL_BRACKET_CLOSE
;
nameDefinition
: IDENT
| STRING AS IDENT
| IDENT AS STRING
;
classDefinition
: CLASS_KEYWORD IDENT maybeStereotype
| CLASS_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| CLASS_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL classMemberList CURL_BRACKET_CLOSE
: CLASS_KEYWORD nameDefinition maybeStereotype
| CLASS_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| CLASS_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL classMemberList CURL_BRACKET_CLOSE
;
addToClassStatement
......@@ -345,9 +353,9 @@ interfaceMemberList
;
interfaceDefinitionStatement
: INTERFACE_KEYWORD IDENT maybeStereotype
| INTERFACE_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| INTERFACE_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL interfaceMemberList CURL_BRACKET_CLOSE
: INTERFACE_KEYWORD nameDefinition maybeStereotype
| INTERFACE_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| INTERFACE_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL interfaceMemberList CURL_BRACKET_CLOSE
;
/* --- end interfaces --- */
......@@ -368,14 +376,58 @@ enumMemberList
;
enumDefinitionStatement
: ENUM_KEYWORD IDENT maybeStereotype
| ENUM_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| ENUM_KEYWORD IDENT maybeStereotype CURL_BRACKET_OPEN NL enumMemberList CURL_BRACKET_CLOSE
: ENUM_KEYWORD nameDefinition maybeStereotype
| ENUM_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL CURL_BRACKET_CLOSE
| ENUM_KEYWORD nameDefinition maybeStereotype CURL_BRACKET_OPEN NL enumMemberList CURL_BRACKET_CLOSE
;
/* --- end enums --- */
/* --- notes --- */
noteNameDefinition
: AS IDENT
;
noteKeywordDirectionOf
: NOTE_KEYWORD_LEFT_OF
| NOTE_KEYWORD_RIGHT_OF
| NOTE_KEYWORD_TOP_OF
| NOTE_KEYWORD_BOTTOM_OF
;
noteKeywordDirection
: NOTE_KEYWORD_LEFT
| NOTE_KEYWORD_RIGHT
| NOTE_KEYWORD_TOP
| NOTE_KEYWORD_BOTTOM
;
noteKeywordOnLink
: NOTE_KEYWORD_ON_LINK
| NOTE_KEYWORD_LEFT_ON_LINK
| NOTE_KEYWORD_RIGHT_ON_LINK
| NOTE_KEYWORD_TOP_ON_LINK
| NOTE_KEYWORD_BOTTOM_ON_LINK
;
noteDefinitionStatement
: NOTE_KEYWORD STRING
| NOTE_KEYWORD STRING noteNameDefinition
| noteKeywordDirectionOf IDENT COLON STRING
| noteKeywordDirection COLON STRING
| noteKeywordOnLink COLON STRING
;
/* --- end nodes --- */
/* all lines ... */
someLine
:LINE
......
......@@ -421,20 +421,22 @@ const testsOk3: string[] = [
`note "this is a test" as N1`
,
`class X
note "connected to X"
note "connected to X"
note "not connected to X"
note "note connected to X" as Note0
note "connected to X"
note "note connected to X"
note top of X : "also connected to X"
note left of X : "also connected to X"
note right of X : "also connected to X"
note bottom of X : "also connected to X"
class Y
note top of X : "connected to X"
note left of X : "connected to X"
note right of X : "connected to X"
note bottom of X : "connected to X"
`
,
`class X
note "connected to X"
note "not connected to X"
note top of X : "also connected to X2"
`
,
......@@ -610,11 +612,11 @@ const testsOk4: string[] = [
`interface interface2 as " It works this way too"`
,
`interface " This is my interface" as interface1 << test >> {
void foo()
foo() : void
}`
,
`interface interface2 as " It works this way too" << test >> {
void foo()
foo() : void
}`
,
`enum " This is my enum" as enum1`
......@@ -1031,17 +1033,17 @@ a--
// displayTestResult(runTest(prog))
// })
// //
testsOk2.forEach(prog => {
displayTestResult(runTest(prog))
})
//
// testsOk3.forEach(prog => {
// testsOk2.forEach(prog => {
// displayTestResult(runTest(prog))
// })
//
testsOk4.forEach(prog => {
testsOk3.forEach(prog => {
displayTestResult(runTest(prog))
})
//
// testsOk4.forEach(prog => {
// displayTestResult(runTest(prog))
// })
// testsOk5.forEach(prog => {
// displayTestResult(runTest(prog))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment