aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/ast/yql_ast_annotation.h
blob: c909ce9df4d2e97a0610817a1d819e61cb99cdb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include "yql_ast.h"
#include <util/generic/hash.h>

namespace NYql {

TAstNode* PositionAsNode(TPosition position, TMemoryPool& pool);

TAstNode* AnnotatePositions(TAstNode& root, TMemoryPool& pool);
// returns nullptr in case of error
TAstNode* RemoveAnnotations(TAstNode& root, TMemoryPool& pool);
// returns nullptr in case of error
TAstNode* ApplyPositionAnnotations(TAstNode& root, ui32 annotationIndex, TMemoryPool& pool);
// returns false in case of error
bool ApplyPositionAnnotationsInplace(TAstNode& root, ui32 annotationIndex);

typedef THashMap<const TAstNode*, TVector<const TAstNode*>> TAnnotationNodeMap;

// returns nullptr in case of error
TAstNode* ExtractAnnotations(TAstNode& root, TAnnotationNodeMap& annotations, TMemoryPool& pool);

}