Commit 2b77c93e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Parse multiple comments in textual procedures

parent 04ffe32c
...@@ -1948,6 +1948,9 @@ def _inner_procedure(proc, **kwargs): ...@@ -1948,6 +1948,9 @@ def _inner_procedure(proc, **kwargs):
# with procedure defined inside the current procedure # with procedure defined inside the current procedure
# Not critical: the editor forbids procedures inside procedures # Not critical: the editor forbids procedures inside procedures
if proc.external and SHARED_LIB:
return code, local_decl
# Save variable scopes (as local variables may shadow process variables) # Save variable scopes (as local variables may shadow process variables)
outer_scope = dict(VARIABLES) outer_scope = dict(VARIABLES)
local_scope = dict(LOCAL_VAR) local_scope = dict(LOCAL_VAR)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
   
# Resource object code # Resource object code
# #
# Created: Tue Jun 2 14:22:50 2015 # Created: Sat Jul 11 15:47:41 2015
# by: The Resource Compiler for PySide (Qt v4.8.6) # by: The Resource Compiler for PySide (Qt v4.8.4)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
   
...@@ -2011,7 +2011,13 @@ def procedure_pre(root, parent=None, context=None): ...@@ -2011,7 +2011,13 @@ def procedure_pre(root, parent=None, context=None):
proc.charPositionInLine = child.getCharPositionInLine() proc.charPositionInLine = child.getCharPositionInLine()
proc.inputString = child.toString() proc.inputString = child.toString()
elif child.type == lexer.COMMENT: elif child.type == lexer.COMMENT:
proc.comment, _, ___ = end(child) # there can be two comments in a procedure declaration
# keep only one and concatenate strings
comment, _, _ = end(child)
if not proc.comment:
proc.comment = comment
else:
proc.comment.inputString += ' {}'.format(comment.inputString)
elif child.type == lexer.TEXTAREA: elif child.type == lexer.TEXTAREA:
textarea, err, warn = text_area(child, context=proc) textarea, err, warn = text_area(child, context=proc)
if textarea.signals: if textarea.signals:
......
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-06-02 14:23:02 # $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2015-07-11 15:47:46
import sys import sys
from antlr3 import * from antlr3 import *
......
This diff is collapsed.
...@@ -256,12 +256,12 @@ parameters_of_sort ...@@ -256,12 +256,12 @@ parameters_of_sort
// (TODO - but check new SDL2000 syntax that has no RETURNS token) // (TODO - but check new SDL2000 syntax that has no RETURNS token)
procedure procedure
: cif? : cif?
PROCEDURE procedure_id end PROCEDURE procedure_id e1=end
fpar? fpar?
(text_area | procedure)* (text_area | procedure)*
((processBody? ENDPROCEDURE procedure_id?) | EXTERNAL) ((processBody? ENDPROCEDURE procedure_id?) | EXTERNAL)
end e2=end
-> ^(PROCEDURE cif? procedure_id end? fpar? -> ^(PROCEDURE cif? procedure_id $e1? $e2? fpar?
text_area* procedure* processBody? EXTERNAL?); text_area* procedure* processBody? EXTERNAL?);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
PROCESS orchestrator PROCESS orchestrator
/* CIF COMMENT (407, 195), (71, 35) */ /* CIF COMMENT (407, 195), (71, 35) */
COMMENT 'Hello'; COMMENT 'Hello';
/* CIF TEXT (0, 94), (398, 312) */ /* CIF TEXT (1, 138), (398, 328) */
dcl seq tastE_Peek_id_list := { 1,2,3,4,5}; dcl seq tastE_Peek_id_list := { 1,2,3,4,5};
dcl a myEnum; dcl a myEnum;
...@@ -12,18 +12,24 @@ dcl fixed fixedIntList := { 1,2,3}; ...@@ -12,18 +12,24 @@ dcl fixed fixedIntList := { 1,2,3};
dcl anInt T_UInt32 :=0; dcl anInt T_UInt32 :=0;
timer myTimer; timer myTimer;
procedure VDM comment '#hello';
fpar in inp fixedIntList,
in/out outp fixedIntList;
external comment '#vdm';
/* CIF ENDTEXT */ /* CIF ENDTEXT */
/* CIF START (743, 150), (80, 36) */ /* CIF START (743, 150), (80, 36) */
START; START;
/* CIF NEXTSTATE (749, 201), (68, 34) */ /* CIF NEXTSTATE (748, 201), (68, 34) */
NEXTSTATE Wait; NEXTSTATE Wait;
/* CIF STATE (1034, 125), (93, 35) */ /* CIF STATE (1131, 125), (93, 35) */
STATE timeout; STATE timeout;
/* CIF INPUT (1019, 180), (122, 35) */ /* CIF INPUT (1116, 180), (122, 35) */
INPUT Paramless_TC; INPUT Paramless_TC;
/* CIF PROCEDURECALL (981, 230), (200, 35) */ /* CIF PROCEDURECALL (1077, 230), (200, 35) */
CALL SET_timer(1000, mytimer); CALL SET_timer(1000, mytimer);
/* CIF NEXTSTATE (1046, 280), (70, 35) */ /* CIF NEXTSTATE (1142, 280), (70, 35) */
NEXTSTATE next; NEXTSTATE next;
ENDSTATE; ENDSTATE;
/* CIF STATE (992, 345), (70, 35) */ /* CIF STATE (992, 345), (70, 35) */
...@@ -35,7 +41,7 @@ timer myTimer; ...@@ -35,7 +41,7 @@ timer myTimer;
/* CIF NEXTSTATE (991, 500), (70, 35) */ /* CIF NEXTSTATE (991, 500), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
ENDSTATE; ENDSTATE;
/* CIF STATE (749, 201), (68, 34) */ /* CIF STATE (748, 201), (68, 34) */
STATE Wait; STATE Wait;
/* CIF INPUT (496, 255), (87, 35) */ /* CIF INPUT (496, 255), (87, 35) */
INPUT pulse(a); INPUT pulse(a);
...@@ -48,27 +54,37 @@ anint := 478; ...@@ -48,27 +54,37 @@ anint := 478;
CALL externalProc(anint, anint); CALL externalProc(anint, anint);
/* CIF PROCEDURECALL (427, 460), (224, 35) */ /* CIF PROCEDURECALL (427, 460), (224, 35) */
CALL writeln('Output param', anint); CALL writeln('Output param', anint);
/* CIF OUTPUT (482, 510), (114, 35) */ /* CIF PROCEDURECALL (398, 510), (283, 35) */
CALL writeln('Calling VDM with data');
/* CIF TASK (389, 560), (299, 35) */
TASK for each in fixed: call writeln(each); endfor;
/* CIF PROCEDURECALL (468, 610), (141, 35) */
CALL vdm(fixed, fixed);
/* CIF PROCEDURECALL (468, 660), (141, 40) */
CALL writeln('Result:');
/* CIF TASK (389, 720), (299, 35) */
TASK for each in fixed: call writeln(each); endfor;
/* CIF OUTPUT (482, 770), (114, 35) */
OUTPUT telemetry(a); OUTPUT telemetry(a);
/* CIF OUTPUT (478, 560), (123, 35) */ /* CIF OUTPUT (477, 820), (123, 35) */
OUTPUT peek_list(seq); OUTPUT peek_list(seq);
/* CIF OUTPUT (467, 610), (145, 35) */ /* CIF OUTPUT (466, 870), (145, 35) */
OUTPUT peek_fixed(fixed); OUTPUT peek_fixed(fixed);
/* CIF NEXTSTATE (504, 660), (70, 35) */ /* CIF NEXTSTATE (504, 920), (70, 35) */
NEXTSTATE next; NEXTSTATE next;
/* CIF INPUT (706, 255), (122, 35) */ /* CIF INPUT (803, 255), (122, 35) */
INPUT Paramless_TC; INPUT Paramless_TC;
/* CIF PROCEDURECALL (664, 305), (205, 35) */ /* CIF PROCEDURECALL (761, 305), (205, 35) */
CALL writeln('Got Paramless TC'); CALL writeln('Got Paramless TC');
/* CIF PROCEDURECALL (667, 355), (200, 35) */ /* CIF PROCEDURECALL (764, 355), (200, 35) */
CALL SET_timer(1000, mytimer); CALL SET_timer(1000, mytimer);
/* CIF OUTPUT (705, 405), (125, 35) */ /* CIF OUTPUT (801, 405), (125, 35) */
OUTPUT Paramless_TM; OUTPUT Paramless_TM;
/* CIF NEXTSTATE (732, 455), (70, 35) */ /* CIF NEXTSTATE (829, 455), (70, 35) */
NEXTSTATE wait; NEXTSTATE wait;
/* CIF INPUT (880, 255), (90, 35) */ /* CIF INPUT (977, 255), (90, 35) */
INPUT mytimer; INPUT mytimer;
/* CIF NEXTSTATE (880, 305), (90, 35) */ /* CIF NEXTSTATE (977, 305), (90, 35) */
NEXTSTATE Timeout; NEXTSTATE Timeout;
ENDSTATE; ENDSTATE;
ENDPROCESS orchestrator; ENDPROCESS orchestrator;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment