From d17d0f6a8857041553e74a8f119ccd486972e864 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 31 Aug 2018 22:19:24 +0200 Subject: [PATCH] kernel: remove incomplete support for !{...} syntax Specifically, `posobj!{indices}` was meant to relate to `list{indices}` the same way as `posobj![i]` does to `list[i]`. But it was never fully implemented. Specifically, no printing or execution functions for the relevant statement and expression types were implemented; and for the interpreter and compiler, mostly trying to use these lead to an error a long the line of "sorry, this feature has not been implemented". Due to all this, trying to use this feature in a coded function could trigger all kinds of problems, up to crashes. Since this code serves no clear purpose, we just remote it, instead of trying to implement the missing bits. Fixes #2765 --- src/code.c | 122 +++-------------------- src/code.h | 28 ------ src/compiler.c | 100 ------------------- src/intrprtr.c | 204 --------------------------------------- src/intrprtr.h | 22 ----- src/lists.c | 21 ---- src/lists.h | 10 -- src/read.c | 44 ++------- src/scanner.c | 1 - src/scanner.h | 1 - tst/testinstall/list.tst | 22 ----- 11 files changed, 18 insertions(+), 557 deletions(-) diff --git a/src/code.c b/src/code.c index ff108118bb..a0bc9bdb20 100644 --- a/src/code.c +++ b/src/code.c @@ -2287,9 +2287,7 @@ void CodeIsbGVar ( *F CodeAssListLevel( ) . . . . . . code assignment to several lists *F CodeAsssListLevel( ) . code multiple assignment to several lists */ -void CodeAssListUniv ( - Stat ass, - Int narg) +static void CodeAssListUniv(Stat ass, Int narg) { Expr list; /* list expression */ Expr pos; /* position expression */ @@ -2404,7 +2402,7 @@ void CodeUnbList ( Int narg ) *F CodeElmListLevel( ) . . . . . . . code selection of several lists *F CodeElmsListLevel( ) . code multiple selection of several lists */ -void CodeElmListUniv ( +static void CodeElmListUniv ( Expr ref, Int narg) { @@ -2709,17 +2707,17 @@ void CodeIsbRecExpr ( void ) /**************************************************************************** ** *F CodeAssPosObj() . . . . . . . . . . . . . . . . code assignment to a list -*F CodeAsssPosObj() . . . . . . . . . . code multiple assignment to a list -*F CodeAssPosObjLevel( ) . . . . . code assignment to several lists -*F CodeAsssPosObjLevel( ) code multiple assignment to several lists */ -void CodeAssPosObjUniv ( - Stat ass ) +void CodeAssPosObj ( void ) { + Stat ass; /* assignment, result */ Expr list; /* list expression */ Expr pos; /* position expression */ Expr rhsx; /* right hand side expression */ + /* allocate the assignment */ + ass = NewStat( T_ASS_POSOBJ, 3 * sizeof(Stat) ); + /* enter the right hand side expression */ rhsx = PopExpr(); WRITE_STAT(ass, 2, rhsx); @@ -2736,54 +2734,6 @@ void CodeAssPosObjUniv ( PushStat( ass ); } -void CodeAssPosObj ( void ) -{ - Stat ass; /* assignment, result */ - - /* allocate the assignment */ - ass = NewStat( T_ASS_POSOBJ, 3 * sizeof(Stat) ); - - /* let 'CodeAssPosObjUniv' do the rest */ - CodeAssPosObjUniv( ass ); -} - -void CodeAsssPosObj ( void ) -{ - Stat ass; /* assignment, result */ - - /* allocate the assignment */ - ass = NewStat( T_ASSS_POSOBJ, 3 * sizeof(Stat) ); - - /* let 'CodeAssPosObjUniv' do the rest */ - CodeAssPosObjUniv( ass ); -} - -void CodeAssPosObjLevel ( - UInt level ) -{ - Stat ass; /* assignment, result */ - - /* allocate the assignment and enter the level */ - ass = NewStat( T_ASS_POSOBJ_LEV, 4 * sizeof(Stat) ); - WRITE_STAT(ass, 3, level); - - /* let 'CodeAssPosObjUniv' do the rest */ - CodeAssPosObjUniv( ass ); -} - -void CodeAsssPosObjLevel ( - UInt level ) -{ - Stat ass; /* assignment, result */ - - /* allocate the assignment and enter the level */ - ass = NewStat( T_ASSS_POSOBJ_LEV, 4 * sizeof(Stat) ); - WRITE_STAT(ass, 3, level); - - /* let 'CodeAssPosObjUniv' do the rest */ - CodeAssPosObjUniv( ass ); -} - /**************************************************************************** ** @@ -2814,16 +2764,16 @@ void CodeUnbPosObj ( void ) /**************************************************************************** ** *F CodeElmPosObj() . . . . . . . . . . . . . . . . code selection of a list -*F CodeElmsPosObj() . . . . . . . . . . . code multiple selection of a list -*F CodeElmPosObjLevel( ) . . . . . . code selection of several lists -*F CodeElmsPosObjLevel( ) code multiple selection of several lists */ -void CodeElmPosObjUniv ( - Expr ref ) +void CodeElmPosObj ( void ) { + Expr ref; /* reference, result */ Expr list; /* list expression */ Expr pos; /* position expression */ + /* allocate the reference */ + ref = NewExpr( T_ELM_POSOBJ, 2 * sizeof(Expr) ); + /* enter the position expression */ pos = PopExpr(); WRITE_EXPR(ref, 1, pos); @@ -2836,54 +2786,6 @@ void CodeElmPosObjUniv ( PushExpr( ref ); } -void CodeElmPosObj ( void ) -{ - Expr ref; /* reference, result */ - - /* allocate the reference */ - ref = NewExpr( T_ELM_POSOBJ, 2 * sizeof(Expr) ); - - /* let 'CodeElmPosObjUniv' to the rest */ - CodeElmPosObjUniv( ref ); -} - -void CodeElmsPosObj ( void ) -{ - Expr ref; /* reference, result */ - - /* allocate the reference */ - ref = NewExpr( T_ELMS_POSOBJ, 2 * sizeof(Expr) ); - - /* let 'CodeElmPosObjUniv' to the rest */ - CodeElmPosObjUniv( ref ); -} - -void CodeElmPosObjLevel ( - UInt level ) -{ - Expr ref; /* reference, result */ - - /* allocate the reference and enter the level */ - ref = NewExpr( T_ELM_POSOBJ_LEV, 3 * sizeof(Expr) ); - WRITE_EXPR(ref, 2, level); - - /* let 'CodeElmPosObjUniv' do the rest */ - CodeElmPosObjUniv( ref ); -} - -void CodeElmsPosObjLevel ( - UInt level ) -{ - Expr ref; /* reference, result */ - - /* allocate the reference and enter the level */ - ref = NewExpr( T_ELMS_POSOBJ_LEV, 3 * sizeof(Expr) ); - WRITE_EXPR(ref, 2, level); - - /* let 'CodeElmPosObjUniv' do the rest */ - CodeElmPosObjUniv( ref ); -} - /**************************************************************************** ** diff --git a/src/code.h b/src/code.h index fba28ccb20..070c2c73d4 100644 --- a/src/code.h +++ b/src/code.h @@ -216,9 +216,6 @@ enum STAT_TNUM { T_UNB_REC_EXPR, T_ASS_POSOBJ, - T_ASSS_POSOBJ, - T_ASS_POSOBJ_LEV, - T_ASSS_POSOBJ_LEV, T_UNB_POSOBJ, T_ASS_COMOBJ_NAME, @@ -424,9 +421,6 @@ enum EXPR_TNUM { T_ISB_REC_EXPR, T_ELM_POSOBJ, - T_ELMS_POSOBJ, - T_ELM_POSOBJ_LEV, - T_ELMS_POSOBJ_LEV, T_ISB_POSOBJ, T_ELM_COMOBJ_NAME, @@ -1254,40 +1248,18 @@ extern void CodeIsbRecExpr ( void ); /**************************************************************************** ** *F CodeAssPosObj() . . . . . . . . . . . . . . . . code assignment to a list -*F CodeAsssPosObj() . . . . . . . . . . code multiple assignment to a list -*F CodeAssPosObjLevel() . . . . . . code assignment to several lists -*F CodeAsssPosObjLevel() . code multiple assignment to several lists */ extern void CodeAssPosObj ( void ); -extern void CodeAsssPosObj ( void ); - -extern void CodeAssPosObjLevel ( - UInt level ); - -extern void CodeAsssPosObjLevel ( - UInt level ); - extern void CodeUnbPosObj ( void ); /**************************************************************************** ** *F CodeElmPosObj() . . . . . . . . . . . . . . . . code selection of a list -*F CodeElmsPosObj() . . . . . . . . . . . code multiple selection of a list -*F CodeElmPosObjLevel() . . . . . . . code selection of several lists -*F CodeElmsPosObjLevel() . code multiple selection of several lists */ extern void CodeElmPosObj ( void ); -extern void CodeElmsPosObj ( void ); - -extern void CodeElmPosObjLevel ( - UInt level ); - -extern void CodeElmsPosObjLevel ( - UInt level ); - extern void CodeIsbPosObj ( void ); diff --git a/src/compiler.c b/src/compiler.c index 2f51d708de..9e2793b2ca 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -3432,42 +3432,6 @@ CVar CompElmPosObj ( } -/**************************************************************************** -** -*F CompElmsPosObj( ) . . . . . . . . . . . . . . . . . T_ELMS_POSOBJ -*/ -CVar CompElmsPosObj ( - Expr expr ) -{ - Emit( "CANNOT COMPILE EXPRESSION OF TNUM %d;\n", TNUM_EXPR(expr) ); - return 0; -} - - -/**************************************************************************** -** -*F CompElmPosObjLev( ) . . . . . . . . . . . . . . T_ELM_POSOBJ_LEV -*/ -CVar CompElmPosObjLev ( - Expr expr ) -{ - Emit( "CANNOT COMPILE EXPRESSION OF TNUM %d;\n", TNUM_EXPR(expr) ); - return 0; -} - - -/**************************************************************************** -** -*F CompElmsPosObjLev( ) . . . . . . . . . . . . . . . . T_ELMS_POSOBJ -*/ -CVar CompElmsPosObjLev ( - Expr expr ) -{ - Emit( "CANNOT COMPILE EXPRESSION OF TNUM %d;\n", TNUM_EXPR(expr) ); - return 0; -} - - /**************************************************************************** ** *F CompIsbPosObj( ) . . . . . . . . . . . . . . . . . . T_ISB_POSOBJ @@ -4983,64 +4947,6 @@ void CompAssPosObj ( } - -/**************************************************************************** -** -*F CompAsssPosObj( ) . . . . . . . . . . . . . . . . . T_ASSS_POSOBJ -*/ -void CompAsssPosObj ( - Stat stat ) -{ - CVar list; /* list */ - CVar poss; /* positions */ - CVar rhss; /* right hand sides */ - - /* print a comment */ - if ( CompPass == 2 ) { - Emit( "\n/* " ); PrintStat( stat ); Emit( " */\n" ); - } - - /* compile the list expression */ - list = CompExpr(READ_STAT(stat, 0)); - - /* compile and check the position expression */ - poss = CompExpr(READ_STAT(stat, 1)); - - /* compile the right hand side */ - rhss = CompExpr(READ_STAT(stat, 2)); - - /* emit the code */ - Emit( "AsssPosObjCheck( %c, %c, %c );\n", list, poss, rhss ); - - /* free the temporaries */ - if ( IS_TEMP_CVAR( rhss ) ) FreeTemp( TEMP_CVAR( rhss ) ); - if ( IS_TEMP_CVAR( poss ) ) FreeTemp( TEMP_CVAR( poss ) ); - if ( IS_TEMP_CVAR( list ) ) FreeTemp( TEMP_CVAR( list ) ); -} - - -/**************************************************************************** -** -*F CompAssPosObjLev( ) . . . . . . . . . . . . . . T_ASS_POSOBJ_LEV -*/ -void CompAssPosObjLev ( - Stat stat ) -{ - Emit( "CANNOT COMPILE STATEMENT OF TNUM %d;\n", TNUM_STAT(stat) ); -} - - -/**************************************************************************** -** -*F CompAsssPosObjLev( ) . . . . . . . . . . . . . . T_ASSS_POSOBJ_LEV -*/ -void CompAsssPosObjLev ( - Stat stat ) -{ - Emit( "CANNOT COMPILE STATEMENT OF TNUM %d;\n", TNUM_STAT(stat) ); -} - - /**************************************************************************** ** *F CompUnbPosObj( ) . . . . . . . . . . . . . . . . . . T_UNB_POSOBJ @@ -5918,9 +5824,6 @@ static Int InitKernel ( CompExprFuncs[ T_ISB_REC_EXPR ] = CompIsbRecExpr; CompExprFuncs[ T_ELM_POSOBJ ] = CompElmPosObj; - CompExprFuncs[ T_ELMS_POSOBJ ] = CompElmsPosObj; - CompExprFuncs[ T_ELM_POSOBJ_LEV ] = CompElmPosObjLev; - CompExprFuncs[ T_ELMS_POSOBJ_LEV ] = CompElmsPosObjLev; CompExprFuncs[ T_ISB_POSOBJ ] = CompIsbPosObj; CompExprFuncs[ T_ELM_COMOBJ_NAME ] = CompElmComObjName; CompExprFuncs[ T_ELM_COMOBJ_EXPR ] = CompElmComObjExpr; @@ -6005,9 +5908,6 @@ static Int InitKernel ( CompStatFuncs[ T_UNB_REC_EXPR ] = CompUnbRecExpr; CompStatFuncs[ T_ASS_POSOBJ ] = CompAssPosObj; - CompStatFuncs[ T_ASSS_POSOBJ ] = CompAsssPosObj; - CompStatFuncs[ T_ASS_POSOBJ_LEV ] = CompAssPosObjLev; - CompStatFuncs[ T_ASSS_POSOBJ_LEV ] = CompAsssPosObjLev; CompStatFuncs[ T_UNB_POSOBJ ] = CompUnbPosObj; CompStatFuncs[ T_ASS_COMOBJ_NAME ] = CompAssComObjName; CompStatFuncs[ T_ASS_COMOBJ_EXPR ] = CompAssComObjExpr; diff --git a/src/intrprtr.c b/src/intrprtr.c index c4d45d89df..68a7d4eae6 100644 --- a/src/intrprtr.c +++ b/src/intrprtr.c @@ -3470,9 +3470,6 @@ void IntrIsbRecExpr ( void ) /**************************************************************************** ** *F IntrAssPosObj() . . . . . . . . . . . . . interpret assignment to a list -*F IntrAsssPosObj() . . . . . . . . interpret multiple assignment to a list -*F IntrAssPosObjLevel() . . . . interpret assignment to several lists -*F IntrAsssPosObjLevel() . intr multiple assignment to several lists */ void IntrAssPosObj ( void ) { @@ -3530,106 +3527,6 @@ void IntrAssPosObj ( void ) PushObj( rhs ); } -void IntrAsssPosObj ( void ) -{ - Obj list; /* list */ - Obj poss; /* positions */ - Obj rhss; /* right hand sides */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeAsssPosObj(); return; } - - - /* get the right hand sides */ - rhss = PopObj(); - CheckIsDenseList("PosObj Assignment", "rhss", rhss); - - /* get and check the positions */ - poss = PopObj(); - CheckIsPossList("PosObj Assignment", poss); - CheckSameLength("List Assignment", "rhss", "positions", rhss, poss); - - /* get the list (checking is done by 'ASSS_LIST') */ - list = PopObj(); - - /* assign to several elements of the list */ - if ( TNUM_OBJ(list) == T_POSOBJ -#ifdef HPCGAP - || TNUM_OBJ(list) == T_APOSOBJ -#endif - ) { - ErrorQuit( "sorry: !{} not yet implemented", 0L, 0L ); - } - else { - ASSS_LIST( list, poss, rhss ); - } - - /* push the right hand sides again */ - PushObj( rhss ); -} - -void IntrAssPosObjLevel ( - UInt level ) -{ - Obj pos; /* position, left operand */ - Obj rhss; /* right hand sides, right operand */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeAssPosObjLevel( level ); return; } - - - /* get right hand sides (checking is done by 'AssPosObjLevel') */ - rhss = PopObj(); - - /* get and check the position */ - pos = PopObj(); - if ( ! IS_POS_INTOBJ(pos) ) { - ErrorQuit( - "PosObj Assignment: must be a positive integer (not a %s)", - (Int)TNAM_OBJ(pos), 0L ); - } - - /* assign the right hand sides to the elements of several lists */ - ErrorQuit( - "sorry: {}![] not yet implemented", - 0L, 0L ); - - /* push the assigned values again */ - PushObj( rhss ); -} - -void IntrAsssPosObjLevel ( - UInt level ) -{ - Obj poss; /* position, left operand */ - Obj rhss; /* right hand sides, right operand */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeAsssPosObjLevel( level ); return; } - - - /* get right hand sides (checking is done by 'AsssPosObjLevel') */ - rhss = PopObj(); - - /* get and check the positions */ - poss = PopObj(); - CheckIsPossList("PosObj Assignment", poss); - - /* assign the right hand sides to several elements of several lists */ - ErrorQuit( - "sorry: {}!{} not yet implemented", - 0L, 0L ); - - /* push the assigned values again */ - PushObj( rhss ); -} - void IntrUnbPosObj ( void ) { Obj list; /* list */ @@ -3684,9 +3581,6 @@ void IntrUnbPosObj ( void ) /**************************************************************************** ** *F IntrElmPosObj() . . . . . . . . . . . . . . interpret selection of a list -*F IntrElmsPosObj() . . . . . . . . interpret multiple selection of a list -*F IntrElmPosObjLevel() . . . . interpret selection of several lists -*F IntrElmsPosObjLevel() . intr multiple selection of several lists */ void IntrElmPosObj ( void ) { @@ -3755,104 +3649,6 @@ void IntrElmPosObj ( void ) PushObj( elm ); } -void IntrElmsPosObj ( void ) -{ - Obj elms; /* elements, result */ - Obj list; /* list, left operand */ - Obj poss; /* positions, right operand */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeElmsPosObj(); return; } - - - /* get and check the positions */ - poss = PopObj(); - CheckIsPossList("PosObj Elements", poss); - - /* get the list (checking is done by 'ELMS_LIST') */ - list = PopObj(); - - /* select several elements from the list */ - if ( TNUM_OBJ(list) == T_POSOBJ -#ifdef HPCGAP - || TNUM_OBJ(list) == T_APOSOBJ -#endif - ) { - elms = 0; - ErrorQuit( "sorry: !{} not yet implemented", 0L, 0L ); - } - else { - elms = ELMS_LIST( list, poss ); - } - - /* push the elements */ - PushObj( elms ); -} - -void IntrElmPosObjLevel ( - UInt level ) -{ - Obj lists; /* lists, left operand */ - Obj pos; /* position, right operand */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeElmPosObjLevel( level ); return; } - - - /* get and check the position */ - pos = PopObj(); - if ( ! IS_POS_INTOBJ(pos) ) { - ErrorQuit( - "PosObj Element: must be a positive integer (not a %s)", - (Int)TNAM_OBJ(pos), 0L ); - } - - /* get lists (if this works, then is nested deep, */ - /* checking it is nested +1 deep is done by 'ElmPosObjLevel') */ - lists = PopObj(); - - /* select the elements from several lists (store them in ) */ - ErrorQuit( - "sorry: {}![] not yet implemented", - 0L, 0L ); - - /* push the elements */ - PushObj( lists ); -} - -void IntrElmsPosObjLevel ( - UInt level ) -{ - Obj lists; /* lists, left operand */ - Obj poss; /* positions, right operand */ - - /* ignore or code */ - SKIP_IF_RETURNING(); - SKIP_IF_IGNORING(); - if ( STATE(IntrCoding) > 0 ) { CodeElmsPosObjLevel( level ); return; } - - - /* get and check the positions */ - poss = PopObj(); - CheckIsPossList("PosObj Elements", poss); - - /* get lists (if this works, then is nested deep, */ - /* checking it is nested +1 deep is done by 'ElmsPosObjLevel') */ - lists = PopObj(); - - /* select several elements from several lists (store them in ) */ - ErrorQuit( - "sorry: {}!{} not yet implemented", - 0L, 0L ); - - /* push the elements */ - PushObj( lists ); -} - void IntrIsbPosObj ( void ) { Obj isb; /* isbound, result */ diff --git a/src/intrprtr.h b/src/intrprtr.h index ed5c5cb57a..b46b16d221 100644 --- a/src/intrprtr.h +++ b/src/intrprtr.h @@ -839,40 +839,18 @@ extern void IntrIsbRecExpr ( void ); /**************************************************************************** ** *F IntrAssPosObj() . . . . . . . . . . . . interpret assignment to a posobj -*F IntrAsssPosObj() . . . . . . . interpret multiple assignment to a posobj -*F IntrAssPosObjLevel() . . . interpret assignment to several posobjs -*F IntrAsssPosObjLevel() intr multiple assignment to several posobjs */ extern void IntrAssPosObj ( void ); -extern void IntrAsssPosObj ( void ); - -extern void IntrAssPosObjLevel ( - UInt level ); - -extern void IntrAsssPosObjLevel ( - UInt level ); - extern void IntrUnbPosObj ( void ); /**************************************************************************** ** *F IntrElmPosObj() . . . . . . . . . . . . . interpret selection of a posobj -*F IntrElmsPosObj() . . . . . . . . interpret multiple selection of a posobj -*F IntrElmPosObjLevel() . . . interpret selection of several posobjs -*F IntrElmsPosObjLevel() . intr multiple selection of several posobjs */ extern void IntrElmPosObj ( void ); -extern void IntrElmsPosObj ( void ); - -extern void IntrElmPosObjLevel ( - UInt level ); - -extern void IntrElmsPosObjLevel ( - UInt level ); - extern void IntrIsbPosObj ( void ); diff --git a/src/lists.c b/src/lists.c index 19e66daec8..4f7e368428 100644 --- a/src/lists.c +++ b/src/lists.c @@ -2128,27 +2128,6 @@ void AsssListCheck ( } -/**************************************************************************** -** -*F AsssPosObjCheck( , , ) . . . . . . . . . . . ASSS_LIST -*/ -void AsssPosObjCheck ( - Obj list, - Obj poss, - Obj rhss ) -{ - CheckIsPossList("List Assignment", poss); - CheckIsDenseList("List Assignment", "rhss", rhss); - CheckSameLength("List Assignment", "rhss", "positions", rhss, poss); - if ( TNUM_OBJ(list) == T_POSOBJ ) { - ErrorQuit( "sorry: !{} not yet implemented", 0L, 0L ); - } - else { - ASSS_LIST( list, poss, rhss ); - } -} - - /**************************************************************************** ** *F AsssListLevelCheck( , , , ) . . AsssListLevel diff --git a/src/lists.h b/src/lists.h index ecdb5cc0fb..dbfbd9b80a 100644 --- a/src/lists.h +++ b/src/lists.h @@ -973,16 +973,6 @@ extern void AsssListCheck ( Obj rhss ); -/**************************************************************************** -** -*F AsssPosObjCheck( , , ) . . . . . . . . . . . ASSS_LIST -*/ -extern void AsssPosObjCheck ( - Obj list, - Obj poss, - Obj rhss ); - - /**************************************************************************** ** *F AsssListLevelCheck( , , , ) . . AsssListLevel diff --git a/src/read.c b/src/read.c index c3fc2c3e59..5bd893bc7d 100644 --- a/src/read.c +++ b/src/read.c @@ -231,10 +231,9 @@ static UInt WarnOnUnboundGlobalsRNam; ** R_HVAR: high var with id ** R_DVAR: debug var with id , at nesting level ** R_GVAR: global var with id -** R_ELM_LIST: uses , -** R_ELMS_LIST: uses -** R_ELM_POSOBJ: uses -** R_ELMS_POSOBJ: uses +** R_ELM_LIST: list access l[idx], uses , +** R_ELMS_LIST: list access l{indices}, uses +** R_ELM_POSOBJ: pos obj access obj![idx] ** R_ELM_REC_NAME: record access r. ** R_ELM_REC_EXPR record access r.(expr) ** R_ELM_COMOBJ_NAME: com obj access obj. @@ -251,7 +250,6 @@ enum REFTYPE { R_ELM_LIST, R_ELMS_LIST, R_ELM_POSOBJ, - R_ELMS_POSOBJ, R_ELM_REC_NAME, R_ELM_REC_EXPR, R_ELM_COMOBJ_NAME, @@ -309,17 +307,8 @@ static UInt EvalRef(const LHSRef ref, Int needExpr) IntrElmsListLevel(ref.level); return ref.level + 1; case R_ELM_POSOBJ: - if (ref.level == 0) - IntrElmPosObj(); - else - IntrElmPosObjLevel(ref.level); - return ref.level; - case R_ELMS_POSOBJ: - if (ref.level == 0) - IntrElmsPosObj(); - else - IntrElmsPosObjLevel(ref.level); - return ref.level + 1; + IntrElmPosObj(); + break; case R_ELM_REC_NAME: IntrElmRecName(ref.rnam); break; @@ -377,16 +366,7 @@ static void AssignRef(const LHSRef ref) IntrAsssListLevel(ref.level); break; case R_ELM_POSOBJ: - if (ref.level == 0) - IntrAssPosObj(); - else - IntrAssPosObjLevel(ref.level); - break; - case R_ELMS_POSOBJ: - if (ref.level == 0) - IntrAsssPosObj(); - else - IntrAsssPosObjLevel(ref.level); + IntrAssPosObj(); break; case R_ELM_REC_NAME: IntrAssRecName(ref.rnam); @@ -447,7 +427,6 @@ static void UnbindRef(const LHSRef ref) break; case R_INVALID: case R_ELMS_LIST: - case R_ELMS_POSOBJ: case R_FUNCCALL: case R_FUNCCALL_OPTS: default: @@ -493,7 +472,6 @@ static void IsBoundRef(const LHSRef ref) break; case R_INVALID: case R_ELMS_LIST: - case R_ELMS_POSOBJ: case R_FUNCCALL: case R_FUNCCALL_OPTS: default: @@ -545,16 +523,6 @@ static LHSRef ReadSelector(TypSymbolSet follow, UInt level) ReadExpr(S_RBRACK | follow, 'r'); Match(S_RBRACK, "]", follow); ref.type = R_ELM_POSOBJ; - ref.level = level; - } - - // '!{' '}' sublist selector - else if (STATE(Symbol) == S_BLBRACE) { - Match(S_BLBRACE, "!{", follow); - ReadExpr(S_RBRACE | follow, 'r'); - Match(S_RBRACE, "}", follow); - ref.type = R_ELMS_POSOBJ; - ref.level = level; } // '.' record selector diff --git a/src/scanner.c b/src/scanner.c index b812b31d08..4db17b3f10 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -935,7 +935,6 @@ static UInt NextSymbol(void) case '!': symbol = S_ILLEGAL; c = GET_NEXT_CHAR(); if (c == '.') { symbol = S_BDOT; GET_NEXT_CHAR(); break; } if (c == '[') { symbol = S_BLBRACK; GET_NEXT_CHAR(); break; } - if (c == '{') { symbol = S_BLBRACE; GET_NEXT_CHAR(); break; } break; case '[': symbol = S_LBRACK; GET_NEXT_CHAR(); break; case ']': symbol = S_RBRACK; GET_NEXT_CHAR(); break; diff --git a/src/scanner.h b/src/scanner.h index ea873b0f34..ab5a3e6a42 100644 --- a/src/scanner.h +++ b/src/scanner.h @@ -41,7 +41,6 @@ enum SCANNER_SYMBOLS { S_LBRACK = (1UL<< 4)+0, S_LBRACE = (1UL<< 4)+1, S_BLBRACK = (1UL<< 4)+2, - S_BLBRACE = (1UL<< 4)+3, S_RBRACK = (1UL<< 5)+0, S_RBRACE = (1UL<< 5)+1, S_DOT = (1UL<< 6)+0, diff --git a/tst/testinstall/list.tst b/tst/testinstall/list.tst index b79c5e81b0..799a1407c3 100644 --- a/tst/testinstall/list.tst +++ b/tst/testinstall/list.tst @@ -38,26 +38,10 @@ gap> a := [ [ [1, 2], [3, 4] ], [ [5, 6], [7, 8] ] ]; [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] gap> a{[1]}; [ [ [ 1, 2 ], [ 3, 4 ] ] ] -gap> a!{[1]}; -[ [ [ 1, 2 ], [ 3, 4 ] ] ] gap> a{[1]}{[1]}; [ [ [ 1, 2 ] ] ] -gap> a!{[1]}{[1]}; -[ [ [ 1, 2 ] ] ] -gap> a!{[1]}[1][1]; -[ 1 ] -gap> a!{[1]}[1][2]; -[ 2 ] -gap> a!{[1]}[1]{[1]}; -[ [ 1 ] ] -gap> a!{[1]}[1]{[2]}; -[ [ 2 ] ] -gap> a{[1]}!{[1]}; -Error, sorry: {}!{} not yet implemented gap> a{[1]}{[1]}[1]; [ [ 1 ] ] -gap> a{[1]}{[1]}![1]; -Error, sorry: {}![] not yet implemented # gap> a{[1,,2]}:=1; @@ -70,8 +54,6 @@ gap> a{[1]}{[1]}[1] := 42; Error, List Assignment: must be a dense list gap> a{[1]}{[1]}[1] := [ 42 ]; Error, List Assignment: must be a dense list -gap> a{[1]}{[1]}![1] := [ [ 42 ] ]; -Error, sorry: {}![] not yet implemented gap> a{[1]}{[1]}[1] := [ [ 42 ] ]; [ [ 42 ] ] gap> a; @@ -90,10 +72,6 @@ gap> a{[1]}{[1,,3]} := [ [ [ 18, 19 ] ] ]; Error, List Assignment: must be a dense list of positive integers gap> a{[1]}{[1]} := [ [ [ 18, 19 ] ] ]; [ [ [ 18, 19 ] ] ] -gap> a!{[1]}{[1]} := [ [ [ 18, 19 ] ] ]; -[ [ [ 18, 19 ] ] ] -gap> a{[1]}!{[1]} := [ [ [ 18, 19 ] ] ]; -Error, sorry: {}!{} not yet implemented gap> a; [ [ [ 18, 19 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ]