/* Copyright 2005 Garrett Rooney. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef LEXER_H #define LEXER_H #include #include #include "parser.h" /* A lexer for the ETL language. */ typedef struct etl_lexer_t etl_lexer_t; #define ETL_TOK_EOI 47 /* sufficiently big... */ typedef int etl_token_t; /* Return a lexer that will scan the contents of BB, allocated in POOL. */ etl_lexer_t *etl_lexer_create (apr_bucket_brigade *bb, apr_pool_t *pool); /* Scan forward to find the next token in LEXER, returning it in *TOK, using * POOL for temporary allocations. */ apr_status_t etl_lexer_scan (etl_token_t *tok, etl_lexer_t *lexer, apr_pool_t *pool); /* Get the text for the last token returned by LEXER, allocated in POOL. * * Note: This is really only meaningful if the last token was ETL_TOK_TEXT, * in all other situations it will return NULL. */ char * etl_lexer_text (etl_lexer_t *lexer, apr_pool_t *pool); #endif /* LEXER_H */