/* 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 TMPL_LEXER_H #define TMPL_LEXER_H #include "etl_stream.h" #include "parser.h" /* A lexer for the ETL language. */ typedef struct etl_template_lexer_t etl_template_lexer_t; #define ETL_TMPL_TOK_EOI 47 /* sufficiently big... */ /* A token within an ETL file. */ typedef struct { int type; /* The actual type of token this is. */ char *data; /* The underlying data associated with this token. */ int line; /* The line this token originated from. */ } etl_token_t; /* Return a lexer that will scan the contents of BB, allocated in POOL. */ etl_template_lexer_t * etl_template_lexer_create(etl_stream_t *stream); void etl_template_lexer_destroy(etl_template_lexer_t *l); /* Scan forward to find the next token in LEXER, returning it in *TOK */ etl_error_t * etl_template_lexer_scan(etl_token_t **tok, etl_template_lexer_t *lexer); void etl_template_token_destroy(etl_token_t *tok); #endif /* TMPL_LEXER_H */