Commit 6e138d08 authored by Sebastien Decugis's avatar Sebastien Decugis
Browse files

Initial draft version of dict_legacy_xml, parses XML file but no conversion to fD yet.

parent a4c2ca11
......@@ -23,13 +23,14 @@ Additionnaly, these ones may be useful:
In order to build app_acct extension, you will also need the package libpq-dev.
In order to build app_sip or app_diameap extension, you will also need the package libmysqlclient-dev.
In order to build dict_legacy_xml extension, you will need libxml2-dev.
If your debhelper environment is recent (> 7.3.9 to provide cmake support),
the following commands should generate the freeDiameter packages for you:
# Install the dependencies for building the source:
sudo apt-get -y install mercurial cmake make gcc bison flex libsctp-dev libgnutls-dev libgcrypt-dev libpq-dev libmysqlclient-dev ssl-cert debhelper fakeroot
sudo apt-get -y install mercurial cmake make gcc bison flex libsctp-dev libgnutls-dev libgcrypt-dev libpq-dev libmysqlclient-dev libxml2-dev ssl-cert debhelper fakeroot
# Retrieve the latest version of the source package
cd
......
# - Try to find the LibXml2 xml processing library
# Once done this will define
#
# LIBXML2_FOUND - System has LibXml2
# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PC_LIBXML libxml-2.0 QUIET)
SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
HINTS
${PC_LIBXML_INCLUDEDIR}
${PC_LIBXML_INCLUDE_DIRS}
PATH_SUFFIXES libxml2
)
FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
HINTS
${PC_LIBXML_LIBDIR}
${PC_LIBXML_LIBRARY_DIRS}
)
FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
# for backwards compat. with KDE 4.0.x:
SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
......@@ -48,3 +48,5 @@ to top-level README file.
tests run on freeDiameter. The results are published at the following URL:
http://www.freediameter.net/CDash/index.php?project=freeDiameter
- dict_legacy: XML and DTD files for the dict_legacy_xml.fdx extension.
The dictionary.dtd file originates from draft-frascone-xml-dictionary-00.
A few modifications may have been performed (see file history in Mercurial)
XML dictionary files:
mobile-ipv4.xml : from the Circum project (circum.sf.net)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dictionary SYSTEM "dictionary.dtd">
<dictionary>
<application id="2" name="Mobile IPv4" uri="ftp://ftp.ietf.org/internet-drafts/draft-ietf-aaa-diameter-mobileip-14.txt">
<command name="AA-Mobile-Node" code="260">
<requestrules>
<fixed>
<avprule name="Session-Id" maximum="1" minimum="1" />
</fixed>
<required>
<avprule name="Auth-Application-Id" maximum="1" minimum="1" />
<avprule name="User-Name" maximum="1" minimum="1" />
<avprule name="Destination-Realm" maximum="1" minimum="1" />
<avprule name="Origin-Host" maximum="1" minimum="1" />
<avprule name="Origin-Realm" maximum="1" minimum="1" />
<avprule name="MIP-Reg-Request" maximum="1" minimum="1" />
<avprule name="MIP-MN-AAA-Auth" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="Acct-Multi-Session-Id" maximum="1" />
<avprule name="Destination-Host" maximum="1" />
<avprule name="Origin-State-Id" maximum="1" />
<avprule name="MIP-Mobile-Node-Address" maximum="1" />
<avprule name="MIP-Home-Agent-Address" maximum="1" />
<avprule name="MIP-Feature-Vector" maximum="1" />
<avprule name="MIP-Originating-Foreign-AAA" maximum="1" />
<avprule name="Authorization-Lifetime" maximum="1" />
<avprule name="Auth-Session-State" maximum="1" />
<avprule name="MIP-FA-Challenge" maximum="1" />
<avprule name="MIP-Candidate-Home-Agent-Host" maximum="1" />
<avprule name="MIP-Home-Agent-Host" maximum="1" />
<avprule name="Proxy-Info" />
<avprule name="Route-Record" />
<avprule name="AVP" />
</optional>
</requestrules>
<answerrules>
<fixed>
<avprule name="Session-Id" maximum="1" minimum="1" />
</fixed>
<required>
<avprule name="Auth-Application-Id" maximum="1" minimum="1" />
<avprule name="Result-Code" maximum="1" minimum="1" />
<avprule name="Origin-Host" maximum="1" minimum="1" />
<avprule name="Origin-Realm" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="Acct-Multi-Session-Id" maximum="1" />
<avprule name="User-Name" maximum="1" />
<avprule name="Authorization-Lifetime" maximum="1" />
<avprule name="Auth-Session-State" maximum="1" />
<avprule name="Error-Message" maximum="1" />
<avprule name="Error-Reporting-Host" maximum="1" />
<avprule name="Re-Auth-Request-Type" maximum="1" />
<avprule name="MIP-Feature-Vector" maximum="1" />
<avprule name="MIP-Reg-Reply" maximum="1" />
<avprule name="MIP-MN-to-FA-Key" maximum="1" />
<avprule name="MIP-MN-to-HA-Key" maximum="1" />
<avprule name="MIP-FA-to-MN-Key" maximum="1" />
<avprule name="MIP-FA-to-HA-Key" maximum="1" />
<avprule name="MIP-HA-to-MN-Key" maximum="1" />
<avprule name="MIP-HA-to-FA-Key" maximum="1" />
<avprule name="MIP-Key-Lifetime" maximum="1" />
<avprule name="MIP-Home-Agent-Address" maximum="1" />
<avprule name="MIP-Mobile-Node-Address" maximum="1" />
<!--avprule name="MIP-Filter-Rule"/-->
<avprule name="Origin-State-Id" maximum="1" />
<avprule name="Proxy-Info" />
<avprule name="AVP" />
</optional>
</answerrules>
</command>
<command name="Home-Agent-MIP" code="262">
<requestrules>
<fixed>
<avprule name="Session-Id" maximum="1" minimum="1" />
</fixed>
<required>
<avprule name="Auth-Application-Id" maximum="1" minimum="1" />
<avprule name="Authorization-Lifetime" maximum="1" minimum="1" />
<avprule name="Auth-Session-State" maximum="1" minimum="1" />
<avprule name="MIP-Reg-Request" maximum="1" minimum="1" />
<avprule name="Origin-Host" maximum="1" minimum="1" />
<avprule name="Origin-Realm" maximum="1" minimum="1" />
<avprule name="User-Name" maximum="1" minimum="1" />
<avprule name="Destination-Realm" maximum="1" minimum="1" />
<avprule name="MIP-Feature-Vector" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="Destination-Host" maximum="1" />
<avprule name="MIP-MN-to-HA-Key" maximum="1" />
<avprule name="MIP-MN-to-FA-Key" maximum="1" />
<avprule name="MIP-HA-to-MN-Key" maximum="1" />
<avprule name="MIP-HA-to-FA-Key" maximum="1" />
<avprule name="MIP-Key-Lifetime" maximum="1" />
<avprule name="MIP-Originating-Foreign-AAA" maximum="1" />
<avprule name="MIP-Mobile-Node-Address" maximum="1" />
<avprule name="MIP-Home-Agent-Address" maximum="1" />
<!--avprule name="MIP-Filter-Rule"/-->
<avprule name="Origin-State-Id" maximum="1" />
<avprule name="Proxy-Info" />
<avprule name="Route-Record" />
<avprule name="AVP" />
</optional>
</requestrules>
<answerrules>
<fixed>
<avprule name="Session-Id" maximum="1" minimum="1" />
</fixed>
<required>
<avprule name="Auth-Application-Id" maximum="1" minimum="1" />
<avprule name="Result-Code" maximum="1" minimum="1" />
<avprule name="Origin-Host" maximum="1" minimum="1" />
<avprule name="Origin-Realm" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="Acct-Multi-Session-Id" maximum="1" />
<avprule name="User-Name" maximum="1" />
<avprule name="Error-Reporting-Host" maximum="1" />
<avprule name="Error-Message" maximum="1" />
<avprule name="MIP-Reg-Reply" maximum="1" />
<avprule name="MIP-Home-Agent-Address" maximum="1" />
<avprule name="MIP-Mobile-Node-Address" maximum="1" />
<avprule name="MIP-FA-to-HA-SPI" maximum="1" />
<avprule name="MIP-FA-to-MN-SPI" maximum="1" />
<avprule name="Origin-State-Id" maximum="1" />
<avprule name="Proxy-Info" />
<avprule name="AVP" />
</optional>
</answerrules>
</command>
<avp name="MIP-Auth-Input-Data-Length" code="338" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Authenticator-Length" code="339" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Authenticator-Offset" code="340" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Candidate-Home-Agent-Host" code="336" mandatory="must">
<type type-name="DiameterIdentity" />
</avp>
<avp name="MIP-Home-Agent-Host" code="348" mandatory="must">
<type type-name="DiameterIdentity" />
</avp>
<avp name="MIP-FA-Challenge" code="344" mandatory="must">
<type type-name="OctetString" />
</avp>
<avp name="MIP-Feature-Vector" code="337" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Home-Agent-Address" code="334" mandatory="must">
<type type-name="Address" />
</avp>
<avp name="MIP-MN-AAA-SPI" code="341" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Mobile-Node-Address" code="333" mandatory="must">
<type type-name="Address" />
</avp>
<avp name="MIP-Reg-Request" code="320" mandatory="must">
<type type-name="OctetString" />
</avp>
<avp name="MIP-Reg-Reply" code="321" mandatory="must">
<type type-name="OctetString" />
</avp>
<avp name="MIP-MN-AAA-Auth" code="322" mandatory="must">
<grouped>
<required>
<avprule name="MIP-MN-AAA-SPI" maximum="1" minimum="1" />
<avprule name="MIP-Auth-Input-Data-Length" maximum="1" minimum="1" />
<avprule name="MIP-Authenticator-Offset" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-Originating-Foreign-AAA" code="347" mandatory="must">
<grouped>
<required>
<avprule name="Origin-Realm" maximum="1" minimum="1" />
<avprule name="Origin-Host" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-Algorithm-Type" code="345" mandatory="must">
<type type-name="Enumerated" />
</avp>
<avp name="MIP-FA-to-HA-SPI" code="318" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-FA-to-MN-SPI" code="319" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Replay-Mode" code="346" mandatory="must">
<type type-name="Enumerated" />
</avp>
<avp name="MIP-Session-Key" code="343" mandatory="must">
<type type-name="OctetString" />
</avp>
<avp name="MIP-FA-to-MN-Key" code="326" mandatory="must">
<grouped>
<required>
<avprule name="MIP-FA-to-MN-SPI" maximum="1" minimum="1" />
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Session-Key" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-FA-to-HA-Key" code="328" mandatory="must">
<grouped>
<required>
<avprule name="MIP-FA-to-HA-SPI" maximum="1" minimum="1" />
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Session-Key" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-HA-to-FA-Key" code="329" mandatory="must">
<grouped>
<required>
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Session-Key" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-HA-to-MN-Key" code="332" mandatory="must">
<grouped>
<required>
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Replay-Mode" maximum="1" minimum="1" />
<avprule name="MIP-Session-Key" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-Key-Lifetime" code="367" mandatory="must">
<type type-name="Unsigned32" />
</avp>
<avp name="MIP-Key-Material" code="335" mandatory="must">
<type type-name="OctetString" />
</avp>
<avp name="MIP-MN-to-FA-Key" code="325" mandatory="must">
<grouped>
<required>
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Key-Material" maximum="1" minimum="1" />
<avprule name="MIP-MN-AAA-SPI" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
<avp name="MIP-MN-to-HA-Key" code="331" mandatory="must">
<grouped>
<required>
<avprule name="MIP-Algorithm-Type" maximum="1" minimum="1" />
<avprule name="MIP-Replay-Mode" maximum="1" minimum="1" />
<avprule name="MIP-Key-Material" maximum="1" minimum="1" />
<avprule name="MIP-MN-AAA-SPI" maximum="1" minimum="1" />
</required>
<optional>
<avprule name="AVP" />
</optional>
</grouped>
</avp>
</application>
</dictionary>
# This file documents the configuration format for the dict_legacy_xml.fdx freeDiameter extension.
# In order to load this extension, please refer to main freeDiameter.conf manual.
# This extension allows the use of Diameter dictionary files in XML format,
# as roughly specified in draft-frascone-xml-dictionary-00.
# (the actual format is the one from OpenDiameter latest version)
# Note that this format, although more widely used, is less efficient than the
# internal freeDiameter format. It is recommended when possible to use the later.
# This file simply consists in a list of XML dictionary files that must be parsed.
# Example:
# "/etc/freeDiameter/dictionary.xml";
......@@ -53,6 +53,8 @@ FD_EXTENSION_SUBDIR(dict_mip6i "Diameter Mobile IPv6 IKE Dictionary definiti
FD_EXTENSION_SUBDIR(dict_nas_mipv6 "Diameter NAS-to-HAAA Interaction Dictionary definitions" ON)
FD_EXTENSION_SUBDIR(dict_rfc5777 "Classification and QoS (RFC 5777) Dictionary definitions" ON)
FD_EXTENSION_SUBDIR(dict_legacy_xml "Load Diameter dictionary definitions from XML files." OFF)
####
# Diameter applications
......
# The dict_legacy_xml extension
PROJECT("Legacy XML dictionary files support" C)
# Parser files
BISON_FILE(dict_lxml.y)
FLEX_FILE(dict_lxml.l)
SET_SOURCE_FILES_PROPERTIES(lex.dict_lxml.c dict_lxml.tab.c PROPERTIES COMPILE_FLAGS "-I ${CMAKE_CURRENT_SOURCE_DIR}")
# We use LibXml2 (from GNOME) to parse XML files
FIND_PACKAGE(LibXml2 REQUIRED)
# List of source files
SET( DICT_LXML_SRC
dict_lxml.c
dict_lxml_xml.c
dict_lxml.h
lex.dict_lxml.c
dict_lxml.tab.c
dict_lxml.tab.h
)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
# Compile these files as a freeDiameter extension
FD_ADD_EXTENSION(dict_legacy_xml ${DICT_LXML_SRC})
TARGET_LINK_LIBRARIES(dict_legacy_xml ${LIBXML2_LIBRARIES} )
####
## INSTALL section ##
# We install with the daemon component because it is a base feature.
INSTALL(TARGETS dict_legacy_xml
LIBRARY DESTINATION ${INSTALL_EXTENSIONS_SUFFIX}
COMPONENT freeDiameter-daemon)
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@nict.go.jp> *
* *
* Copyright (c) 2010, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/*
* Legacy XML dictionary files support for freeDiameter.
*/
#include "dict_lxml.h"
/* entry point */
static int dict_lxml_entry(char * conffile)
{
TRACE_ENTRY("%p", conffile);
/* Parse the configuration file -- everything happens there */
CHECK_FCT( dict_lxml_handle(conffile) );
/* We're done */
return 0;
}
EXTENSION_ENTRY("dict_legacy_xml", dict_lxml_entry);
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@nict.go.jp> *
* *
* Copyright (c) 2010, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Header file for the dict_legacy_xml extension.
*
* See the dict_legacy_xml.conf.sample file for the format of the configuration file.
*/
/* FreeDiameter's common include file */
#include <freeDiameter/extension.h>
/* Parse the configuration file */
int dict_lxml_handle(char * conffile);
/* Parse an XML file and return the number of dictionary objects or -1 on error */
int dict_lxml_parse(char * xmlfilename);
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@nict.go.jp> *
* *
* Copyright (c) 2010, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Tokenizer
*
*/
%{
#include "dict_lxml.h"
/* Include yacc tokens definitions */
#include "dict_lxml.tab.h"
/* Update the column information */
#define YY_USER_ACTION { \
yylloc->first_column = yylloc->last_column + 1; \
yylloc->last_column = yylloc->first_column + yyleng - 1; \
}
/* Avoid warning with newer flex */
#define YY_NO_INPUT
%}
qstring \"[^\"\n]*\"
%option bison-bridge bison-locations
%option noyywrap
%option nounput
%%
/* Update the line count */
\n {
yylloc->first_line++;
yylloc->last_line++;
yylloc->last_column=0;
}
/* Eat all spaces but not new lines */
([[:space:]]{-}[\n])+ ;