Skip to content

Commit e166632

Browse files
committed
operator: introduce _markplaceholder
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent a4f5984 commit e166632

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

main/lregex.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3788,6 +3788,27 @@ static EsObject *lrop_advanceto (OptVM *vm, EsObject *name)
37883788
return es_true;
37893789
}
37903790

3791+
static EsObject *lrop_markplaceholder (OptVM *vm, EsObject *name)
3792+
{
3793+
EsObject *tag = opt_vm_ostack_top (vm);
3794+
3795+
if (!es_integer_p (tag))
3796+
return OPT_ERR_TYPECHECK;
3797+
3798+
int n = es_integer_get (tag);
3799+
if (! (CORK_NIL < n && n < countEntryInCorkQueue()))
3800+
return OPT_ERR_RANGECHECK;
3801+
3802+
tagEntryInfo *e = getEntryInCorkQueue (n);
3803+
if (e == NULL)
3804+
return OPTSCRIPT_ERR_NOTAGENTRY;
3805+
3806+
markTagPlaceholder (e, true);
3807+
3808+
opt_vm_ostack_pop (vm);
3809+
return es_false;
3810+
}
3811+
37913812
static struct optscriptOperatorRegistration lropOperators [] = {
37923813
{
37933814
.name = "_matchstr",
@@ -3934,6 +3955,12 @@ static struct optscriptOperatorRegistration lropOperators [] = {
39343955
.arity = 0,
39353956
.help_str = "- _TRACED true|false",
39363957
},
3958+
{
3959+
.name = "_markplaceholder",
3960+
.fn = lrop_markplaceholder,
3961+
.arity = 1,
3962+
.help_str = "tag:int _MARKPLACEHOLDER -",
3963+
}
39373964
};
39383965

39393966
extern void initRegexOptscript (void)

0 commit comments

Comments
 (0)