|
From: <ma...@us...> - 2009-09-23 16:45:27
|
Revision: 356
http://scstudio.svn.sourceforge.net/scstudio/?rev=356&view=rev
Author: madzin
Date: 2009-09-23 16:45:20 +0000 (Wed, 23 Sep 2009)
Log Message:
-----------
Error handling fix
--Thir line, and those below, will be ignored--
A trunk/tests/z120_test/z120_test62.mpr.result
A trunk/tests/z120_test/z120_test65.mpr.result
A trunk/tests/z120_test/z120_test60.mpr
A trunk/tests/z120_test/z120_test62.mpr
A trunk/tests/z120_test/z120_test64.mpr
A trunk/tests/z120_test/z120_test60.mpr.result
A trunk/tests/z120_test/z120_test61.mpr.result
A trunk/tests/z120_test/z120_test61.mpr
A trunk/tests/z120_test/z120_test63.mpr
A trunk/tests/z120_test/z120_test65.mpr
M trunk/tests/z120_test/CMakeLists.txt
A trunk/tests/z120_test/z120_test64.mpr.result
M trunk/src/data/Z120/display_error.cpp
M trunk/src/data/Z120/Z120.g
M trunk/src/data/Z120/Context.cpp
Modified Paths:
--------------
trunk/src/data/Z120/Context.cpp
trunk/src/data/Z120/Z120.g
trunk/src/data/Z120/display_error.cpp
trunk/tests/z120_test/CMakeLists.txt
Added Paths:
-----------
trunk/tests/z120_test/z120_test60.mpr
trunk/tests/z120_test/z120_test60.mpr.result
trunk/tests/z120_test/z120_test61.mpr
trunk/tests/z120_test/z120_test61.mpr.result
trunk/tests/z120_test/z120_test62.mpr
trunk/tests/z120_test/z120_test62.mpr.result
trunk/tests/z120_test/z120_test63.mpr
trunk/tests/z120_test/z120_test64.mpr
trunk/tests/z120_test/z120_test64.mpr.result
trunk/tests/z120_test/z120_test65.mpr
trunk/tests/z120_test/z120_test65.mpr.result
Modified: trunk/src/data/Z120/Context.cpp
===================================================================
--- trunk/src/data/Z120/Context.cpp 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/Context.cpp 2009-09-23 16:45:20 UTC (rev 356)
@@ -186,7 +186,7 @@
void check_collections_fun(struct Context* context)
{
if(!context->coregion_area_opened.empty())
- context->z->print_report(RS_WARNING, stringize() << "Warning 04: Instance " << TOWSTRING(context->element_name) << "does not have finished some coregion\n");
+ context->z->print_report(RS_WARNING, stringize() << "Warning 04: Instance " << TOWSTRING(context->element_name) << " does not have finished some coregion\n");
if(!context->messages.empty()){
context->z->print_report(RS_WARNING, L"Warning 05: There is complete message with only one event\n");
Modified: trunk/src/data/Z120/Z120.g
===================================================================
--- trunk/src/data/Z120/Z120.g 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/Z120.g 2009-09-23 16:45:20 UTC (rev 356)
@@ -110,7 +110,7 @@
;
pure_data_string:
- non_parenthesis (parenthesis)? (pure_data_string)?
+ non_parenthesis //(parenthesis)? (pure_data_string)?
;
parenthesis:
@@ -124,7 +124,7 @@
;
non_parenthesis:
- non_par_non_escape | (escapechar (escapechar | Character_String))
+ non_par_non_escape | escapechar (escapechar | Character_String)
;
@@ -258,7 +258,7 @@
{
init(context);
}
- (virtuality)? 'msc' msc_head (msc | hmsc) 'endmsc' end
+ (virtuality)? 'msc' msc_head ( ('expr' | (hmsc_statement_without_initial)* initial_node)=> hmsc | msc ) 'endmsc' end
{
msc_was_read_fun(context);
check_collections_fun(context);
@@ -286,7 +286,7 @@
;
msc_parm_decl_list:
- msc_parm_decl_block (end msc_parm_decl_list)?
+ msc_parm_decl_block_first (end msc_parm_decl_block)*
;
msc_parm_decl_block:
@@ -296,6 +296,13 @@
| timer_parameter_decl
;
+msc_parm_decl_block_first:
+ data_parameter_decl_first
+ | instance_parameter_decl
+ | message_parameter_decl
+ | timer_parameter_decl
+;
+
instance_parameter_decl:
'inst' instance_parm_decl_list
;
@@ -379,7 +386,7 @@
set_instance_name_fun(context, (char*) ($NAME.text->chars));
}
':' instance_event_list
-// | instance_name_list ':' multi_instance_event_list
+ | instance_name_list ':' multi_instance_event_list
;
instance_event_list:
@@ -396,7 +403,7 @@
set_event_name_fun(context, (char*) ($NAME.text->chars));
})?
(message_event |
-// method_call_event | incomplete_method_call_event | create |
+ method_call_event | create |
timer_statement | action)
('before' order_dest_list
{
@@ -418,7 +425,8 @@
;
time_dest_list:
- (time_dest ('origin')?)? time_interval (',' time_dest_list)?
+// (time_dest ('origin')?)?
+ time_interval (',' time_dest_list)?
;
time_dest:
@@ -441,7 +449,7 @@
;
instance_name_list:
- NAME (',' NAME)* | 'all'
+ NAME (',' NAME)+ | 'all'
;
multi_instance_event_list:
@@ -543,42 +551,21 @@
;
call_out:
- 'call' msg_identification 'to' input_address
+ 'call' msg_identification 'to' (input_address | 'lost' (input_address)?) //merged call_out and incomplete_call_out
;
call_in:
- 'receive' msg_identification 'from' output_address
+ 'receive' msg_identification 'from' (output_address | 'found' (output_address)?) //merged call_in and incomplete_call_in
;
reply_out:
- 'replyout' msg_identification 'to' input_address
+ 'replyout' msg_identification 'to' (input_address | 'lost' (input_address)?) //merged reply_out and incomplete_reply_out
;
reply_in:
- 'replyin' msg_identification 'from' output_address
+ 'replyin' msg_identification 'from' (output_address | 'found' (output_address)?) //merged reply_in and incomplete_reply_in
;
-incomplete_method_call_event:
- incomplete_call_out | incomplete_call_in |
- incomplete_reply_out | incomplete_reply_in
-;
-
-incomplete_call_out:
- 'call' msg_identification 'to' 'lost' (input_address)?
-;
-
-incomplete_call_in:
- 'receive' msg_identification 'from' 'found' (output_address)?
-;
-
-incomplete_reply_out:
- 'replyout' msg_identification 'to' 'lost' (input_address)?
-;
-
-incomplete_reply_in:
- 'replyin' msg_identification 'from' 'found' (output_address)?
-;
-
start_method:
'method' end
;
@@ -608,11 +595,11 @@
;
input_dest:
- 'lost' (input_address)? | input_address
+ 'lost' //(input_address)? | input_address
;
output_dest:
- 'found' (output_address)? | output_address
+ 'found' //(output_address)? | output_address
;
def_in_gate:
@@ -834,7 +821,14 @@
'action' action_statement
;
+/* if needed
action_statement:
+ ( ('def' | 'undef' | expression RIGHT_BIND_SYMBOL | pattern LEFT_BIND_SYMBOL
+ ) => data_statement_list )
+ | informal_action
+;*/
+
+action_statement:
informal_action | data_statement_list
;
@@ -905,7 +899,7 @@
;
unmatched_string:
- non_parenthesis (nestable_par)? (unmatched_string)?
+ non_parenthesis (nestable_par)? //(unmatched_string)?
;
escapechar:
@@ -919,7 +913,7 @@
// ----- Declaring data
message_decl_list:
- message_decl // (end message_decl_list)?
+ message_decl ( (end ~('inst' | 'msg' | 'timer' | 'variables'))=> end message_decl_list | )
;
message_decl:
@@ -931,7 +925,7 @@
;
timer_decl_list:
- timer_decl (end timer_decl_list)?
+ timer_decl ( (end ~('inst' | 'msg' | 'timer' | 'variables'))=> end timer_decl_list | )
;
timer_decl:
@@ -952,7 +946,7 @@
;
variable_decl_list:
- variable_decl_item (end variable_decl_list)?
+ variable_decl_item ((end string (',' | ':' string))=>end variable_decl_list |)
;
variable_decl_item:
@@ -975,9 +969,12 @@
// ----- Static Data
+data_parameter_decl_first:
+ ('variables')? variable_decl_list
+;
data_parameter_decl:
- ('variables')? variable_decl_list
+ 'variables' variable_decl_list
;
actual_data_parameters:
@@ -992,7 +989,7 @@
// ----- Bindings
binding:
- left_binding | right_binding
+ (pattern LEFT_BIND_SYMBOL)=> left_binding | right_binding
;
left_binding:
@@ -1016,8 +1013,7 @@
;
pattern:
- //string | wildcard
- NAME
+ string //| wildcard
;
//wildcard:
@@ -1032,7 +1028,8 @@
;
parameter_defn:
- binding | expression // | pattern
+ //binding |
+ expression // | pattern
;
@@ -1088,10 +1085,16 @@
// ----- Time Interval
time_interval:
+ (interval_label)? ( (('@')? ('(' | '[') (time_point)? ',')=> bounded_time (measurement)? | singular_time )
+;
+
+/*
+time_interval:
(interval_label)? singular_time
| (interval_label)? bounded_time
(measurement)?
;
+*/
interval_label:
('int_boundary')? NAME
@@ -1346,11 +1349,11 @@
;
ref_gate:
- actual_out_gate | actual_in_gate |
+// actual_out_gate | actual_in_gate |
actual_order_out_gate | actual_order_in_gate |
- actual_create_out_gate | actual_create_in_gate |
- actual_out_call_gate | actual_in_call_gate |
- actual_out_reply_gate | actual_in_reply_gate
+// actual_create_out_gate | actual_create_in_gate |
+// actual_out_call_gate | actual_in_call_gate |
+// actual_out_reply_gate | actual_in_reply_gate
;
@@ -1374,8 +1377,12 @@
(hmsc_body | 'expr' msc_expression)
;
+hmsc_statement_without_initial:
+ text_definition | final_node | intermediate_node
+;
+
hmsc_body:
- (hmsc_statement)*
+ (hmsc_statement_without_initial)* initial_node (hmsc_statement)*
;
hmsc_statement:
@@ -1416,7 +1423,7 @@
{
add_connect_name_fun(context, (char*) ($NAME.text->chars));
}
- (',' label_list)*
+ (',' label_list)? //change * to ?
;
intermediate_node:
Modified: trunk/src/data/Z120/display_error.cpp
===================================================================
--- trunk/src/data/Z120/display_error.cpp 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/src/data/Z120/display_error.cpp 2009-09-23 16:45:20 UTC (rev 356)
@@ -26,6 +26,7 @@
// Retrieve some info for easy reading.
pANTLR3_EXCEPTION ex = recognizer->state->exception;
+ pANTLR3_COMMON_TOKEN theToken= (pANTLR3_COMMON_TOKEN)(recognizer->state->exception->token);
// See if there is a 'filename' we can use
if (ex->streamName == NULL)
@@ -44,16 +45,29 @@
pANTLR3_STRING ftext = ex->streamName->to8(ex->streamName);
char* last_slash = (char *)ftext->chars;
+ bool slash_present = false;
// strip file path
for(char *ch = (char *)ftext->chars; *ch != 0; ch++)
{
if(*ch == '\\' || *ch == '/')
+ {
last_slash = ch;
+ slash_present = true;
+ }
}
- report << last_slash+1
- << "[" << recognizer->state->exception->line
- << "," << recognizer->state->exception->charPositionInLine << "]";
+ if(slash_present)
+ {
+ report << last_slash+1
+ << "[" << theToken->getLine(theToken)
+ << "," << theToken->getCharPositionInLine(theToken) << "]";
+ }
+ else
+ {
+ report << last_slash
+ << "[" << theToken->getLine(theToken)
+ << "," << theToken->getCharPositionInLine(theToken) << "]";
+ }
}
report << " ";
Modified: trunk/tests/z120_test/CMakeLists.txt
===================================================================
--- trunk/tests/z120_test/CMakeLists.txt 2009-09-23 07:47:29 UTC (rev 355)
+++ trunk/tests/z120_test/CMakeLists.txt 2009-09-23 16:45:20 UTC (rev 356)
@@ -80,6 +80,12 @@
ADD_Z120_TEST(z120_test57.mpr 0)
ADD_Z120_TEST(z120_test58.mpr 1)
ADD_Z120_TEST(z120_test59.mpr 1)
+ADD_Z120_TEST(z120_test60.mpr 1)
+ADD_Z120_TEST(z120_test61.mpr 1)
+ADD_Z120_TEST(z120_test62.mpr 1)
+ADD_Z120_TEST(z120_test63.mpr 1)
+ADD_Z120_TEST(z120_test64.mpr 1)
+ADD_Z120_TEST(z120_test65.mpr 1)
ADD_Z120_TEST(z120_time01.mpr 1)
Added: trunk/tests/z120_test/z120_test60.mpr
===================================================================
--- trunk/tests/z120_test/z120_test60.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test60.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,25 @@
+mscdocument Vkres2;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+label e0; out no,0 to server;
+label e1; in know,1 from server;
+endconcurrent
+out yes,2 to lost;
+concurrent
+label e2; in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+label e3; out know,1 to client;
+endconcurrent;
+concurrent;
+label e4; out tric,3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test60.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test60.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test60.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,29 @@
+z120_test60.mpr[10,0] Missing ';'.
+z120_test60.mpr[12,0] Missing ';'.
+OK: z120_test60 is correct, should be correct
+
+mscdocument z120_test60;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+out no,0 to server;
+in know,1 from server;
+endconcurrent;
+out yes,2 to lost;
+concurrent;
+in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+out know,1 to client;
+endconcurrent;
+concurrent;
+out tric,3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test61.mpr
===================================================================
--- trunk/tests/z120_test/z120_test61.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test61.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,25 @@
+mscdocument Vkres2;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+label e0; out no,0 to server;
+label e1; in know,1 from server;
+endconcurrent
+out yes,2 to lost;
+concurrent
+label e2; in tric,3 from server;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+label e3; out know,1 to client;
+endconcurrent;
+concurrent;
+label e4; out tric3 to client;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test61.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test61.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test61.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,31 @@
+z120_test61.mpr[10,0] Missing ';'.
+z120_test61.mpr[12,0] Missing ';'.
+Warning 05: There is complete message with only one event
+
+OK: z120_test61 is correct, should be correct
+
+mscdocument z120_test61;
+msc Strnka1;
+inst client;
+inst server;
+client: instance;
+concurrent;
+out no,0 to server;
+in know,1 from server;
+endconcurrent;
+out yes,2 to lost;
+concurrent;
+in tric,3 from found;
+endconcurrent;
+in tric,4 from found;
+endinstance;
+server: instance;
+in no,0 from client;
+concurrent;
+out know,1 to client;
+endconcurrent;
+concurrent;
+out tric3,5 to lost;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test62.mpr
===================================================================
--- trunk/tests/z120_test/z120_test62.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test62.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,11 @@
+/**************************************************
+Example of bMSC with commnet and definition of parameter after message identification
+**************************************************/
+
+mscdocument z120;
+msc test01;
+/*commnet example */
+ONE: instance; //comment example
+ONE: in LEFT,2('/*commnet example*/parameter') from found;
+ONE: edinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test62.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test62.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test62.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,12 @@
+z120_test62.mpr[10,5] Missing elements.
+Warning 20: Msc has not finished 1 instance
+
+OK: z120_test62 is correct, should be correct
+
+mscdocument z120_test62;
+msc test01;
+inst ONE;
+ONE: instance;
+in LEFT,0 from found;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test63.mpr
===================================================================
--- trunk/tests/z120_test/z120_test63.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test63.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,20 @@
+/*****************************************************
+Example of MSC where two instances have the same name (NAME)
+*****************************************************/
+
+msc Trick;
+inst NAME;
+inst NAME;
+NAME instance;
+out NAME,0 to NAME;
+endinstance
+NAME: instance;
+in NAME,0 from NAME;
+endinstance;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
+
Added: trunk/tests/z120_test/z120_test64.mpr
===================================================================
--- trunk/tests/z120_test/z120_test64.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test64.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,28 @@
+/*************************************************
+Example of bMSC with coregion (used '_' sign)
+*************************************************/
+
+mscdocument Vkres1;
+msc Strnka1;
+inst PC;
+inst Server;
+PC: instance;
+out SYN,0 to Server;
+in SYNACK,1 from Server;
+out ACK,2 to Server;
+out request_a,3 to Server;
+out request_b,4 to Server;
+in result,5 from Server;
+endinstance;
+Server: instance;
+in SYN,0 fom PC;
+out SYNACK,1 to PC;
+in ACK,2 from PC;
+concurrent;
+in request_a,3 from PC befre e0;
+in request_b,4 from PC;
+label e0;
+out result,5 to PC;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test64.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test64.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test64.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,34 @@
+z120_test64.mpr[18,9] Missing 'from'.
+z120_test64.mpr[18,9] Unwanted input: expected ';'.
+z120_test64.mpr[22,23] Missing ';'.
+z120_test64.mpr[22,29] Cannot match to any predicted input.
+z120_test64.mpr[24,6] Cannot match to any predicted input.
+Warning 04: Instance Server does not have finished some coregion
+
+Warning 05: There is complete message with only one event
+
+Warning 20: Msc has not finished 1 instance
+
+OK: z120_test64 is correct, should be correct
+
+mscdocument z120_test64;
+msc Strnka1;
+inst PC;
+inst Server;
+PC: instance;
+out SYN,0 to Server;
+in SYNACK,1 from Server;
+out ACK,2 to Server;
+out request_a,3 to Server;
+out request_b,4 to lost;
+in result,5 from found;
+endinstance;
+Server: instance;
+in SYN,0 from PC;
+out SYNACK,1 to PC;
+in ACK,2 from PC;
+concurrent;
+in request_a,3 from PC;
+endconcurrent;
+endinstance;
+endmsc;
Added: trunk/tests/z120_test/z120_test65.mpr
===================================================================
--- trunk/tests/z120_test/z120_test65.mpr (rev 0)
+++ trunk/tests/z120_test/z120_test65.mpr 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,37 @@
+mscdocument Vykres2;
+msc Two;
+inst Second;
+inst First;
+Second: instance;
+out true,0 to First;
+endinstance;
+First: instance;
+in true,0 from Second;
+endinstance;
+endmsc;
+msc Stranka_1;
+iitial connect L0;
+L0: reference One connect L1;
+L1: reference Two connect L2;
+L2: final;
+endmsc;
+msc One;
+initial connect L0;
+L0: condition access connect L1;
+L1: final;
+endmsc;
+msc Trick;
+inst NAME;
+inst NAME;
+NAME: instance;
+out NAME,0 to NAME;
+endinstance;
+NAME: instance;
+in NAME,0 from NAME;
+endinstance;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
Added: trunk/tests/z120_test/z120_test65.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test65.mpr.result (rev 0)
+++ trunk/tests/z120_test/z120_test65.mpr.result 2009-09-23 16:45:20 UTC (rev 356)
@@ -0,0 +1,38 @@
+z120_test65.mpr[13,7] Cannot match to any predicted input.
+Warning 16: Instance with the same name (NAME) has been created
+
+Warning 02: There are more unreferenced MSC
+
+OK: z120_test65 is correct, should be correct
+
+mscdocument z120_test65;
+msc One;
+initial connect L0;
+L0: condition access connect L1;
+L1: final;
+endmsc;
+msc Stranka_1;
+initial connect L0;
+L0: reference Trick connect L1;
+L1: final;
+endmsc;
+msc Two;
+inst Second;
+inst First;
+Second: instance;
+out true,0 to First;
+endinstance;
+First: instance;
+in true,0 from Second;
+endinstance;
+endmsc;
+msc Trick;
+inst NAME;
+inst NAME;
+NAME: instance;
+out NAME,0 to NAME;
+in NAME,0 from NAME;
+endinstance;
+NAME: instance;
+endinstance;
+endmsc;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|