C AMQP Protocol Engine API  0.5
proton/scanner.h
Go to the documentation of this file.
00001 #ifndef PROTON_SCANNER_H
00002 #define PROTON_SCANNER_H 1
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include <proton/import_export.h>
00026 #include <sys/types.h>
00027 #include <stdarg.h>
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 typedef enum {
00034   PN_TOK_LBRACE,
00035   PN_TOK_RBRACE,
00036   PN_TOK_LBRACKET,
00037   PN_TOK_RBRACKET,
00038   PN_TOK_EQUAL,
00039   PN_TOK_COMMA,
00040   PN_TOK_POS,
00041   PN_TOK_NEG,
00042   PN_TOK_DOT,
00043   PN_TOK_AT,
00044   PN_TOK_DOLLAR,
00045   PN_TOK_BINARY,
00046   PN_TOK_STRING,
00047   PN_TOK_SYMBOL,
00048   PN_TOK_ID,
00049   PN_TOK_FLOAT,
00050   PN_TOK_INT,
00051   PN_TOK_TRUE,
00052   PN_TOK_FALSE,
00053   PN_TOK_NULL,
00054   PN_TOK_EOS,
00055   PN_TOK_ERR
00056 } pn_token_type_t;
00057 
00058 typedef struct pn_scanner_t pn_scanner_t;
00059 
00060 typedef struct {
00061   pn_token_type_t type;
00062   const char *start;
00063   size_t size;
00064 } pn_token_t;
00065 
00066 PN_EXTERN pn_scanner_t *pn_scanner();
00067 PN_EXTERN void pn_scanner_free(pn_scanner_t *scanner);
00068 PN_EXTERN pn_token_t pn_scanner_token(pn_scanner_t *scanner);
00069 PN_EXTERN int pn_scanner_err(pn_scanner_t *scanner, int code, const char *fmt, ...);
00070 PN_EXTERN int pn_scanner_verr(pn_scanner_t *scanner, int code, const char *fmt, va_list ap);
00071 PN_EXTERN void pn_scanner_line_info(pn_scanner_t *scanner, int *line, int *col);
00072 PN_EXTERN int pn_scanner_errno(pn_scanner_t *scanner);
00073 PN_EXTERN const char *pn_scanner_error(pn_scanner_t *scanner);
00074 PN_EXTERN int pn_scanner_start(pn_scanner_t *scanner, const char *input);
00075 PN_EXTERN int pn_scanner_scan(pn_scanner_t *scanner);
00076 PN_EXTERN int pn_scanner_shift(pn_scanner_t *scanner);
00077 
00078 #ifdef __cplusplus
00079 }
00080 #endif
00081 
00082 #endif /* scanner.h */