diff --git a/compiler2/ttcn3/compiler.l b/compiler2/ttcn3/compiler.l index a61697e9b5666457779c65aed31e09462272e747..612b8e2beda3958128faae01badedbe0f7bc848c 100644 --- a/compiler2/ttcn3/compiler.l +++ b/compiler2/ttcn3/compiler.l @@ -619,7 +619,7 @@ oct2str RETURN(oct2strKeyword); regexp RETURN(regexpKeyword); replace RETURN(replaceKeyword); rnd RETURN(rndKeyword); -setencode RETURN(setencodeKeyword); +setencode RETURN_DOT(SetencodeKeyword); sizeof RETURN(sizeofKeyword); str2bit RETURN(str2bitKeyword); str2float RETURN(str2floatKeyword); diff --git a/compiler2/ttcn3/compiler.y b/compiler2/ttcn3/compiler.y index 4f4b8effea68e4f239a35e897600560c95a06ebd..373395f4916ecbf7de08d0a9c82eef8819e2ae47 100644 --- a/compiler2/ttcn3/compiler.y +++ b/compiler2/ttcn3/compiler.y @@ -846,6 +846,7 @@ static const string anyname("anytype"); %token DotStopKeyword %token DotTimeoutKeyword %token DotTriggerOpKeyword +%token DotSetencodeKeyword /* Predefined function identifiers */ @@ -889,7 +890,7 @@ static const string anyname("anytype"); %token replaceKeyword %token rndKeyword %token testcasenameKeyword -%token setencodeKeyword +%token SetencodeKeyword %token sizeofKeyword %token str2floatKeyword %token str2intKeyword @@ -8992,32 +8993,37 @@ SetstateStatement: } SetencodeStatement: - IDentifier '.' setencodeKeyword '(' Type ',' SingleExpression ')' + Reference DotSetencodeKeyword '(' Type ',' SingleExpression ')' { - delete $1; - delete $5; - delete $7; + if ($1.is_ref) { + delete $1.ref; + } + else { + delete $1.id; + } + delete $4; + delete $6; Location loc(infile, @$); - loc.error("'Port.setencode' is not currently supported."); + loc.error("'<port>.setencode' is not currently supported."); $$ = new Statement(Statement::S_ERROR); $$->set_location(infile, @$); } -| AllKeyword PortKeyword '.' setencodeKeyword '(' Type ',' SingleExpression ')' +| AllKeyword PortKeyword DotSetencodeKeyword '(' Type ',' SingleExpression ')' { - delete $6; - delete $8; + delete $5; + delete $7; Location loc(infile, @$); loc.error("'all port.setencode' is not currently supported."); $$ = new Statement(Statement::S_ERROR); $$->set_location(infile, @$); } -| SelfKeyword '.' setencodeKeyword '(' Type ',' SingleExpression ')' +| SelfKeyword DotSetencodeKeyword '(' Type ',' SingleExpression ')' { if (legacy_codec_handling) { Location loc(infile, @$); loc.error("'setencode' is not allowed when using legacy codec handling"); } - $$ = new Statement(Statement::S_SETENCODE, $5, $7); + $$ = new Statement(Statement::S_SETENCODE, $4, $6); $$->set_location(infile, @$); } ;