Commit 69d43614 authored by Laurent MEYER's avatar Laurent MEYER
Browse files

* Added support for TO parameter in OUTPUT primitive.

  Currently no autocompletion is done on the associated PIDs typed by the user
* Added basic support for SYNTYPE and NEWTYPE

These enhancements allow users to read/edit/write pr files with such constructions. However no verifications / auto completions are performed yet.
parent fb54cc53
......@@ -2258,6 +2258,9 @@ def outputbody(root, context):
child, context)
errors.extend(err)
warnings.extend(warn)
elif child.type == lexer.TO:
pass
# TODO: better support of TO primitive
else:
warnings.append('Unsupported output body type:' +
str(child.type))
......
......@@ -114,6 +114,15 @@ tokens {
FLOATING_LABEL;
COMPOSITE_STATE;
CONNECT;
SYNTYPE;
ENDSYNTYPE;
NEWTYPE;
ENDNEWTYPE;
ARRAY;
CONSTANTS;
STRUCT;
FIELDS;
FIELD;
}
......@@ -252,9 +261,11 @@ content
: (procedure
| fpar
| timer_declaration
| syntype_definition
| newtype_definition
| variable_definition)*
-> ^(TEXTAREA_CONTENT
fpar* procedure* variable_definition* timer_declaration*);
fpar* procedure* variable_definition* syntype_definition* newtype_definition* timer_declaration*);
timer_declaration
......@@ -263,6 +274,41 @@ timer_declaration
end
-> ^(TIMER timer_id+);
syntype_definition
: SYNTYPE syntype_name '=' parent_sort (CONSTANTS (range_condition (',' range_condition)* ))?
ENDSYNTYPE syntype_name? end
-> ^(SYNTYPE syntype_name parent_sort range_condition*);
syntype_name
: sort;
parent_sort
: sort;
newtype_definition
: NEWTYPE type_name (array_definition|structure_definition)? ENDNEWTYPE type_name? end
-> ^(NEWTYPE type_name array_definition* structure_definition*);
type_name
: sort;
array_definition
: ARRAY '(' sort ',' sort ')'
-> ^(ARRAY sort sort);
structure_definition
: STRUCT field_list end
-> ^(STRUCT field_list);
field_list
: field_definition (end field_definition)*
-> ^(FIELDS field_definition+);
field_definition
: field_name (',' field_name)* sort
-> ^(FIELD field_name+ sort);
variable_definition
: DCL variables_of_sort
(',' variables_of_sort)*
......@@ -642,24 +688,23 @@ output
outputbody
: outputstmt (',' outputstmt)*
-> ^(OUTPUT_BODY outputstmt+);
// to_part?
// via_part?
// -> (signal_id actual_parameters?)+ to_part? via_part?;
: outputstmt (',' outputstmt)* to_part?
-> ^(OUTPUT_BODY outputstmt+ to_part?);
// via_part?
// -> (signal_id actual_parameters?)+ to_part? via_part?;
outputstmt
: signal_id
actual_parameters?;
//to_part
// : ('TO' destination)
// -> ^(TO destination);
to_part
: ('TO' destination)
-> ^(TO destination);
//via_part
// : 'VIA' viabody
// -> ^(VIA viabody);
via_part
: 'VIA' viabody
-> ^(VIA viabody);
// ambiguous in SDL92, added OR between ALL and via_path
......@@ -1210,7 +1255,13 @@ BLOCK : B L O C K;
ENDBLOCK : E N D B L O C K;
SIGNALROUTE : S I G N A L R O U T E;
CONNECT : C O N N E C T;
SYNTYPE : S Y N T Y P E;
ENDSYNTYPE : E N D S Y N T Y P E;
NEWTYPE : N E W T Y P E;
ENDNEWTYPE : E N D N E W T Y P E;
ARRAY : A R R A Y;
CONSTANTS : C O N S T A N T S;
STRUCT : S T R U C T;
StringLiteral : STR+ ;
fragment
......
This diff is collapsed.
This diff is collapsed.
......@@ -45,7 +45,9 @@ SDL_BLACKBOLD = ['\\b{word}\\b'.format(word=word) for word in (
'EXPONENT', 'TRUE', 'FALSE', 'MOD', 'FI', 'WRITE', 'WRITELN',
'LENGTH', 'PRESENT', 'FPAR', 'TODO', 'FIXME', 'XXX',
'CHECKME', 'PROCEDURE', 'EXTERNAL', 'IN', 'OUT', 'TIMER',
'SET_TIMER', 'RESET_TIMER', 'VIA', 'ENTRY', 'EXIT')]
'SET_TIMER', 'RESET_TIMER', 'VIA', 'ENTRY', 'EXIT',
'SYNTYPE', 'ENDSYNTYPE', 'CONSTANTS',
'NEWTYPE', 'ENDNEWTYPE', 'ARRAY', 'STRUCT')]
SDL_REDBOLD = ['\\b{word}\\b'.format(word=word) for word in (
'INPUT', 'OUTPUT', 'STATE', 'DECISION', 'NEXTSTATE',
......
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