2 * Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 * This is a "Compiler" helper class, to store the parts of each entry
29 * before combining it to build the transducer being "compiled".
34 * Type of tokens, inner enum.
36 enum Type {paradigm, single_transduction, regexp};
44 * Name of the paradigm (if it is of 'paradigm' 'type')
49 * Left side of transduction (if 'single_transduction')
51 list<string> leftSide;
54 * Right side of transduction (if 'single_transduction')
56 list<string> rightSide;
59 * Regular expression (if 'regexp')
66 void copy(EntryToken const &e);
75 * Non-parametric constructor
87 EntryToken(EntryToken const &e);
92 EntryToken & operator = (EntryToken const &e);
95 * Sets the name of the paradigm.
96 * @param np the paradigm name
98 void setParadigm(string const &np);
101 * Set both parts of a single transduction.
102 * @param pi left part
103 * @param pd right part
105 void setSingleTransduction(list<string> const &pi, list<string> const &pd);
108 * Set regular expression.
109 * @param r the regular expression specification.
111 void setRegExp(string const &r);
114 * eTest EntryToken to detect if is a paradigm.
115 * @return true if it is a paradigm.
117 bool isParadigm() const;
120 * Test EntryToken to check if it is a single transduction.
121 * @return true if it is a single transduction.
123 bool isSingleTransduction() const;
126 * Test EntryToken to check if it is a single regular expression.
127 * @return true if it is a regular expression.
129 bool isRegExp() const;
132 * Retrieve the name of the paradigm.
133 * @return the name of the paradigm.
135 string const & paradigmName() const;
138 * Retrieve the left part of the paradigm.
139 * @return the left part of the paradigm.
141 list<string> const & left() const;
144 * Retrieve the right part of the paradigm.
145 * @return the right part of the paradigm.
147 list<string> const & right() const;
150 * Retrieve the regular expression specification.
151 * @return the regular expression specification.
153 string const & regExp() const;