Skip to content

Commit

Permalink
Add a whole new lexer token type for block-taking list operators; use…
Browse files Browse the repository at this point in the history
… that instead of the custom hackery
  • Loading branch information
leonerd committed Nov 26, 2024
1 parent 3e214b8 commit 55c4f67
Show file tree
Hide file tree
Showing 11 changed files with 1,549 additions and 1,560 deletions.
3 changes: 2 additions & 1 deletion embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -5897,7 +5897,8 @@ S |int |intuit_method |NN char *s \
|NULLOK NOCHECK CV *cv
S |int |intuit_more |NN char *s \
|NN char *e
S |I32 |lop |I32 f \
S |I32 |lop |enum yytokentype t \
|I32 f \
|U8 x \
|NN char *s
Sr |void |missingterm |NULLOK char *s \
Expand Down
2 changes: 1 addition & 1 deletion embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,7 @@
# define incline(a,b) S_incline(aTHX_ a,b)
# define intuit_method(a,b,c) S_intuit_method(aTHX_ a,b,c)
# define intuit_more(a,b) S_intuit_more(aTHX_ a,b)
# define lop(a,b,c) S_lop(aTHX_ a,b,c)
# define lop(a,b,c,d) S_lop(aTHX_ a,b,c,d)
# define missingterm(a,b) S_missingterm(aTHX_ a,b)
# define parse_ident(a,b,c,d,e,f) S_parse_ident(aTHX_ a,b,c,d,e,f)
# define pending_ident() S_pending_ident(aTHX)
Expand Down
18 changes: 0 additions & 18 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -13238,24 +13238,6 @@ Perl_ck_grep(pTHX_ OP *o)
Perl_croak(aTHX_ "panic: ck_grep, type=%u", (unsigned) kid->op_type);
kid = kUNOP->op_first;

switch(o->op_type) {
case OP_ANYSTART:
case OP_ALLSTART:
/* any { BLOCK } would create an OP_NULL[OP_SCOPE[...]] or
* OP_NULL[OP_LEAVE[...]] here. If we don't see this structure
* then it must have been any EXPR, ... which we forbid
* TODO: See if we can forbid this somehow in perly.y itself
*/
if(!OP_TYPE_IS(kid, OP_NULL) ||
!(OP_TYPE_IS(kUNOP->op_first, OP_SCOPE) || OP_TYPE_IS(kUNOP->op_first, OP_LEAVE))) {
/* diag_listed_as: any EXPR, LIST is not allowed */
/* diag_listed_as: all EXPR, LIST is not allowed */
croak("%s EXPR, LIST is not allowed",
o->op_type == OP_ANYSTART ? "any" : "all");
}
break;
}

gwop = alloc_LOGOP(type, o, LINKLIST(kid));
kid->op_next = (OP*)gwop;
o->op_private = gwop->op_private = 0;
Expand Down
Loading

0 comments on commit 55c4f67

Please sign in to comment.