Commit cd2fa254 authored by Daniel Salzman's avatar Daniel Salzman

yparser: remove ypbody.h

parent 2e4dbafd
......@@ -107,7 +107,6 @@ nobase_libknot_int_la_HEADERS = \
libknot/internal/trie/murmurhash3.h \
libknot/internal/utils.h \
libknot/internal/yparser/yparser.h \
libknot/internal/yparser/ypbody.h \
libknot/internal/yparser/ypformat.h \
libknot/internal/yparser/ypscheme.h \
libknot/internal/yparser/yptrafo.h
......
......@@ -22,9 +22,11 @@
#include <unistd.h>
#include "libknot/internal/yparser/yparser.h"
#include "libknot/internal/yparser/ypbody.h"
#include "libknot/errcode.h"
extern int _yp_start_state;
extern int _yp_parse(yp_parser_t *parser);
void yp_init(
yp_parser_t *parser)
{
......@@ -34,7 +36,7 @@ void yp_init(
memset(parser, 0, sizeof(*parser));
parser->cs = _start_state();
parser->cs = _yp_start_state;
parser->file.descriptor = -1;
parser->line_count = 1;
}
......@@ -147,7 +149,7 @@ int yp_parse(
}
// Parse the next item.
ret = _parse(parser);
ret = _yp_parse(parser);
} while (ret == KNOT_EFEWDATA);
return ret;
......
......@@ -17,7 +17,7 @@
#include <string.h>
#include "libknot/internal/yparser/ypbody.h"
#include "libknot/internal/yparser/yparser.h"
#include "libknot/errcode.h"
......@@ -154,7 +154,11 @@ static const char _yparser_eof_actions[] = {
int _parse(
int _yp_start_state =
25
;
int _yp_parse(
yp_parser_t *parser)
{
// Parser input limits (Ragel internals).
......@@ -382,11 +386,3 @@ _again:
return KNOT_EFEWDATA;
}
}
int _start_state(
void)
{
return
25
;
}
/* Copyright (C) 2015 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*!
* \file
*
* Yparser core interface for Ragel source.
*
* \addtogroup yparser
*
* @{
*/
#pragma once
#include "libknot/internal/yparser/yparser.h"
/*!
* Gets the initial parser state.
*/
int _start_state(
void
);
/*!
* Executes the parser on the current input block.
*
* \param[in] parser Parser context.
*/
int _parse(
yp_parser_t *parser
);
/*! @} */
......@@ -16,7 +16,7 @@
#include <string.h>
#include "libknot/internal/yparser/ypbody.h"
#include "libknot/internal/yparser/yparser.h"
#include "libknot/errcode.h"
%%{
......@@ -132,7 +132,9 @@
// Include parser static data (Ragel internals).
%% write data;
int _parse(
int _yp_start_state = %%{ write start; }%%;
int _yp_parse(
yp_parser_t *parser)
{
// Parser input limits (Ragel internals).
......@@ -173,9 +175,3 @@ int _parse(
return KNOT_EFEWDATA;
}
}
int _start_state(
void)
{
return %%{ write start; }%%;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment