blob: 9b7d82d7d30b4b21a5f7debc179d9bf08fa94e88 [file] [log] [blame]
Gavin McDonald0b75e1a2010-10-28 02:12:01 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef T_MAIN_H
21#define T_MAIN_H
22
23#include <string>
24#include "parse/t_const.h"
25#include "parse/t_field.h"
26
27/**
28 * Defined in the flex library
29 */
30
31int yylex(void);
32
33int yyparse(void);
34
35/**
36 * Expected to be defined by Flex/Bison
37 */
38void yyerror(const char* fmt, ...);
39
40/**
41 * Parse debugging output, used to print helpful info
42 */
43void pdebug(const char* fmt, ...);
44
45/**
46 * Parser warning
47 */
48void pwarning(int level, const char* fmt, ...);
49
50/**
51 * Failure!
52 */
53void failure(const char* fmt, ...);
54
55/**
56 * Check constant types
57 */
58void validate_const_type(t_const* c);
59
60/**
61 * Check constant types
62 */
63void validate_field_value(t_field* field, t_const_value* cv);
64
65/**
66 * Check members of a throws block
67 */
68bool validate_throws(t_struct* throws);
69
70/**
71 * Converts a string filename into a thrift program name
72 */
73std::string program_name(std::string filename);
74
75/**
76 * Gets the directory path of a filename
77 */
78std::string directory_name(std::string filename);
79
80/**
81 * Get the absolute path for an include file
82 */
83std::string include_file(std::string filename);
84
85/**
86 * Clears any previously stored doctext string.
87 */
88void clear_doctext();
89
90/**
91 * Cleans up text commonly found in doxygen-like comments
92 */
93char* clean_up_doctext(char* doctext);
94
95/**
96 * Flex utilities
97 */
98
99extern int yylineno;
100extern char yytext[];
101extern FILE* yyin;
102
103#endif