00001 # if ! defined(TS_CONFIG_TYPES_HEADER) 00002 # define TS_CONFIG_TYPES_HEADER 00003 00004 /** @file 00005 00006 Basic types for configuration parsing. 00007 00008 @section license License 00009 00010 Licensed to the Apache Software Foundation (ASF) under one 00011 or more contributor license agreements. See the NOTICE file 00012 distributed with this work for additional information 00013 regarding copyright ownership. The ASF licenses this file 00014 to you under the Apache License, Version 2.0 (the 00015 "License"); you may not use this file except in compliance 00016 with the License. You may obtain a copy of the License at 00017 00018 http://www.apache.org/licenses/LICENSE-2.0 00019 00020 Unless required by applicable law or agreed to in writing, software 00021 distributed under the License is distributed on an "AS IS" BASIS, 00022 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00023 See the License for the specific language governing permissions and 00024 limitations under the License. 00025 */ 00026 00027 # if defined(_MSC_VER) 00028 # include <stddef.h> 00029 # else 00030 # include <unistd.h> 00031 # endif 00032 00033 # if defined(__cplusplus) 00034 namespace ts { namespace config { 00035 # endif 00036 00037 /** A location in the source stream. 00038 @internal At some point we may need to add stream information, 00039 e.g. file name, once includes are supported. Or should that 00040 be the caller's responsibility? 00041 */ 00042 struct Location { 00043 int _col; ///< Column. 00044 int _line; ///< Line. 00045 }; 00046 00047 /** A token from the source stream. 00048 @internal We should use ts::Buffer here, but because this 00049 has to work in C as well, it's less painful to do it by hand. 00050 */ 00051 struct Token { 00052 char* _s; ///< Text of token. 00053 size_t _n; ///< Text length. 00054 int _type; ///< Type of token. 00055 struct Location _loc; ///< Location of token. 00056 }; 00057 00058 # if defined(__cplusplus) 00059 }} // namespace ts::config 00060 # define YYSTYPE ts::config::Token 00061 # else 00062 # define YYSTYPE struct Token 00063 #endif 00064 00065 00066 # endif // TS_CONFIG_TYPES_HEADER