• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HCS_COMPILER_AST_H
10 #define HCS_COMPILER_AST_H
11 
12 #include "hcs_parser.h"
13 
14 typedef int32_t (*AstWalkCallBack)(ParserObject *current, int32_t walkDepth);
15 
16 ParserObject *HcsGetParserRoot(void);
17 
18 void HcsSetParserRoot(ParserObject *newRoot);
19 
20 ParserObject *HcsNewConfigNode(const char *nodeName, uint32_t nodeType, const char *refName);
21 
22 ParserObject *HcsNewConfigTerm(const char *name, ParserObject *value);
23 
24 ParserObject *HcsNewParserObject(const char *name, uint32_t type, uint64_t value);
25 
26 ParserObject *HcsAstAddChild(ParserObject *parent, ParserObject *child);
27 
28 void HcsAstRemoveChildLink(ParserObjectBase *parent, ParserObjectBase *child);
29 
30 ParserObject *HcsAstAddPeer(ParserObject *forward, ParserObject *peer);
31 
32 int32_t HcsWalkAst(ParserObject *start, uint32_t walkDirection, AstWalkCallBack forwardCallback,
33     AstWalkCallBack backwardCallback);
34 
35 void HcsDumpAst(const char *label);
36 
37 ParserObject *HcsAstLookupObjectInPeers(const ParserObject *current, const char *name);
38 
39 ParserObject *HcsAstLookupObjectInChildren(const ParserObject *current, const char *name);
40 
41 int32_t HcsAstCopySubTree(ParserObject *src, ParserObject *dst, uint32_t overWriteFlag);
42 
43 int32_t HcsAstCopyArray(const ParserObject *src, ParserObject *dst);
44 
45 void HcsDeleteParserObjectTree(ParserObject *object);
46 
47 uint16_t HcsCountArraySize(const ParserObject *arrayObj);
48 
49 uint16_t HcsGetTermType(ParserObject *object);
50 
51 const char *HcsGetModuleName(void);
52 
53 #endif // HCS_COMPILER_AST_H
54