coala-1.0.1_src/COPYING 000644 001750 001750 00000104374 11477164507 015243 0 ustar 00tovok7 tovok7 000000 000000
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
coala-1.0.1_src/bin/coala 000755 001750 001750 00000032153 11477164507 015760 0 ustar 00tovok7 tovok7 000000 000000 #!/usr/bin/python
#########################################################################
# Copyright 2010 Torsten Grote
#
# 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 .
##########################################################################
from __future__ import with_statement
import sys
import os
import re
import subprocess
import tempfile
from optparse import OptionParser, OptionGroup
if sys.version.rsplit()[0] < '2.5':
print 'You need at least python 2.5 to run coala'
sys.exit(1)
# defined that early to extract coala version from binary
def checkProgram(prog):
try:
(result, error) = subprocess.Popen([prog, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
except OSError, err:
print err
return False
if result != '':
return result.splitlines()[0]
else:
return False
version = checkProgram("coala.bin")
if not version:
print "There is a problem with the coala binary file. Is it in your $PATH, is it executable, is it compiled for your architecture?"
sys.exit(1)
# Parse Command Line Options
description = version+" Copyright (C) 2007-2010 Torsten Grote This program comes with ABSOLUTELY NO WARRANTY. It is free software, and you are welcome to redistribute it under certain conditions."
usage = "%prog [options] file [number]"
parser = OptionParser(usage=usage, description=description, add_help_option=False, version="%prog " + version, conflict_handler="resolve")
parser.add_option("-l", "--language", dest="language", choices=["c","b","al","m","c_taid"], help="the action language (c, c_taid, b, al or m) to be used as input (default: %default)",
action="store", metavar="LANG")
parser.add_option("-s", "--static-file", dest="static_files", help="file containing static information such as variable types.", action="append", metavar="FILE")
parser.add_option("-c", "--const", dest="const", help="replaces constant t with value v", metavar="t=v")
parser.add_option("-d", "--debug", dest="debug", help="show debugging output", action="store_true")
parser.add_option("", "--version", help="show program's version number and exit", action="version")
parser.add_option("-h", "--help", help="show this help message and exit", action="help")
encoding_group = OptionGroup(parser, "Encoding Options")
encoding_group.add_option("-i", "--incremental", dest="incremental", choices=["yes","no","backwards"], help="use incremental encoding. INC can be yes, no or backwards. Default: %default",
action="store", metavar="INC")
encoding_group.add_option("-e", "--meta-encoding", dest="meta_encoding", help="use meta-encoding", action="store_true")
encoding_group.add_option("-n", "--negation", dest="negation", help="simulate classical negation instead of using the built-in one", action="store_true")
parser.add_option_group(encoding_group)
solver_group = OptionGroup(parser, "Solver Options")
solver_group.add_option("", "--max-sol", dest="max_sol", help="Compute [number] solutions. Default: %default", type="int", action="store", metavar="NUM")
solver_group.add_option("", "--imax", dest="imax", help="Perform at most NUM incremental steps. Default: %default", type="int", action="store", metavar="NUM")
solver_group.add_option("-t", "--text", dest="text", help="show only coala output and don't look for solutions", action="store_true")
solver_group.add_option("-g", "--ground", dest="ground", help="show only grounded coala output and don't look for solutions", action="store_true")
parser.add_option_group(solver_group)
output_group = OptionGroup(parser, "Output Options")
output_group.add_option("-o", "--output", dest="output", help="change the way the solutions are presented, long, compact or raw. Default: %default",
action="store", choices=['long','compact', 'raw'], metavar="OUTPUT")
output_group.add_option("-f", "--show-fluents", dest="show_fluents", help="show not only actions, but also fluents in solution", action="store_true")
#output_group.add_option("", "--hide", dest="hide", help="Hide this action or fluent name from output", action="append", metavar="NAME")
parser.add_option_group(output_group)
parser.set_defaults(
language = "c",
incremental = "yes",
meta_encoding = False,
show_fluents = False,
negation = False,
output = "compact",
text = False,
ground = False,
max_sol = 1,
imax = 99,
debug = False
)
(opt, args) = parser.parse_args()
if opt.meta_encoding:
ACTION = re.compile("^occ\((.*?),?(\d+)\)$")
FLUENT = re.compile("^hol\((.*?),?(\d+)\)$")
elif opt.language == 'b':
ACTION = re.compile("^occ\((.*?),?(\d+)\)$")
FLUENT = re.compile("^holds\((.*?),?(\d+)\)$")
else:
ACTION = re.compile("^-?action_([a-zA-Z0-9_]*\(.*?),? *(\d+) *\)\.?$")
FLUENT = re.compile("^-?fluent_([a-zA-Z0-9_]*\(.*?),? *(\d+) *\)\.?$")
PARSER = [
re.compile("^Answer:\ (\d+)$"),
re.compile("^(-?[a-z_][a-zA-Z0-9_]*(\(.+\))?\ *)+$"),
re.compile("^SATISFIABLE$"),
re.compile("^UNSATISFIABLE$"),
re.compile("^Error: (?P.+)$"),
]
def main():
checkOptions()
lp = callCoala("coala.bin")
if opt.text:
print lp
else:
output = callClingo(lp)
if opt.ground or opt.output == 'raw':
print output
else:
answer_sets = getAnswerSets(output)
printAnswerSets(answer_sets)
return 0
def checkOptions():
# get last positional argument and check if its a number
try:
int(args[len(args)-1])
opt.max_sol = args.pop(len(args)-1)
except IndexError:
print "coala needs at least one file as argument. Run `coala --help` for more information."
print
parser.print_usage()
sys.exit(0)
except ValueError:
opt.max_sol = '1'
if(opt.language == "c_taid" and (opt.incremental == "yes" or opt.incremental == "backwards" or opt.meta_encoding)):
raise RuntimeError("Action Language c_taid does not support these options.")
if((opt.language == "b" or opt.language == "al") and opt.meta_encoding):
raise RuntimeWarning("Action Language "+opt.language+" does only support one encoding.")
if(opt.text and opt.ground):
raise RuntimeError("The options -g and -t can not be used together.")
def callCoala(coala_binary):
coala_options = getCoalaOptions()
if(opt.debug):
print "Calling Coala with:"
print " " + subprocess.list2cmdline([coala_binary] + coala_options)
(result, error) = subprocess.Popen([coala_binary] + coala_options, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if error != "":
print error
return result
def getCoalaOptions():
result = ['-l']
result.append(opt.language)
if(opt.meta_encoding):
result.append('-e')
elif(opt.incremental == "yes" or opt.incremental == "backward"):
result.append('-n')
if(opt.incremental == "yes"):
result.append('-i')
elif(opt.incremental == "backward"):
result.append('-ir')
elif(opt.negation):
result.append('-n')
opt.negation = True
if(opt.debug):
result.extend(['-d','99'])
elif(opt.show_fluents):
result.extend(['-d','1'])
for file in args:
if os.path.exists(file):
result.append(file)
else:
raise RuntimeError("Input file %s does not exist." % file)
return result
def callClingo(lp):
iclingo_options = ['--imax='+str(opt.imax), opt.max_sol]
iclingo = checkProgram("iclingo")
if(not iclingo and opt.incremental != "no"):
raise RuntimeError("Could not find iclingo binary which is needed to process the incremental encoding.")
elif(not iclingo):
iclingo = checkProgram("clingo")
if(not clingo):
raise RuntimeError("Could not find an iclingo or clingo binary. At least one of them is needed to compute solutions.")
else:
iclingo = "clingo"
else:
iclingo = "iclingo"
if(opt.incremental == "no"):
iclingo_options.append('--clingo')
if(opt.const):
iclingo_options.extend(['-c', opt.const])
if(opt.ground):
iclingo_options.append('-t')
if(opt.const):
iclingo_options.append('--ifixed=' + opt.const.rsplit('=',1)[1])
# create tmp file for input
tmp = tempfile.NamedTemporaryFile()
tmp.write(lp)
if opt.static_files:
for file in opt.static_files:
if(os.path.exists(file)):
if(opt.incremental != "no"):
tmp.write("#base.\n")
with open(file, 'r') as f:
for line in f:
tmp.write(line)
else:
raise RuntimeError("Static file '%s' could not be found." % file)
tmp.seek(0)
if opt.debug:
print "Calling iClingo with:"
print " " + subprocess.list2cmdline([iclingo] + iclingo_options)
iclingo_options.append('--istats')
(result, error) = subprocess.Popen([iclingo] + iclingo_options, stdin=tmp, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
if error != "":
print error
return result
def getAnswerSets(output):
answer_sets = []
for line in output.splitlines():
matched = False
for i in range(len(PARSER)):
match = PARSER[i].match(line)
if match != None:
matched = True
if i == 0 and opt.debug:
print "Found %s. Answer Set." % match.group(1)
elif i == 1:
answer_sets.append(line.split())
elif i == 2:
return answer_sets
elif i == 3:
raise RuntimeError("The problem doesn't have any solutions. Try to comment out some constraints or queries. " +
"In case of an LTL query, this message means that no counter examples have been found.")
elif i == 4:
raise RuntimeError(line)
if not matched:
if opt.debug:
print line
#raise SyntaxError("Unkown clasp output read: %s" % line)
return answer_sets
def printAnswerSets(answer_sets):
i = 1
for answer_set in answer_sets:
if opt.output == "long":
print "\nAnswer: %d" % i
print '-' * 78
else:
print "Answer: %d" % i
printAnswerSet(answer_set)
i += 1
if i-1 >= int(opt.max_sol) and opt.max_sol != '0':
print "There might be more solutions. Find out by adding the maximal [number] of"
print "solutions as a parameter. Use 0 for all."
def printAnswerSet(answer_set):
"""prints the answer set"""
times = []
actions = {}
fluents = {}
# stores all actions and fluents in two dictionaries
for predicate in answer_set:
for (parser, plan) in [(ACTION, actions), (FLUENT, fluents)]:
match = parser.match(predicate)
if match != None:
t = int(match.group(2))
if t in plan:
plan[t].append(predicate)
else:
plan[t] = [predicate]
if not t in times:
times.append(t)
times.sort()
if opt.output == "compact":
# append fluents to actions and sort both
for time in times:
if not time in actions:
actions[time] = []
else:
actions[time].sort()
if time in fluents:
fluents[time].sort()
actions[time].extend(fluents[time])
# prints predicates in rows
row_len = getPredicateLength(actions, fluents)
for time in actions:
printRow(actions, row_len, time)
else:
# append actions to fluents and sort both
for time in times:
if not time in fluents:
fluents[time] = []
else:
fluents[time].sort()
if time in actions:
actions[time].sort()
fluents[time].extend(actions[time])
# print one predicate per row
for predicate in fluents[time]:
printPredicate(time, predicate)
print '-' * 78
def getPredicateLength(actions, fluents):
row_len = {}
for plan in [actions, fluents]:
for time in plan:
plan[time].sort()
row = 0
for predicate in plan[time]:
predicate = formatPredicate(predicate)[0]
if row in row_len:
if len(predicate) > row_len[row]:
row_len[row] = len(predicate)
else:
row_len[row] = len(predicate)
row += 1
return row_len
def formatPredicate(predicate):
pred = ''
match = ACTION.match(predicate)
if match == None:
match = FLUENT.match(predicate)
if match == None:
pred = predicate
else:
pred = match.group(1)
pred_type = "fluent"
else:
pred = match.group(1)
pred_type = "action"
if not opt.language == 'b' and not opt.meta_encoding:
# remove opening bracket if time was only argument
new_pred = pred.rstrip('(')
# close bracket if needed
if new_pred == pred:
new_pred += ')'
pred = new_pred
if opt.output == "compact":
if pred_type == "action":
pred = "A " + pred
elif pred_type == "fluent":
pred = "F " + pred
elif opt.output == "long":
pred = pred.replace(',', ', ')
return (pred, pred_type)
def printRow(plan, row_len, time):
time_str = str(time).rjust(len(str(len(plan))))
print " %s. " % time_str,
row = 0
for predicate in plan[time]:
print formatPredicate(predicate)[0].ljust(row_len[row]+1),
row += 1
print ""
def printPredicate(time, predicate):
(pred, pred_type) = formatPredicate(predicate)
print str(time).rjust(3) + " ",
if pred_type == "action":
print "A",
elif pred_type == "fluent":
print "F",
else:
print " ",
print " " + pred
if __name__ == '__main__':
if opt.debug:
sys.exit(main())
else:
try:
sys.exit(main())
except Warning, warn:
sys.stderr.write('WARNING: %s\n' % str(warn))
except Exception, err:
sys.stderr.write('ERROR: %s\n' % str(err))
sys.exit(1)
coala-1.0.1_src/src/lib/options.h 000644 001750 001750 00000004060 11477164507 017400 0 ustar 00tovok7 tovok7 000000 000000 /****************************************************************************
* lib/options.h - This file is part of coala *
* *
* Copyright (C) 2009 Torsten Grote *
* *
* 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 *
****************************************************************************/
#ifndef OPTIONS_H
#define OPTIONS_H
#include
#include
using namespace std;
namespace Coala {
class CompilerOptions {
public:
CompilerOptions();
virtual ~CompilerOptions();
bool checkOptions();
void setLanguage(string);
string getLanguage();
void setInputStream(istream&);
istream* getInputStream();
void setOutputStream(ostream&);
ostream* getOutputStream();
void setFakeClassicalNegation(bool);
bool getFakeClassicalNegation();
void setDebug(int);
int getDebug();
void setDirectEncoding(bool);
bool getDirectEncoding();
void setIncremental(bool);
bool getIncremental();
void setReverseIncremental(bool);
bool getReverseIncremental();
void setWhereCheck(bool);
bool getWhereCheck();
private:
string language_;
istream* inputStream_;
ostream* outputStream_;
bool fakeClassicalNegation_;
int debug_;
bool directEncoding_;
bool incremental_;
bool reverseIncremental_;
bool whereCheck_;
};
};
#endif // OPTIONS_H
coala-1.0.1_src/src/lib/main.cpp 000644 001750 001750 00000006610 11477164507 017167 0 ustar 00tovok7 tovok7 000000 000000 /****************************************************************************
* lib/main.cpp - This file is part of coala *
* *
* Copyright (C) 2009 Torsten Grote *
* *
* 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 *
****************************************************************************/
#include "main.h"
#include "c/Compiler.h"
#include "b/Compiler.h"
#include "c_taid/compiler.h"
namespace Coala {
Compiler::Compiler() {
options_ = new CompilerOptions();
}
Compiler::~Compiler() {
delete options_;
//delete compiler_; // segfault with from options
}
int Compiler::compile() {
if(!options_->checkOptions()) {
throw std::runtime_error("Invalid combination of options set.");
}
if(options_->getLanguage() == "c" || options_->getLanguage() == "m") {
compiler_ = new C::Compiler(options_);
}
else if(options_->getLanguage() == "b") {
compiler_ = new B::Compiler(options_);
}
else if(options_->getLanguage() == "c_taid") {
compiler_ = new C_taid::Compiler(options_);
}
else {
throw std::runtime_error("Unknown input language to compile.");
}
if(options_->getDebug() > 99) {
cout << "% Options\n";
cout << "% \n";
cout << "% Language: " << options_->getLanguage() << "\n";
cout << "% Debug Level: " << options_->getDebug() << "\n";
cout << "% Simulated Classical Negation: " << (options_->getFakeClassicalNegation() ? "true" : "false") << "\n";
cout << "% Direct Encoding: " << (options_->getDirectEncoding() ? "true" : "false") << "\n";
cout << "% Incremental: " << (options_->getIncremental() ? "true" : "false") << "\n";
cout << "% Reverse Incremental: " << (options_->getReverseIncremental() ? "true" : "false") << "\n";
cout << "% Where Check: " << (options_->getWhereCheck() ? "true" : "false") << "\n";
}
return compiler_->compile();
}
void Compiler::setLanguage(string language) {
options_->setLanguage(language);
}
void Compiler::setInputStream(istream& inputStream) {
options_->setInputStream(inputStream);
}
void Compiler::setOutputStream(ostream& outputStream) {
options_->setOutputStream(outputStream);
}
void Compiler::setFakeClassicalNegation(bool fakeClassicalNegation) {
options_->setFakeClassicalNegation(fakeClassicalNegation);
}
void Compiler::setDebug(int debug) {
options_->setDebug(debug);
}
void Compiler::setDirectEncoding(bool directEncoding) {
options_->setDirectEncoding(directEncoding);
}
void Compiler::setIncremental(bool incremental) {
options_->setIncremental(incremental);
}
void Compiler::setReverseIncremental(bool reverseIncremental) {
options_->setReverseIncremental(reverseIncremental);
}
void Compiler::setWhereCheck(bool whereCheck) {
options_->setWhereCheck(whereCheck);
}
};
coala-1.0.1_src/src/lib/c_taid/scanner.cpp 000644 001750 001750 00000142533 11477164507 021124 0 ustar 00tovok7 tovok7 000000 000000 #line 2 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.cpp"
#line 4 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.cpp"
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
* following macro. This is required in order to pass the c++-multiple-scanners
* test in the regression suite. We get reports that it breaks inheritance.
* We will address this in a future release of flex, or omit the C++ scanner
* altogether.
*/
#define yyFlexLexer ctaidFlexLexer
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
/* end standard C headers. */
/* flex integer type definitions */
#ifndef FLEXINT_H
#define FLEXINT_H
/* C99 systems have . Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
#endif
#include
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX (4294967295U)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
/* begin standard C++ headers. */
#include
#include
#include
#include
#include
/* end standard C++ headers. */
#ifdef __cplusplus
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
#define YY_USE_CONST
#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
/* Promotes a possibly negative, possibly signed char to an unsigned
* integer for use as an array index. If the signed char is negative,
* we want to instead treat it as an 8-bit unsigned char, hence the
* double cast.
*/
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
#define BEGIN (yy_start) = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START (((yy_start) - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
*/
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
extern int yyleng;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break
* existing scanners that call yyless() from OUTSIDE yylex.
* One obvious solution it to make yy_act a global. I tried that, and saw
* a 5% performance hit in a non-yylineno scanner, because yy_act is
* normally declared as a register variable-- so it is not worth it.
*/
#define YY_LESS_LINENO(n) \
do { \
int yyl;\
for ( yyl = n; yyl < yyleng; ++yyl )\
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
*yy_cp = (yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
#define unput(c) yyunput( c, (yytext_ptr) )
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
std::istream* yy_input_file;
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
yy_size_t yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
* delete it.
*/
int yy_is_our_buffer;
/* Whether this is an "interactive" input source; if so, and
* if we're using stdio for input, then we want to use getc()
* instead of fread(), to make sure we stop fetching input after
* each newline.
*/
int yy_is_interactive;
/* Whether we're considered to be at the beginning of a line.
* If so, '^' rules will be active on the next match, otherwise
* not.
*/
int yy_at_bol;
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
* shouldn't try reading from the input source any more. We might
* still have a bunch of tokens to match, though, because of
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
* (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
};
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
*
* Returns the top of the stack, or NULL.
*/
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
void *ctaidalloc (yy_size_t );
void *ctaidrealloc (void *,yy_size_t );
void ctaidfree (void * );
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
#define YY_SKIP_YYWRAP
typedef unsigned char YY_CHAR;
#define yytext_ptr yytext
#define YY_INTERACTIVE
#include
int yyFlexLexer::yywrap() { return 1; }
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
(yytext_ptr) = yy_bp; \
yyleng = (size_t) (yy_cp - yy_bp); \
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 23
#define YY_END_OF_BUFFER 24
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
{
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static yyconst flex_int16_t yy_accept[122] =
{ 0,
0, 0, 24, 22, 1, 1, 22, 19, 22, 20,
18, 22, 16, 1, 0, 21, 17, 18, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 16, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 11, 0, 0, 0, 0,
6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 8, 5, 0, 0, 3, 0, 0,
0, 0, 0, 4, 13, 0, 0, 0, 15, 0,
9, 0, 0, 7, 0, 12, 0, 0, 0, 10,
0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 1, 1, 4, 1, 1, 1,
1, 1, 1, 5, 6, 7, 1, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 1, 1, 9,
1, 10, 1, 1, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
1, 1, 1, 1, 12, 1, 13, 14, 15, 16,
17, 18, 19, 20, 21, 11, 11, 22, 11, 23,
24, 25, 11, 26, 27, 28, 29, 11, 30, 31,
32, 11, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1
} ;
static yyconst flex_int32_t yy_meta[33] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2
} ;
static yyconst flex_int16_t yy_base[126] =
{ 0,
0, 12, 140, 141, 23, 25, 136, 141, 0, 141,
130, 16, 0, 33, 134, 141, 0, 128, 23, 122,
117, 102, 110, 24, 107, 115, 24, 103, 0, 100,
105, 116, 96, 106, 98, 93, 111, 100, 104, 103,
104, 99, 94, 93, 89, 141, 85, 98, 88, 92,
141, 87, 83, 77, 82, 88, 84, 78, 71, 83,
70, 85, 74, 82, 72, 68, 83, 71, 72, 67,
62, 61, 65, 65, 57, 63, 68, 55, 141, 66,
63, 69, 68, 67, 48, 52, 64, 45, 43, 59,
42, 43, 141, 141, 141, 58, 57, 141, 39, 39,
51, 53, 35, 141, 141, 51, 34, 31, 141, 48,
141, 40, 46, 141, 26, 141, 33, 11, 20, 141,
141, 51, 53, 21, 9
} ;
static yyconst flex_int16_t yy_def[126] =
{ 0,
122, 122, 121, 121, 121, 121, 123, 121, 124, 121,
121, 121, 125, 121, 123, 121, 124, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 125, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
0, 121, 121, 121, 121
} ;
static yyconst flex_int16_t yy_nxt[174] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
29, 4, 4, 5, 6, 7, 8, 9, 10, 11,
12, 4, 17, 4, 14, 14, 14, 14, 19, 120,
20, 21, 22, 23, 14, 14, 24, 30, 25, 26,
27, 37, 119, 28, 31, 41, 38, 118, 117, 42,
32, 13, 13, 15, 15, 116, 115, 114, 113, 112,
111, 110, 109, 108, 107, 106, 105, 104, 103, 102,
101, 100, 99, 98, 97, 96, 95, 94, 93, 92,
91, 90, 89, 88, 87, 86, 85, 84, 83, 82,
81, 80, 79, 78, 77, 76, 75, 74, 73, 72,
71, 70, 69, 68, 67, 66, 65, 64, 63, 62,
61, 60, 59, 58, 57, 56, 55, 54, 53, 52,
51, 50, 49, 48, 47, 46, 45, 44, 43, 40,
39, 36, 35, 34, 33, 18, 16, 18, 16, 121,
3, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121
} ;
static yyconst flex_int16_t yy_chk[174] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
125, 1, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 124, 2, 5, 5, 6, 6, 12, 119,
12, 12, 12, 12, 14, 14, 12, 19, 12, 12,
12, 24, 118, 12, 19, 27, 24, 117, 115, 27,
19, 122, 122, 123, 123, 113, 112, 110, 108, 107,
106, 103, 102, 101, 100, 99, 97, 96, 92, 91,
90, 89, 88, 87, 86, 85, 84, 83, 82, 81,
80, 78, 77, 76, 75, 74, 73, 72, 71, 70,
69, 68, 67, 66, 65, 64, 63, 62, 61, 60,
59, 58, 57, 56, 55, 54, 53, 52, 50, 49,
48, 47, 45, 44, 43, 42, 41, 40, 39, 38,
37, 36, 35, 34, 33, 32, 31, 30, 28, 26,
25, 23, 22, 21, 20, 18, 15, 11, 7, 3,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121, 121, 121, 121, 121, 121, 121, 121,
121, 121, 121
} ;
/* Table of booleans, true if rule could match eol. */
static yyconst flex_int32_t yy_rule_can_match_eol[24] =
{ 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
#line 1 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
/****************************************************************************
* lib/c_taid/scanner.l - This file is part of coala *
* *
* Copyright (C) 2009 Torsten Grote *
* *
* 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 *
****************************************************************************/
#line 21 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
#include "parser.h"
#include
bool second_part = false;
bool asked_query = false;
void printPartError(const string, const int);
void printQueryError(const string, const int);
#line 542 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.cpp"
#define INITIAL 0
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first.
* The user has a chance to override it with an option.
*/
#include
#endif
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * );
#endif
#ifndef YY_NO_INPUT
#endif
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
#define ECHO LexerOutput( yytext, yyleng )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
\
if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
* we don't want an extra ';' after the "return" because that will cause
* some compilers to complain about unreachable statements.
*/
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif
/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif
/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) LexerError( msg )
#endif
/* end tables serialization structures and prototypes */
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
#define YY_DECL int yyFlexLexer::yylex()
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
*/
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif
#define YY_RULE_SETUP \
YY_USER_ACTION
/** The main scanner function which does all the work.
*/
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
#line 53 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
#line 649 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.cpp"
if ( !(yy_init) )
{
(yy_init) = 1;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
if ( ! (yy_start) )
(yy_start) = 1; /* first start state */
if ( ! yyin )
yyin = & std::cin;
if ( ! yyout )
yyout = & std::cout;
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_load_buffer_state( );
}
while ( 1 ) /* loops until end-of-file is reached */
{
yy_cp = (yy_c_buf_p);
/* Support of yytext. */
*yy_cp = (yy_hold_char);
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
yy_current_state = (yy_start);
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 141 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
{
int yyl;
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
yylineno++;
;
}
do_action: /* This label is used only to access EOF actions. */
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = (yy_hold_char);
yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state);
goto yy_find_action;
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
#line 54 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
// ignore white space.
YY_BREAK
case 2:
YY_RULE_SETUP
#line 55 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(second_part) printPartError(yytext, lineno()); else return CtaidParser::ACT; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 56 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::FLU; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 57 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::DEF; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 58 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::CAUS; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 59 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::IF; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 60 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(second_part) printPartError(yytext, lineno()); else return CtaidParser::TRIG; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 61 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(second_part) printPartError(yytext, lineno()); else return CtaidParser::ALLOW; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 62 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::INHIB; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 63 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::NCONC; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 64 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::AT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 65 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ second_part = true; return CtaidParser::OC_AT; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 66 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(asked_query) printQueryError(yytext, lineno());
else {
asked_query = true;
return CtaidParser::EXP;
}
}
YY_BREAK
case 14:
YY_RULE_SETUP
#line 72 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(asked_query) printQueryError(yytext, lineno());
else {
asked_query = true;
return CtaidParser::PLAN;
}
}
YY_BREAK
case 15:
YY_RULE_SETUP
#line 78 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ if(asked_query) printQueryError(yytext, lineno());
else {
asked_query = true;
return CtaidParser::PRED;
}
}
YY_BREAK
case 16:
YY_RULE_SETUP
#line 84 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::IDENTIFIER; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 85 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::NEG_IDENTI; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 86 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::NUMBER; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 87 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::COMMA; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 88 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ return CtaidParser::DOT; }
YY_BREAK
case 21:
/* rule 21 can match eol */
YY_RULE_SETUP
#line 89 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ /* comment */ }
YY_BREAK
case YY_STATE_EOF(INITIAL):
#line 90 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ yyterminate(); }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 91 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
{ cerr << "\n\nError: Unknown keyword '"+string(yytext)+"' found at line "<yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
* consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
* of the first EOB in the buffer, since yy_c_buf_p will
* already have been incremented past the NUL character
* (since all states make transitions on EOB to the
* end-of-buffer state). Contrast this with the test
* in input().
*/
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
* yy_get_previous_state() go ahead and do it
* for us because it doesn't know how to deal
* with the possibility of jamming (and we don't
* want to build jamming into it because then it
* will run more slowly).
*/
yy_next_state = yy_try_NUL_trans( yy_current_state );
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
yy_cp = ++(yy_c_buf_p);
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
yy_cp = (yy_c_buf_p);
goto yy_find_action;
}
}
else switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_END_OF_FILE:
{
(yy_did_buffer_switch_on_eof) = 0;
if ( yywrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
* yytext, we can now set up
* yy_c_buf_p so that if some total
* hoser (like flex itself) wants to
* call the scanner after we return the
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
}
else
{
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) =
(yytext_ptr) + yy_amount_of_matched_text;
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
(yy_c_buf_p) =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
yy_current_state = yy_get_previous_state( );
yy_cp = (yy_c_buf_p);
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
}
break;
}
default:
YY_FATAL_ERROR(
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
} /* end of yylex */
/* The contents of this function are C++ specific, so the () macro is not used.
*/
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
{
yyin = arg_yyin;
yyout = arg_yyout;
yy_c_buf_p = 0;
yy_init = 0;
yy_start = 0;
yy_flex_debug = 0;
yylineno = 1; // this will only get updated if %option yylineno
yy_did_buffer_switch_on_eof = 0;
yy_looking_for_trail_begin = 0;
yy_more_flag = 0;
yy_more_len = 0;
yy_more_offset = yy_prev_more_offset = 0;
yy_start_stack_ptr = yy_start_stack_depth = 0;
yy_start_stack = NULL;
yy_buffer_stack = 0;
yy_buffer_stack_top = 0;
yy_buffer_stack_max = 0;
yy_state_buf = 0;
}
/* The contents of this function are C++ specific, so the () macro is not used.
*/
yyFlexLexer::~yyFlexLexer()
{
delete [] yy_state_buf;
ctaidfree(yy_start_stack );
yy_delete_buffer( YY_CURRENT_BUFFER );
ctaidfree(yy_buffer_stack );
}
/* The contents of this function are C++ specific, so the () macro is not used.
*/
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
{
if ( new_in )
{
yy_delete_buffer( YY_CURRENT_BUFFER );
yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
}
if ( new_out )
yyout = new_out;
}
#ifdef YY_INTERACTIVE
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
#else
int yyFlexLexer::LexerInput( char* buf, int max_size )
#endif
{
if ( yyin->eof() || yyin->fail() )
return 0;
#ifdef YY_INTERACTIVE
yyin->get( buf[0] );
if ( yyin->eof() )
return 0;
if ( yyin->bad() )
return -1;
return 1;
#else
(void) yyin->read( buf, max_size );
if ( yyin->bad() )
return -1;
else
return yyin->gcount();
#endif
}
void yyFlexLexer::LexerOutput( const char* buf, int size )
{
(void) yyout->write( buf, size );
}
/* yy_get_next_buffer - try to read in a new buffer
*
* Returns a code representing an action:
* EOB_ACT_LAST_MATCH -
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
int yyFlexLexer::yy_get_next_buffer()
{
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = (yytext_ptr);
register int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
}
else
{
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
}
}
/* Try to read more data. */
/* First move last chars to start of buffer. */
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
else
{
int num_to_read =
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
(int) ((yy_c_buf_p) - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
else
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
ctaidrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
number_to_move - 1;
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
(yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
if ( (yy_n_chars) == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
else
ret_val = EOB_ACT_CONTINUE_SCAN;
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ctaidrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
}
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
return ret_val;
}
/* yy_get_previous_state - get the state just before the EOB char was reached */
yy_state_type yyFlexLexer::yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
}
return yy_current_state;
}
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
{
register int yy_is_jam;
register char *yy_cp = (yy_c_buf_p);
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
(yy_last_accepting_cpos) = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 122 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 121);
return yy_is_jam ? 0 : yy_current_state;
}
void yyFlexLexer::yyunput( int c, register char* yy_bp)
{
register char *yy_cp;
yy_cp = (yy_c_buf_p);
/* undo effects of setting up yytext */
*yy_cp = (yy_hold_char);
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = (yy_n_chars) + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
if ( c == '\n' ){
--yylineno;
}
(yytext_ptr) = yy_bp;
(yy_hold_char) = *yy_cp;
(yy_c_buf_p) = yy_cp;
}
int yyFlexLexer::yyinput()
{
int c;
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
/* This was really a NUL. */
*(yy_c_buf_p) = '\0';
else
{ /* need more input */
int offset = (yy_c_buf_p) - (yytext_ptr);
++(yy_c_buf_p);
switch ( yy_get_next_buffer( ) )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
* sees that we've accumulated a
* token and flags that we need to
* try matching the token before
* proceeding. But for input(),
* there's no matching to consider.
* So convert the EOB_ACT_LAST_MATCH
* to EOB_ACT_END_OF_FILE.
*/
/* Reset buffer status. */
yyrestart( yyin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
return EOF;
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
#else
return input();
#endif
}
case EOB_ACT_CONTINUE_SCAN:
(yy_c_buf_p) = (yytext_ptr) + offset;
break;
}
}
}
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
*(yy_c_buf_p) = '\0'; /* preserve yytext */
(yy_hold_char) = *++(yy_c_buf_p);
if ( c == '\n' )
yylineno++;
;
return c;
}
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
*
* @note This function does not reset the start condition to @c INITIAL .
*/
void yyFlexLexer::yyrestart( std::istream* input_file )
{
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
yy_load_buffer_state( );
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
*
*/
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
{
/* TODO. We should be able to replace this entire function body
* with
* yypop_buffer_state();
* yypush_buffer_state(new_buffer);
*/
yyensure_buffer_stack ();
if ( YY_CURRENT_BUFFER == new_buffer )
return;
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
(yy_did_buffer_switch_on_eof) = 1;
}
void yyFlexLexer::yy_load_buffer_state()
{
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
(yy_hold_char) = *(yy_c_buf_p);
}
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
*
* @return the allocated buffer state.
*/
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) ctaidalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) ctaidalloc(b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer( b, file );
return b;
}
/** Destroy the buffer.
* @param b a buffer created with yy_create_buffer()
*
*/
void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
{
if ( ! b )
return;
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
ctaidfree((void *) b->yy_ch_buf );
ctaidfree((void *) b );
}
extern "C" int isatty (int );
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
* such as during a yyrestart() or at EOF.
*/
void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
{
int oerrno = errno;
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
/* If b is the current buffer, then yy_init_buffer was _probably_
* called from yyrestart() or through yy_get_next_buffer.
* In that case, we don't want to reset the lineno or column.
*/
if (b != YY_CURRENT_BUFFER){
b->yy_bs_lineno = 1;
b->yy_bs_column = 0;
}
b->yy_is_interactive = 0;
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
*
*/
void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
{
if ( ! b )
return;
b->yy_n_chars = 0;
/* We always need two end-of-buffer characters. The first causes
* a transition to the end-of-buffer state. The second causes
* a jam in that state.
*/
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
b->yy_buf_pos = &b->yy_ch_buf[0];
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( );
}
/** Pushes the new state onto the stack. The new state becomes
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
*
*/
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
{
if (new_buffer == NULL)
return;
yyensure_buffer_stack();
/* This block is copied from yy_switch_to_buffer. */
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
*(yy_c_buf_p) = (yy_hold_char);
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
/* Only push if top exists. Otherwise, replace top. */
if (YY_CURRENT_BUFFER)
(yy_buffer_stack_top)++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
*
*/
void yyFlexLexer::yypop_buffer_state (void)
{
if (!YY_CURRENT_BUFFER)
return;
yy_delete_buffer(YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
if ((yy_buffer_stack_top) > 0)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
void yyFlexLexer::yyensure_buffer_stack(void)
{
int num_to_alloc;
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
num_to_alloc = 1;
(yy_buffer_stack) = (struct yy_buffer_state**)ctaidalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
}
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = (yy_buffer_stack_max) + grow_size;
(yy_buffer_stack) = (struct yy_buffer_state**)ctaidrealloc
((yy_buffer_stack),
num_to_alloc * sizeof(struct yy_buffer_state*)
);
if ( ! (yy_buffer_stack) )
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
}
}
void yyFlexLexer::yy_push_state( int new_state )
{
if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
{
yy_size_t new_size;
(yy_start_stack_depth) += YY_START_STACK_INCR;
new_size = (yy_start_stack_depth) * sizeof( int );
if ( ! (yy_start_stack) )
(yy_start_stack) = (int *) ctaidalloc(new_size );
else
(yy_start_stack) = (int *) ctaidrealloc((void *) (yy_start_stack),new_size );
if ( ! (yy_start_stack) )
YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
}
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
BEGIN(new_state);
}
void yyFlexLexer::yy_pop_state()
{
if ( --(yy_start_stack_ptr) < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
}
int yyFlexLexer::yy_top_state()
{
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
}
#ifndef YY_EXIT_FAILURE
#define YY_EXIT_FAILURE 2
#endif
void yyFlexLexer::LexerError( yyconst char msg[] )
{
std::cerr << msg << std::endl;
exit( YY_EXIT_FAILURE );
}
/* Redefine yyless() so it works in section 3 code. */
#undef yyless
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
int yyless_macro_arg = (n); \
YY_LESS_LINENO(yyless_macro_arg);\
yytext[yyleng] = (yy_hold_char); \
(yy_c_buf_p) = yytext + yyless_macro_arg; \
(yy_hold_char) = *(yy_c_buf_p); \
*(yy_c_buf_p) = '\0'; \
yyleng = yyless_macro_arg; \
} \
while ( 0 )
/* Accessor methods (get/set functions) to struct members. */
/*
* Internal utility routines.
*/
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
}
#endif
void *ctaidalloc (yy_size_t size )
{
return (void *) malloc( size );
}
void *ctaidrealloc (void * ptr, yy_size_t size )
{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
* because both ANSI C and C++ allow castless assignment from
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
}
void ctaidfree (void * ptr )
{
free( (char *) ptr ); /* see ctaidrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
#line 94 "/home/tovok7/svn/potassco/coala/src/lib/c_taid/scanner.l"
void printPartError(const string etext, const int line) {
cerr << "\n\nError: Keyword '"+etext+"' may only appear in description part, but found at line "<