All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pathParser.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef SDF_PATH_PARSER_H
25 #define SDF_PATH_PARSER_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/usd/sdf/api.h"
29 #include "pxr/usd/sdf/path.h"
30 #include "pxr/base/tf/token.h"
31 #include <string>
32 #include <vector>
33 
34 // Opaque buffer type handle.
35 struct yy_buffer_state;
36 
37 // Lexical scanner type.
38 typedef void *yyscan_t;
39 
40 // Lexical scanner value type.
41 struct Sdf_PathLexerValue {
42  PXR_NS::TfToken token;
43  PXR_NS::SdfPath path;
44 };
45 #define YYSTYPE Sdf_PathLexerValue
46 
47 typedef std::vector< std::pair<PXR_NS::TfToken,
48  PXR_NS::TfToken> > Sdf_PathVariantSelections;
49 
50 // Lexical scanner context.
51 struct Sdf_PathParserContext {
52  PXR_NS::SdfPath path;
53  std::vector<Sdf_PathVariantSelections> variantSelectionStack;
54  std::string errStr;
55  yyscan_t scanner;
56 };
57 
58 // Generated bison symbols.
59 int pathYyparse(Sdf_PathParserContext *context);
60 int pathYylex_init(yyscan_t *yyscanner);
61 int pathYylex_destroy(yyscan_t yyscanner);
62 yy_buffer_state *pathYy_scan_string(const char* str, yyscan_t yyscanner);
63 yy_buffer_state *pathYy_scan_bytes(const char* str, size_t len,
64  yyscan_t yyscanner);
65 void pathYy_delete_buffer(yy_buffer_state *b, yyscan_t yyscanner);
66 
67 PXR_NAMESPACE_OPEN_SCOPE
68 
69 SDF_API
70 int SdfPathYyparse(Sdf_PathParserContext *context);
71 SDF_API
72 int SdfPathYylex_init(yyscan_t *yyscanner);
73 SDF_API
74 int SdfPathYylex_destroy(yyscan_t yyscanner);
75 SDF_API
76 yy_buffer_state *SdfPathYy_scan_string(const char* str, yyscan_t yyscanner);
77 
78 PXR_NAMESPACE_CLOSE_SCOPE
79 
80 #endif // SDF_PATH_PARSER_H