@@ -13,7 +13,7 @@ function Diagram() {
13
13
/*
14
14
* Return an existing actor with this alias, or creates a new one with alias and name.
15
15
*/
16
- Diagram . prototype . getActor = function ( alias , name ) {
16
+ Diagram . prototype . getActor = function ( alias , name , lineno ) {
17
17
alias = alias . trim ( ) ;
18
18
19
19
var i ;
@@ -23,14 +23,14 @@ Diagram.prototype.getActor = function(alias, name) {
23
23
return actors [ i ] ;
24
24
}
25
25
}
26
- i = actors . push ( new Diagram . Actor ( alias , ( name || alias ) , actors . length ) ) ;
26
+ i = actors . push ( new Diagram . Actor ( alias , ( name || alias ) , actors . length , lineno ) ) ;
27
27
return actors [ i - 1 ] ;
28
28
} ;
29
29
30
30
/*
31
31
* Parses the input as either a alias, or a "name as alias", and returns the corresponding actor.
32
32
*/
33
- Diagram . prototype . getActorWithAlias = function ( input ) {
33
+ Diagram . prototype . getActorWithAlias = function ( input , lineno ) {
34
34
input = input . trim ( ) ;
35
35
36
36
// We are lazy and do some of the parsing in javascript :(. TODO move into the .jison file.
@@ -43,41 +43,47 @@ Diagram.prototype.getActorWithAlias = function(input) {
43
43
} else {
44
44
name = alias = input ;
45
45
}
46
- return this . getActor ( alias , name ) ;
46
+ return this . getActor ( alias , name , lineno ) ;
47
47
} ;
48
48
49
- Diagram . prototype . setTitle = function ( title ) {
50
- this . title = title ;
49
+ Diagram . prototype . setTitle = function ( title , lineno ) {
50
+ this . title = {
51
+ message : title ,
52
+ lineno : lineno
53
+ } ;
51
54
} ;
52
55
53
56
Diagram . prototype . addSignal = function ( signal ) {
54
57
this . signals . push ( signal ) ;
55
58
} ;
56
59
57
- Diagram . Actor = function ( alias , name , index ) {
58
- this . alias = alias ;
59
- this . name = name ;
60
- this . index = index ;
60
+ Diagram . Actor = function ( alias , name , index , lineno ) {
61
+ this . alias = alias ;
62
+ this . name = name ;
63
+ this . index = index ;
64
+ this . lineno = lineno ;
61
65
} ;
62
66
63
- Diagram . Signal = function ( actorA , signaltype , actorB , message ) {
67
+ Diagram . Signal = function ( actorA , signaltype , actorB , message , lineno ) {
64
68
this . type = 'Signal' ;
65
69
this . actorA = actorA ;
66
70
this . actorB = actorB ;
67
71
this . linetype = signaltype & 3 ;
68
72
this . arrowtype = ( signaltype >> 2 ) & 3 ;
69
73
this . message = message ;
74
+ this . lineno = lineno ;
70
75
} ;
71
76
72
77
Diagram . Signal . prototype . isSelf = function ( ) {
73
78
return this . actorA . index == this . actorB . index ;
74
79
} ;
75
80
76
- Diagram . Note = function ( actor , placement , message ) {
81
+ Diagram . Note = function ( actor , placement , message , lineno ) {
77
82
this . type = 'Note' ;
78
83
this . actor = actor ;
79
84
this . placement = placement ;
80
85
this . message = message ;
86
+ this . lineno = lineno ;
81
87
82
88
if ( this . hasManyActors ( ) && actor [ 0 ] == actor [ 1 ] ) {
83
89
throw new Error ( 'Note should be over two different actors' ) ;
0 commit comments