Skip to content

Commit 13201a7

Browse files
committed
Yaml: add ypathGetTypeStackDepth to the sub parser interface
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 2477827 commit 13201a7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

parsers/yaml.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,19 @@ static void ypathPopAllTypes (yamlSubparser *yaml, yaml_token_t *token)
395395
ypathPopType (yaml, token);
396396
}
397397

398+
extern size_t ypathGetTypeStackDepth (yamlSubparser *yaml)
399+
{
400+
size_t depth = 0;
401+
struct ypathTypeStack *s = yaml->ypathTypeStack;
402+
403+
while (s) {
404+
depth++;
405+
s = s->next;
406+
}
407+
408+
return depth;
409+
}
410+
398411
static void ypathFillKeywordOfTokenMaybe (yamlSubparser *yaml, yaml_token_t *token, langType lang)
399412
{
400413
if (!yaml->ypathTypeStack)

parsers/yaml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct sYamlSubparser {
4747
#define YAML(S) ((yamlSubparser *)S)
4848

4949
extern void attachYamlPosition (tagEntryInfo *tag, yaml_token_t *token, bool asEndPosition);
50+
extern size_t ypathGetTypeStackDepth (yamlSubparser *yaml);
5051

5152
/*
5253
* Experimental Ypath code

0 commit comments

Comments
 (0)