Skip to content

Commit

Permalink
operator: introduce _markplaceholder
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed May 15, 2021
1 parent a4f5984 commit e166632
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions main/lregex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3788,6 +3788,27 @@ static EsObject *lrop_advanceto (OptVM *vm, EsObject *name)
return es_true;
}

static EsObject *lrop_markplaceholder (OptVM *vm, EsObject *name)
{
EsObject *tag = opt_vm_ostack_top (vm);

if (!es_integer_p (tag))
return OPT_ERR_TYPECHECK;

int n = es_integer_get (tag);
if (! (CORK_NIL < n && n < countEntryInCorkQueue()))
return OPT_ERR_RANGECHECK;

tagEntryInfo *e = getEntryInCorkQueue (n);
if (e == NULL)
return OPTSCRIPT_ERR_NOTAGENTRY;

markTagPlaceholder (e, true);

opt_vm_ostack_pop (vm);
return es_false;
}

static struct optscriptOperatorRegistration lropOperators [] = {
{
.name = "_matchstr",
Expand Down Expand Up @@ -3934,6 +3955,12 @@ static struct optscriptOperatorRegistration lropOperators [] = {
.arity = 0,
.help_str = "- _TRACED true|false",
},
{
.name = "_markplaceholder",
.fn = lrop_markplaceholder,
.arity = 1,
.help_str = "tag:int _MARKPLACEHOLDER -",
}
};

extern void initRegexOptscript (void)
Expand Down

0 comments on commit e166632

Please sign in to comment.