ruby-sfst 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f0861baeb501296752510558d89a491003e8fb0
4
- data.tar.gz: 7d0d0278ddd0ac50fba358ac405b9ccd23c9dbe3
3
+ metadata.gz: 3d07559c217ab514585c2967d72c676918d0067c
4
+ data.tar.gz: e23aa54bcbee984adb644782a87c46575b1f4196
5
5
  SHA512:
6
- metadata.gz: f62a4b10d40515d841781593fd05e990c681bf21c1364fbff232bc3c9a3746044fcd96c04b308717c441e720a7bce9a0d885522c17d3be128702ff30db9c2911
7
- data.tar.gz: ce9a9c9aec563f0568328a746d220033479ac6b0b15ab9bbd766ca6893db4a314a0bd4145266833994cec06d40d77ca30f0a95123f86f8c5da6e1b803ef8df77
6
+ metadata.gz: b96113e75d1b472cdabcb72c92c5e6ef9554d4ada202a22260fd3c2ffc3377920b3f37057394fc5f437eb18976c72851039d2ec2dd19ca9a667e65de2fbf97fd
7
+ data.tar.gz: f350f868b2078ff9d4715da6396934e5f3aedd004a2a4f780dad72034f751d65b82a4c221cf21f5b144eec0d5f0c1117d9b3d642da6c97dabe6c4d573dbd20b2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Changelog
2
2
 
3
+ * Dropped support for compiling FSTs from Ruby; use fst-compiler-utf8 instead
4
+
3
5
  ## 0.4.1
4
6
 
5
7
  * Fixes for tricky hash_map includes
data/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  # ruby-sfst
2
2
 
3
- A wrapper for the Stuttgart Finite State Transducer Tools (SFST).
3
+ `ruby-sfst` is a wrapper for the Stuttgart Finite State Transducer Tools
4
+ (SFST).
4
5
 
5
6
  The wrapper is based on SFST 1.3. See
6
- http://www.cis.uni-muenchen.de/~schmid/tools/SFST/ for
7
- details on how to obtain SFST and how to write SFST transducers.
7
+ http://www.cis.uni-muenchen.de/~schmid/tools/SFST/ for details on how to obtain
8
+ SFST and how to write SFST transducers.
8
9
 
9
10
  ## Installation
10
11
 
11
- gem install ruby-sfst
12
+ ```sh
13
+ gem install ruby-sfst
14
+ ```
12
15
 
13
16
  ## Usage
14
17
 
@@ -21,30 +24,29 @@ If you have the following compiled as `test.a`
21
24
  it can be used like this:
22
25
 
23
26
  ```ruby
24
- fst = SFST::RegularTransducer.new("test.a")
25
- fst.analyse('foo')
26
- # => ['bar', 'baz']
27
- fst.accepted_analysis?('foo')
28
- # => true
29
- fst.generate('bar')
30
- # => ['foo']
31
- fst.accepted_generating?('bar')
32
- # => true
33
- fst.generate_language { |f| p f }
34
- # [["b", "f"], ["a", "o"], ["z", "o"]]
35
- # [["b", "f"], ["a", "o"], ["r", "o"]]
27
+ fst = SFST::RegularTransducer.new("test.a")
28
+ fst.analyse('foo')
29
+ # => ['bar', 'baz']
30
+ fst.accepted_analysis?('foo')
31
+ # => true
32
+ fst.generate('bar')
33
+ # => ['foo']
34
+ fst.accepted_generating?('bar')
35
+ # => true
36
+ fst.generate_language { |f| p f }
37
+ # [["b", "f"], ["a", "o"], ["z", "o"]]
38
+ # [["b", "f"], ["a", "o"], ["r", "o"]]
36
39
  ```
37
40
 
38
- You can also compile an SFST file. This requires the SFST tools to be
39
- installed and available on the current search path.
41
+ You can also compile an SFST file. This requires the SFST tools to be installed
42
+ and available on the current search path.
40
43
 
41
44
  ```ruby
42
- SFST::compile("test.fst", "test.a", :compact => true)
45
+ SFST::compile("test.fst", "test.a", :compact => true)
43
46
  ```
44
47
 
45
- Currently, `ruby-sfst` only supports simple compilation, analysis
46
- and generation using regular and compact transducers. It also only
47
- supports UTF-8.
48
+ Currently, `ruby-sfst` only supports simple compilation, analysis and
49
+ generation using regular and compact transducers. It also only supports UTF-8.
48
50
 
49
51
  ## Development
50
52
 
@@ -52,5 +54,5 @@ The project is hosted on github on http://github.com/mlj/ruby-sfst.
52
54
 
53
55
  ## License
54
56
 
55
- As it includes the SFST code directly, the wrapper inherits the GPL2
56
- license of the SFST project.
57
+ As `ruby-sfst` includes parts of the SFST code, the wrapper inherits the GPL2
58
+ license of the SFST project.
@@ -1,4 +1,5 @@
1
1
  require 'mkmf'
2
2
  CONFIG['CC'] = 'g++'
3
+ CONFIG['CXX'] = 'g++'
3
4
  $CPPFLAGS='-Wall -O3 -Wall -Wcast-qual -Wconversion -DSGI__gnu_cxx -DREADLINE'
4
5
  create_makefile "sfst_machine"
@@ -10,65 +10,10 @@
10
10
  #define RSTRING_PTR(ptr) RSTRING(ptr)->ptr
11
11
  #endif
12
12
 
13
- extern Transducer *Result;
14
- extern FILE *yyin;
15
- int yyparse(void);
16
-
17
13
  VALUE mSFST = Qnil;
18
14
  VALUE mCompactTransducer = Qnil;
19
15
  VALUE mRegularTransducer = Qnil;
20
16
 
21
- static VALUE compile(char *from_filename, char *to_filename, bool compact) // :nodoc:
22
- {
23
- FILE *in_file, *out_file;
24
-
25
- in_file = fopen(from_filename, "rb");
26
-
27
- if (!in_file) {
28
- rb_raise(rb_eRuntimeError, "Unable to open grammar file %s", from_filename);
29
- }
30
-
31
- FileName = from_filename;
32
- Result = NULL;
33
- TheAlphabet.utf8 = UTF8;
34
- yyin = in_file;
35
-
36
- try {
37
- yyparse();
38
- Result->alphabet.utf8 = UTF8;
39
-
40
- fclose(in_file);
41
-
42
- if (!(out_file = fopen(to_filename, "wb"))) {
43
- rb_raise(rb_eRuntimeError, "Unable to open output file %s", to_filename);
44
- }
45
-
46
- if (compact) {
47
- MakeCompactTransducer ca(*Result);
48
- delete Result;
49
- ca.store(out_file);
50
- } else
51
- Result->store(out_file);
52
-
53
- fclose(out_file);
54
- }
55
- catch(const char* p) {
56
- rb_raise(rb_eRuntimeError, "%s", p);
57
- }
58
-
59
- return Qnil;
60
- }
61
-
62
- static VALUE compile_regular(VALUE obj, VALUE from_filename, VALUE to_filename)
63
- {
64
- return compile(RSTRING_PTR(from_filename), RSTRING_PTR(to_filename), false);
65
- }
66
-
67
- static VALUE compile_compact(VALUE obj, VALUE from_filename, VALUE to_filename)
68
- {
69
- return compile(RSTRING_PTR(from_filename), RSTRING_PTR(to_filename), true);
70
- }
71
-
72
17
  static void compact_transducer_free(CompactTransducer *t)
73
18
  {
74
19
  if (t)
@@ -398,8 +343,6 @@ extern "C"
398
343
  void Init_sfst_machine(void)
399
344
  {
400
345
  mSFST = rb_define_module("SFST");
401
- rb_define_module_function(mSFST, "_compile_regular", (VALUE (*)(...))compile_regular, 2);
402
- rb_define_module_function(mSFST, "_compile_compact", (VALUE (*)(...))compile_compact, 2);
403
346
 
404
347
  mCompactTransducer = rb_define_class_under(mSFST, "CompactTransducerMachine", rb_cObject);
405
348
  rb_define_alloc_func(mCompactTransducer, compact_transducer_alloc);
data/lib/sfst/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SFST
2
- VERSION = "0.4.1" unless defined?(SFST::VERSION)
2
+ VERSION = "0.4.2" unless defined?(SFST::VERSION)
3
3
  end
data/test/test_sfst.rb CHANGED
@@ -2,27 +2,10 @@ require 'sfst'
2
2
  require 'test/unit'
3
3
 
4
4
  TEST_DIRECTORY = File.expand_path(File.dirname(__FILE__))
5
- TEST_SCRIPT_FILE = File.join(TEST_DIRECTORY, 'test_sfst.fst')
6
- TEST_COMPILED_FILE = File.join(TEST_DIRECTORY, 'test_sfst.a')
7
5
  TEST_COMPILED_COMPACT_FILE = File.join(TEST_DIRECTORY, 'test_sfst_compact.a')
8
6
  TEST_COMPILED_REGULAR_FILE = File.join(TEST_DIRECTORY, 'test_sfst_regular.a')
9
7
 
10
- class SFSTTestCase < Test::Unit::TestCase
11
- def test_sfst_compile_regular
12
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_FILE)
13
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_FILE, :compact => false)
14
- end
15
-
16
- def test_sfst_compile_compact
17
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_FILE, :compact => true)
18
- end
19
- end
20
-
21
8
  class RegularTransducerTestCase < Test::Unit::TestCase
22
- def setup
23
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_REGULAR_FILE, :compact => false)
24
- end
25
-
26
9
  def test_analyze_acceptance
27
10
  fst = SFST::RegularTransducer.new(TEST_COMPILED_REGULAR_FILE)
28
11
  assert_equal true, fst.accepted_analysis?('foo')
@@ -101,10 +84,6 @@ class RegularTransducerTestCase < Test::Unit::TestCase
101
84
  end
102
85
 
103
86
  class CompactTransducerTestCase < Test::Unit::TestCase
104
- def setup
105
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_COMPACT_FILE, :compact => true)
106
- end
107
-
108
87
  def test_analyze_acceptance
109
88
  fst = SFST::CompactTransducer.new(TEST_COMPILED_COMPACT_FILE)
110
89
  assert_equal true, fst.accepted_analysis?('foo')
@@ -119,11 +98,6 @@ class CompactTransducerTestCase < Test::Unit::TestCase
119
98
  end
120
99
 
121
100
  class StressTestCase < Test::Unit::TestCase
122
- def setup
123
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_REGULAR_FILE, :compact => false)
124
- SFST::compile(TEST_SCRIPT_FILE, TEST_COMPILED_COMPACT_FILE, :compact => true)
125
- end
126
-
127
101
  def test_repeated_analyses_regular
128
102
  fst = SFST::RegularTransducer.new(TEST_COMPILED_REGULAR_FILE)
129
103
  65536.times do
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-sfst
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marius L. Jøhndal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  description: A wrapper for the Stuttgart Finite State Transducer Tools (SFST).
@@ -35,32 +35,29 @@ files:
35
35
  - CHANGELOG.md
36
36
  - README.md
37
37
  - Rakefile
38
- - ruby-sfst.gemspec
39
- - ext/sfst_machine/compact.C
40
- - ext/sfst_machine/fst.C
41
- - ext/sfst_machine/interface.C
42
- - ext/sfst_machine/make-compact.C
43
- - ext/sfst_machine/determinise.C
44
- - ext/sfst_machine/fst-compiler.C
45
- - ext/sfst_machine/utf8.C
46
- - ext/sfst_machine/utf8-scanner.C
47
38
  - ext/sfst_machine/alphabet.C
39
+ - ext/sfst_machine/alphabet.h
48
40
  - ext/sfst_machine/basic.C
49
- - ext/sfst_machine/operators.C
50
- - ext/sfst_machine/fst.h
51
- - ext/sfst_machine/fst-compiler.h
52
- - ext/sfst_machine/mem.h
53
41
  - ext/sfst_machine/basic.h
54
- - ext/sfst_machine/alphabet.h
42
+ - ext/sfst_machine/compact.C
43
+ - ext/sfst_machine/compact.h
44
+ - ext/sfst_machine/determinise.C
45
+ - ext/sfst_machine/extconf.rb
46
+ - ext/sfst_machine/fst.C
47
+ - ext/sfst_machine/fst.h
48
+ - ext/sfst_machine/interface.C
55
49
  - ext/sfst_machine/interface.h
50
+ - ext/sfst_machine/make-compact.C
56
51
  - ext/sfst_machine/make-compact.h
57
- - ext/sfst_machine/compact.h
52
+ - ext/sfst_machine/mem.h
53
+ - ext/sfst_machine/operators.C
54
+ - ext/sfst_machine/sfst_machine.cc
58
55
  - ext/sfst_machine/sgi.h
56
+ - ext/sfst_machine/utf8.C
59
57
  - ext/sfst_machine/utf8.h
60
- - ext/sfst_machine/extconf.rb
61
- - ext/sfst_machine/sfst_machine.cc
62
58
  - lib/sfst.rb
63
59
  - lib/sfst/version.rb
60
+ - ruby-sfst.gemspec
64
61
  - test/test_sfst.fst
65
62
  - test/test_sfst.rb
66
63
  homepage: http://github.com/mlj/ruby-sfst
@@ -73,17 +70,17 @@ require_paths:
73
70
  - lib
74
71
  required_ruby_version: !ruby/object:Gem::Requirement
75
72
  requirements:
76
- - - '>='
73
+ - - ">="
77
74
  - !ruby/object:Gem::Version
78
75
  version: '0'
79
76
  required_rubygems_version: !ruby/object:Gem::Requirement
80
77
  requirements:
81
- - - '>='
78
+ - - ">="
82
79
  - !ruby/object:Gem::Version
83
80
  version: 1.3.5
84
81
  requirements: []
85
82
  rubyforge_project:
86
- rubygems_version: 2.0.3
83
+ rubygems_version: 2.2.2
87
84
  signing_key:
88
85
  specification_version: 4
89
86
  summary: Stuttgart Finite State Transducer Tools interface
@@ -1,2498 +0,0 @@
1
- /* A Bison parser, made by GNU Bison 2.3. */
2
-
3
- /* Skeleton implementation for Bison's Yacc-like parsers in C
4
-
5
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6
- Free Software Foundation, Inc.
7
-
8
- This program is free software; you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation; either version 2, or (at your option)
11
- any later version.
12
-
13
- This program is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with this program; if not, write to the Free Software
20
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
- Boston, MA 02110-1301, USA. */
22
-
23
- /* As a special exception, you may create a larger work that contains
24
- part or all of the Bison parser skeleton and distribute that work
25
- under terms of your choice, so long as that work isn't itself a
26
- parser generator using the skeleton or a modified version thereof
27
- as a parser skeleton. Alternatively, if you modify or redistribute
28
- the parser skeleton itself, you may (at your option) remove this
29
- special exception, which will cause the skeleton and the resulting
30
- Bison output files to be licensed under the GNU General Public
31
- License without this special exception.
32
-
33
- This special exception was added by the Free Software Foundation in
34
- version 2.2 of Bison. */
35
-
36
- /* C LALR(1) parser skeleton written by Richard Stallman, by
37
- simplifying the original so-called "semantic" parser. */
38
-
39
- /* All symbols defined below should begin with yy or YY, to avoid
40
- infringing on user name space. This should be done even for local
41
- variables, as they might otherwise be expanded by user macros.
42
- There are some unavoidable exceptions within include files to
43
- define necessary library symbols; they are noted "INFRINGES ON
44
- USER NAME SPACE" below. */
45
-
46
- /* Identify Bison output. */
47
- #define YYBISON 1
48
-
49
- /* Bison version. */
50
- #define YYBISON_VERSION "2.3"
51
-
52
- /* Skeleton name. */
53
- #define YYSKELETON_NAME "yacc.c"
54
-
55
- /* Pure parsers. */
56
- #define YYPURE 0
57
-
58
- /* Using locations. */
59
- #define YYLSP_NEEDED 0
60
-
61
-
62
-
63
- /* Tokens. */
64
- #ifndef YYTOKENTYPE
65
- # define YYTOKENTYPE
66
- /* Put the tokens into the symbol table, so that GDB and other debuggers
67
- know about them. */
68
- enum yytokentype {
69
- NEWLINE = 258,
70
- ALPHA = 259,
71
- COMPOSE = 260,
72
- PRINT = 261,
73
- POS = 262,
74
- INSERT = 263,
75
- SWITCH = 264,
76
- ARROW = 265,
77
- REPLACE = 266,
78
- SYMBOL = 267,
79
- VAR = 268,
80
- SVAR = 269,
81
- RVAR = 270,
82
- RSVAR = 271,
83
- STRING = 272,
84
- STRING2 = 273,
85
- UTF8CHAR = 274,
86
- CHARACTER = 275,
87
- SEQ = 276
88
- };
89
- #endif
90
- /* Tokens. */
91
- #define NEWLINE 258
92
- #define ALPHA 259
93
- #define COMPOSE 260
94
- #define PRINT 261
95
- #define POS 262
96
- #define INSERT 263
97
- #define SWITCH 264
98
- #define ARROW 265
99
- #define REPLACE 266
100
- #define SYMBOL 267
101
- #define VAR 268
102
- #define SVAR 269
103
- #define RVAR 270
104
- #define RSVAR 271
105
- #define STRING 272
106
- #define STRING2 273
107
- #define UTF8CHAR 274
108
- #define CHARACTER 275
109
- #define SEQ 276
110
-
111
-
112
-
113
-
114
- /* Copy the first part of user declarations. */
115
- #line 1 "fst-compiler.yy"
116
-
117
- /*******************************************************************/
118
- /* */
119
- /* FILE fst-compiler.yy */
120
- /* MODULE fst-compiler */
121
- /* PROGRAM SFST */
122
- /* AUTHOR Helmut Schmid, IMS, University of Stuttgart */
123
- /* */
124
- /*******************************************************************/
125
-
126
- #include <stdio.h>
127
-
128
- #include "make-compact.h"
129
- #include "interface.h"
130
-
131
- using std::cerr;
132
-
133
- extern int yylineno;
134
- extern char *yytext;
135
-
136
- void yyerror(char *text);
137
- void warn(char *text);
138
- void warn2(char *text, char *text2);
139
- int yylex( void );
140
- int yyparse( void );
141
-
142
- static int Switch=0;
143
- Transducer *Result;
144
-
145
-
146
- /* Enabling traces. */
147
- #ifndef YYDEBUG
148
- # define YYDEBUG 0
149
- #endif
150
-
151
- /* Enabling verbose error messages. */
152
- #ifdef YYERROR_VERBOSE
153
- # undef YYERROR_VERBOSE
154
- # define YYERROR_VERBOSE 1
155
- #else
156
- # define YYERROR_VERBOSE 0
157
- #endif
158
-
159
- /* Enabling the token table. */
160
- #ifndef YYTOKEN_TABLE
161
- # define YYTOKEN_TABLE 0
162
- #endif
163
-
164
- #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
165
- typedef union YYSTYPE
166
- #line 31 "fst-compiler.yy"
167
- {
168
- int number;
169
- Twol_Type type;
170
- Repl_Type rtype;
171
- char *name;
172
- char *value;
173
- unsigned char uchar;
174
- unsigned int longchar;
175
- Character character;
176
- Transducer *expression;
177
- Range *range;
178
- Ranges *ranges;
179
- Contexts *contexts;
180
- }
181
- /* Line 187 of yacc.c. */
182
- #line 183 "fst-compiler.C"
183
- YYSTYPE;
184
- # define yystype YYSTYPE /* obsolescent; will be withdrawn */
185
- # define YYSTYPE_IS_DECLARED 1
186
- # define YYSTYPE_IS_TRIVIAL 1
187
- #endif
188
-
189
-
190
-
191
- /* Copy the second part of user declarations. */
192
-
193
-
194
- /* Line 216 of yacc.c. */
195
- #line 196 "fst-compiler.C"
196
-
197
- #ifdef short
198
- # undef short
199
- #endif
200
-
201
- #ifdef YYTYPE_UINT8
202
- typedef YYTYPE_UINT8 yytype_uint8;
203
- #else
204
- typedef unsigned char yytype_uint8;
205
- #endif
206
-
207
- #ifdef YYTYPE_INT8
208
- typedef YYTYPE_INT8 yytype_int8;
209
- #elif (defined __STDC__ || defined __C99__FUNC__ \
210
- || defined __cplusplus || defined _MSC_VER)
211
- typedef signed char yytype_int8;
212
- #else
213
- typedef short int yytype_int8;
214
- #endif
215
-
216
- #ifdef YYTYPE_UINT16
217
- typedef YYTYPE_UINT16 yytype_uint16;
218
- #else
219
- typedef unsigned short int yytype_uint16;
220
- #endif
221
-
222
- #ifdef YYTYPE_INT16
223
- typedef YYTYPE_INT16 yytype_int16;
224
- #else
225
- typedef short int yytype_int16;
226
- #endif
227
-
228
- #ifndef YYSIZE_T
229
- # ifdef __SIZE_TYPE__
230
- # define YYSIZE_T __SIZE_TYPE__
231
- # elif defined size_t
232
- # define YYSIZE_T size_t
233
- # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
234
- || defined __cplusplus || defined _MSC_VER)
235
- # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
236
- # define YYSIZE_T size_t
237
- # else
238
- # define YYSIZE_T unsigned int
239
- # endif
240
- #endif
241
-
242
- #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
243
-
244
- #ifndef YY_
245
- # if YYENABLE_NLS
246
- # if ENABLE_NLS
247
- # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
248
- # define YY_(msgid) dgettext ("bison-runtime", msgid)
249
- # endif
250
- # endif
251
- # ifndef YY_
252
- # define YY_(msgid) msgid
253
- # endif
254
- #endif
255
-
256
- /* Suppress unused-variable warnings by "using" E. */
257
- #if ! defined lint || defined __GNUC__
258
- # define YYUSE(e) ((void) (e))
259
- #else
260
- # define YYUSE(e) /* empty */
261
- #endif
262
-
263
- /* Identity function, used to suppress warnings about constant conditions. */
264
- #ifndef lint
265
- # define YYID(n) (n)
266
- #else
267
- #if (defined __STDC__ || defined __C99__FUNC__ \
268
- || defined __cplusplus || defined _MSC_VER)
269
- static int
270
- YYID (int i)
271
- #else
272
- static int
273
- YYID (i)
274
- int i;
275
- #endif
276
- {
277
- return i;
278
- }
279
- #endif
280
-
281
- #if ! defined yyoverflow || YYERROR_VERBOSE
282
-
283
- /* The parser invokes alloca or malloc; define the necessary symbols. */
284
-
285
- # ifdef YYSTACK_USE_ALLOCA
286
- # if YYSTACK_USE_ALLOCA
287
- # ifdef __GNUC__
288
- # define YYSTACK_ALLOC __builtin_alloca
289
- # elif defined __BUILTIN_VA_ARG_INCR
290
- # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
291
- # elif defined _AIX
292
- # define YYSTACK_ALLOC __alloca
293
- # elif defined _MSC_VER
294
- # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
295
- # define alloca _alloca
296
- # else
297
- # define YYSTACK_ALLOC alloca
298
- # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
299
- || defined __cplusplus || defined _MSC_VER)
300
- # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
301
- # ifndef _STDLIB_H
302
- # define _STDLIB_H 1
303
- # endif
304
- # endif
305
- # endif
306
- # endif
307
- # endif
308
-
309
- # ifdef YYSTACK_ALLOC
310
- /* Pacify GCC's `empty if-body' warning. */
311
- # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
312
- # ifndef YYSTACK_ALLOC_MAXIMUM
313
- /* The OS might guarantee only one guard page at the bottom of the stack,
314
- and a page size can be as small as 4096 bytes. So we cannot safely
315
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
316
- to allow for a few compiler-allocated temporary stack slots. */
317
- # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
318
- # endif
319
- # else
320
- # define YYSTACK_ALLOC YYMALLOC
321
- # define YYSTACK_FREE YYFREE
322
- # ifndef YYSTACK_ALLOC_MAXIMUM
323
- # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
324
- # endif
325
- # if (defined __cplusplus && ! defined _STDLIB_H \
326
- && ! ((defined YYMALLOC || defined malloc) \
327
- && (defined YYFREE || defined free)))
328
- # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
329
- # ifndef _STDLIB_H
330
- # define _STDLIB_H 1
331
- # endif
332
- # endif
333
- # ifndef YYMALLOC
334
- # define YYMALLOC malloc
335
- # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
336
- || defined __cplusplus || defined _MSC_VER)
337
- void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
338
- # endif
339
- # endif
340
- # ifndef YYFREE
341
- # define YYFREE free
342
- # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
343
- || defined __cplusplus || defined _MSC_VER)
344
- void free (void *); /* INFRINGES ON USER NAME SPACE */
345
- # endif
346
- # endif
347
- # endif
348
- #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
349
-
350
-
351
- #if (! defined yyoverflow \
352
- && (! defined __cplusplus \
353
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
354
-
355
- /* A type that is properly aligned for any stack member. */
356
- union yyalloc
357
- {
358
- yytype_int16 yyss;
359
- YYSTYPE yyvs;
360
- };
361
-
362
- /* The size of the maximum gap between one aligned stack and the next. */
363
- # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
364
-
365
- /* The size of an array large to enough to hold all stacks, each with
366
- N elements. */
367
- # define YYSTACK_BYTES(N) \
368
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
369
- + YYSTACK_GAP_MAXIMUM)
370
-
371
- /* Copy COUNT objects from FROM to TO. The source and destination do
372
- not overlap. */
373
- # ifndef YYCOPY
374
- # if defined __GNUC__ && 1 < __GNUC__
375
- # define YYCOPY(To, From, Count) \
376
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
377
- # else
378
- # define YYCOPY(To, From, Count) \
379
- do \
380
- { \
381
- YYSIZE_T yyi; \
382
- for (yyi = 0; yyi < (Count); yyi++) \
383
- (To)[yyi] = (From)[yyi]; \
384
- } \
385
- while (YYID (0))
386
- # endif
387
- # endif
388
-
389
- /* Relocate STACK from its old location to the new one. The
390
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
391
- elements in the stack, and YYPTR gives the new location of the
392
- stack. Advance YYPTR to a properly aligned location for the next
393
- stack. */
394
- # define YYSTACK_RELOCATE(Stack) \
395
- do \
396
- { \
397
- YYSIZE_T yynewbytes; \
398
- YYCOPY (&yyptr->Stack, Stack, yysize); \
399
- Stack = &yyptr->Stack; \
400
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
401
- yyptr += yynewbytes / sizeof (*yyptr); \
402
- } \
403
- while (YYID (0))
404
-
405
- #endif
406
-
407
- /* YYFINAL -- State number of the termination state. */
408
- #define YYFINAL 3
409
- /* YYLAST -- Last index in YYTABLE. */
410
- #define YYLAST 902
411
-
412
- /* YYNTOKENS -- Number of terminals. */
413
- #define YYNTOKENS 41
414
- /* YYNNTS -- Number of nonterminals. */
415
- #define YYNNTS 17
416
- /* YYNRULES -- Number of rules. */
417
- #define YYNRULES 94
418
- /* YYNRULES -- Number of states. */
419
- #define YYNSTATES 155
420
-
421
- /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
422
- #define YYUNDEFTOK 2
423
- #define YYMAXUTOK 276
424
-
425
- #define YYTRANSLATE(YYX) \
426
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
427
-
428
- /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
429
- static const yytype_uint8 yytranslate[] =
430
- {
431
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434
- 2, 2, 2, 25, 2, 2, 2, 2, 23, 2,
435
- 32, 33, 28, 29, 40, 22, 39, 2, 2, 2,
436
- 2, 2, 2, 2, 2, 2, 2, 2, 36, 2,
437
- 2, 30, 2, 31, 2, 2, 2, 2, 2, 2,
438
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440
- 2, 37, 2, 38, 26, 27, 2, 2, 2, 2,
441
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443
- 2, 2, 2, 34, 21, 35, 2, 2, 2, 2,
444
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
457
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
458
- 15, 16, 17, 18, 19, 20, 24
459
- };
460
-
461
- #if YYDEBUG
462
- /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
463
- YYRHS. */
464
- static const yytype_uint16 yyprhs[] =
465
- {
466
- 0, 0, 3, 7, 10, 13, 14, 18, 22, 26,
467
- 30, 34, 37, 41, 46, 51, 55, 60, 65, 71,
468
- 77, 82, 87, 91, 95, 103, 109, 115, 121, 125,
469
- 129, 131, 133, 135, 138, 141, 144, 147, 150, 153,
470
- 156, 159, 163, 167, 171, 175, 177, 179, 182, 183,
471
- 187, 192, 196, 198, 200, 202, 206, 210, 212, 214,
472
- 218, 222, 225, 228, 231, 233, 237, 239, 241, 243,
473
- 245, 247, 249, 251, 253, 255, 257, 259, 261, 263,
474
- 265, 267, 269, 271, 273, 275, 277, 279, 281, 283,
475
- 285, 287, 289, 291, 294
476
- };
477
-
478
- /* YYRHS -- A `-1'-separated list of the rules' RHS. */
479
- static const yytype_int8 yyrhs[] =
480
- {
481
- 42, 0, -1, 43, 45, 57, -1, 43, 44, -1,
482
- 43, 3, -1, -1, 13, 30, 45, -1, 15, 30,
483
- 45, -1, 14, 30, 52, -1, 16, 30, 52, -1,
484
- 45, 6, 17, -1, 4, 45, -1, 45, 10, 48,
485
- -1, 45, 26, 10, 48, -1, 45, 27, 10, 48,
486
- -1, 45, 11, 50, -1, 45, 11, 31, 50, -1,
487
- 45, 11, 32, 33, -1, 45, 11, 31, 32, 33,
488
- -1, 45, 47, 10, 47, 45, -1, 45, 47, 10,
489
- 47, -1, 47, 10, 47, 45, -1, 47, 10, 47,
490
- -1, 45, 5, 45, -1, 34, 46, 35, 36, 34,
491
- 46, 35, -1, 47, 36, 34, 46, 35, -1, 34,
492
- 46, 35, 36, 47, -1, 45, 8, 55, 36, 55,
493
- -1, 45, 8, 55, -1, 47, 36, 47, -1, 47,
494
- -1, 13, -1, 15, -1, 45, 28, -1, 45, 29,
495
- -1, 45, 31, -1, 45, 45, -1, 25, 45, -1,
496
- 9, 45, -1, 26, 45, -1, 27, 45, -1, 45,
497
- 23, 45, -1, 45, 22, 45, -1, 45, 21, 45,
498
- -1, 32, 45, 33, -1, 17, -1, 18, -1, 47,
499
- 46, -1, -1, 37, 52, 38, -1, 37, 26, 52,
500
- 38, -1, 37, 16, 38, -1, 39, -1, 55, -1,
501
- 49, -1, 32, 49, 33, -1, 51, 40, 49, -1,
502
- 51, -1, 51, -1, 32, 51, 33, -1, 45, 7,
503
- 45, -1, 7, 45, -1, 45, 7, -1, 53, 52,
504
- -1, 53, -1, 54, 22, 54, -1, 14, -1, 54,
505
- -1, 55, -1, 56, -1, 20, -1, 19, -1, 56,
506
- -1, 20, -1, 19, -1, 12, -1, 39, -1, 25,
507
- -1, 31, -1, 34, -1, 35, -1, 33, -1, 32,
508
- -1, 23, -1, 21, -1, 28, -1, 29, -1, 36,
509
- -1, 40, -1, 30, -1, 27, -1, 26, -1, 22,
510
- -1, 3, 57, -1, -1
511
- };
512
-
513
- /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
514
- static const yytype_uint8 yyrline[] =
515
- {
516
- 0, 72, 72, 75, 76, 77, 80, 81, 82, 83,
517
- 84, 85, 88, 89, 90, 91, 92, 93, 94, 95,
518
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
519
- 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
520
- 116, 117, 118, 119, 120, 121, 122, 125, 126, 129,
521
- 130, 131, 132, 133, 136, 137, 140, 141, 144, 145,
522
- 148, 149, 150, 153, 154, 157, 158, 159, 160, 161,
523
- 164, 165, 166, 169, 170, 171, 174, 175, 176, 177,
524
- 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
525
- 188, 189, 190, 193, 194
526
- };
527
- #endif
528
-
529
- #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
530
- /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
531
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
532
- static const char *const yytname[] =
533
- {
534
- "$end", "error", "$undefined", "NEWLINE", "ALPHA", "COMPOSE", "PRINT",
535
- "POS", "INSERT", "SWITCH", "ARROW", "REPLACE", "SYMBOL", "VAR", "SVAR",
536
- "RVAR", "RSVAR", "STRING", "STRING2", "UTF8CHAR", "CHARACTER", "'|'",
537
- "'-'", "'&'", "SEQ", "'!'", "'^'", "'_'", "'*'", "'+'", "'='", "'?'",
538
- "'('", "')'", "'{'", "'}'", "':'", "'['", "']'", "'.'", "','", "$accept",
539
- "ALL", "ASSIGNMENTS", "ASSIGNMENT", "RE", "RANGES", "RANGE", "CONTEXTS2",
540
- "CONTEXTS", "CONTEXT2", "CONTEXT", "VALUES", "VALUE", "LCHAR", "CODE",
541
- "SCHAR", "NEWLINES", 0
542
- };
543
- #endif
544
-
545
- # ifdef YYPRINT
546
- /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
547
- token YYLEX-NUM. */
548
- static const yytype_uint16 yytoknum[] =
549
- {
550
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
551
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
552
- 275, 124, 45, 38, 276, 33, 94, 95, 42, 43,
553
- 61, 63, 40, 41, 123, 125, 58, 91, 93, 46,
554
- 44
555
- };
556
- # endif
557
-
558
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
559
- static const yytype_uint8 yyr1[] =
560
- {
561
- 0, 41, 42, 43, 43, 43, 44, 44, 44, 44,
562
- 44, 44, 45, 45, 45, 45, 45, 45, 45, 45,
563
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
564
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
565
- 45, 45, 45, 45, 45, 45, 45, 46, 46, 47,
566
- 47, 47, 47, 47, 48, 48, 49, 49, 50, 50,
567
- 51, 51, 51, 52, 52, 53, 53, 53, 53, 53,
568
- 54, 54, 54, 55, 55, 55, 56, 56, 56, 56,
569
- 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
570
- 56, 56, 56, 57, 57
571
- };
572
-
573
- /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
574
- static const yytype_uint8 yyr2[] =
575
- {
576
- 0, 2, 3, 2, 2, 0, 3, 3, 3, 3,
577
- 3, 2, 3, 4, 4, 3, 4, 4, 5, 5,
578
- 4, 4, 3, 3, 7, 5, 5, 5, 3, 3,
579
- 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
580
- 2, 3, 3, 3, 3, 1, 1, 2, 0, 3,
581
- 4, 3, 1, 1, 1, 3, 3, 1, 1, 3,
582
- 3, 2, 2, 2, 1, 3, 1, 1, 1, 1,
583
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
584
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
585
- 1, 1, 1, 2, 0
586
- };
587
-
588
- /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
589
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
590
- means the default is an error. */
591
- static const yytype_uint8 yydefact[] =
592
- {
593
- 5, 0, 0, 1, 4, 0, 0, 75, 31, 0,
594
- 32, 0, 45, 46, 74, 73, 0, 0, 0, 0,
595
- 48, 0, 52, 3, 94, 30, 53, 31, 32, 11,
596
- 38, 0, 0, 0, 0, 37, 39, 40, 0, 0,
597
- 48, 66, 0, 71, 70, 84, 92, 83, 77, 91,
598
- 90, 85, 86, 89, 78, 82, 81, 79, 80, 87,
599
- 76, 88, 0, 64, 67, 68, 69, 94, 0, 0,
600
- 0, 0, 0, 0, 0, 0, 0, 0, 33, 34,
601
- 35, 36, 30, 2, 0, 0, 6, 91, 8, 7,
602
- 9, 44, 0, 47, 51, 0, 49, 63, 0, 93,
603
- 23, 10, 28, 0, 0, 0, 12, 54, 57, 0,
604
- 0, 15, 58, 43, 42, 41, 0, 0, 0, 22,
605
- 48, 29, 0, 50, 71, 70, 65, 72, 0, 61,
606
- 0, 0, 62, 0, 0, 16, 17, 0, 13, 14,
607
- 20, 21, 0, 48, 26, 27, 55, 60, 56, 18,
608
- 59, 19, 25, 0, 24
609
- };
610
-
611
- /* YYDEFGOTO[NTERM-NUM]. */
612
- static const yytype_int8 yydefgoto[] =
613
- {
614
- -1, 1, 2, 23, 81, 39, 25, 106, 107, 111,
615
- 108, 62, 63, 64, 26, 66, 83
616
- };
617
-
618
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
619
- STATE-NUM. */
620
- #define YYPACT_NINF -105
621
- static const yytype_int16 yypact[] =
622
- {
623
- -105, 8, 185, -105, -105, 729, 729, -105, -20, -6,
624
- -5, 15, -105, -105, -105, -105, 729, 729, 729, 729,
625
- 195, 782, -105, -105, 153, -4, -105, -105, -105, 317,
626
- 317, 729, 811, 729, 811, 758, 758, 758, 251, -8,
627
- 195, -105, -10, -105, -105, -105, -105, -105, -105, 840,
628
- -105, -105, -105, -105, -105, -105, -105, -105, -105, -105,
629
- -105, -105, 9, 811, 26, -105, -105, 46, 729, 33,
630
- -1, 464, 377, 729, 729, 729, 669, 700, -105, -105,
631
- -105, 638, -3, -105, 195, 43, 317, -105, -105, 317,
632
- -105, -105, 17, -105, -105, 16, -105, -105, 862, -105,
633
- 551, -105, 20, 729, 493, 284, -105, -105, 19, 522,
634
- 406, -105, -105, 580, 609, 638, 464, 464, 195, 729,
635
- 195, -105, 66, -105, -105, -105, -105, -105, -1, 317,
636
- 218, 24, 729, 493, 435, -105, -105, 27, -105, -105,
637
- 729, 348, 30, 195, -105, -105, -105, 317, -105, -105,
638
- -105, 348, -105, 32, -105
639
- };
640
-
641
- /* YYPGOTO[NTERM-NUM]. */
642
- static const yytype_int8 yypgoto[] =
643
- {
644
- -105, -105, -105, -105, -2, -39, 6, -104, -99, -48,
645
- -70, -11, -105, -30, -12, -22, 12
646
- };
647
-
648
- /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
649
- positive, shift that token. If negative, reduce the rule which
650
- number is the opposite. If zero, do what YYDEFACT says.
651
- If YYTABLE_NINF, syntax error. */
652
- #define YYTABLE_NINF -1
653
- static const yytype_uint8 yytable[] =
654
- {
655
- 24, 93, 112, 29, 30, 131, 84, 118, 3, 65,
656
- 31, 7, 138, 139, 35, 36, 37, 38, 14, 15,
657
- 65, 88, 65, 90, 32, 33, 40, 92, 94, 86,
658
- 82, 89, 85, 85, 148, 82, 82, 65, 95, 112,
659
- 137, 82, 82, 82, 82, 34, 40, 96, 98, 67,
660
- 101, 65, 97, 122, 123, 7, 128, 146, 102, 133,
661
- 150, 135, 14, 15, 137, 152, 100, 154, 126, 105,
662
- 105, 113, 114, 115, 36, 37, 127, 120, 7, 99,
663
- 21, 142, 22, 0, 0, 14, 15, 82, 0, 0,
664
- 119, 121, 82, 0, 0, 82, 0, 0, 0, 0,
665
- 143, 129, 130, 21, 153, 22, 82, 105, 130, 0,
666
- 0, 82, 0, 0, 105, 105, 145, 141, 0, 82,
667
- 82, 82, 0, 0, 140, 0, 40, 0, 144, 0,
668
- 147, 105, 130, 0, 0, 82, 82, 0, 151, 0,
669
- 0, 0, 0, 0, 0, 0, 0, 82, 0, 40,
670
- 0, 0, 0, 82, 0, 0, 67, 82, 68, 69,
671
- 0, 70, 6, 71, 72, 7, 27, 0, 28, 0,
672
- 12, 13, 14, 15, 73, 74, 75, 0, 16, 76,
673
- 77, 78, 79, 0, 80, 19, 0, 20, 4, 5,
674
- 21, 0, 22, 0, 6, 0, 0, 7, 8, 9,
675
- 10, 11, 12, 13, 14, 15, 0, 7, 0, 0,
676
- 16, 17, 18, 0, 14, 15, 0, 19, 0, 20,
677
- 0, 0, 21, 68, 22, 132, 70, 6, 71, 72,
678
- 7, 27, 21, 28, 22, 12, 13, 14, 15, 73,
679
- 74, 75, 0, 16, 76, 77, 78, 79, 0, 80,
680
- 19, 91, 20, 0, 0, 21, 68, 22, 0, 70,
681
- 6, 71, 72, 7, 27, 0, 28, 0, 12, 13,
682
- 14, 15, 73, 74, 75, 0, 16, 76, 77, 78,
683
- 79, 0, 80, 19, 91, 20, 0, 0, 21, 68,
684
- 22, 132, 70, 6, 71, 72, 7, 27, 0, 28,
685
- 0, 12, 13, 14, 15, 73, 74, 75, 0, 16,
686
- 76, 77, 78, 79, 0, 80, 19, 0, 20, 0,
687
- 0, 21, 68, 22, 0, 70, 6, 71, 72, 7,
688
- 27, 0, 28, 0, 12, 13, 14, 15, 73, 74,
689
- 75, 0, 16, 76, 77, 78, 79, 0, 80, 19,
690
- 0, 20, 0, 68, 21, 0, 22, 6, 0, 0,
691
- 7, 27, 0, 28, 0, 12, 13, 14, 15, 73,
692
- 74, 75, 0, 16, 76, 77, 78, 79, 0, 80,
693
- 19, 0, 20, 0, 103, 21, 6, 22, 0, 7,
694
- 27, 0, 28, 0, 12, 13, 14, 15, 0, 0,
695
- 0, 0, 16, 17, 18, 0, 0, 0, 109, 110,
696
- 0, 20, 0, 103, 21, 6, 22, 0, 7, 27,
697
- 0, 28, 0, 12, 13, 14, 15, 0, 0, 0,
698
- 0, 16, 17, 18, 0, 0, 0, 0, 19, 136,
699
- 20, 0, 103, 21, 6, 22, 0, 7, 27, 0,
700
- 28, 0, 12, 13, 14, 15, 0, 0, 0, 0,
701
- 16, 17, 18, 0, 0, 0, 0, 19, 149, 20,
702
- 0, 103, 21, 6, 22, 0, 7, 27, 0, 28,
703
- 0, 12, 13, 14, 15, 0, 0, 0, 0, 16,
704
- 17, 18, 0, 0, 0, 0, 104, 0, 20, 0,
705
- 103, 21, 6, 22, 0, 7, 27, 0, 28, 0,
706
- 12, 13, 14, 15, 0, 0, 0, 0, 16, 17,
707
- 18, 0, 0, 0, 0, 19, 0, 20, 0, 103,
708
- 21, 6, 22, 0, 7, 27, 0, 28, 0, 12,
709
- 13, 14, 15, 0, 0, 0, 0, 16, 17, 18,
710
- 0, 0, 0, 0, 134, 0, 20, 0, 0, 21,
711
- 6, 22, 0, 7, 27, 0, 28, 0, 12, 13,
712
- 14, 15, 73, 74, 75, 0, 16, 76, 77, 78,
713
- 79, 0, 80, 19, 0, 20, 0, 0, 21, 6,
714
- 22, 0, 7, 27, 0, 28, 0, 12, 13, 14,
715
- 15, 0, 74, 75, 0, 16, 76, 77, 78, 79,
716
- 0, 80, 19, 0, 20, 0, 0, 21, 6, 22,
717
- 0, 7, 27, 0, 28, 0, 12, 13, 14, 15,
718
- 0, 0, 75, 0, 16, 76, 77, 78, 79, 0,
719
- 80, 19, 0, 20, 0, 0, 21, 6, 22, 0,
720
- 7, 27, 0, 28, 0, 12, 13, 14, 15, 0,
721
- 0, 0, 0, 16, 76, 77, 78, 79, 0, 80,
722
- 19, 0, 20, 0, 0, 21, 0, 22, 6, 116,
723
- 0, 7, 27, 0, 28, 0, 12, 13, 14, 15,
724
- 0, 0, 0, 0, 16, 17, 18, 0, 0, 0,
725
- 0, 19, 0, 20, 0, 0, 21, 0, 22, 6,
726
- 117, 0, 7, 27, 0, 28, 0, 12, 13, 14,
727
- 15, 0, 0, 0, 0, 16, 17, 18, 0, 0,
728
- 0, 0, 19, 0, 20, 0, 0, 21, 6, 22,
729
- 0, 7, 27, 0, 28, 0, 12, 13, 14, 15,
730
- 0, 0, 0, 0, 16, 17, 18, 0, 0, 0,
731
- 0, 19, 0, 20, 0, 0, 21, 6, 22, 0,
732
- 7, 27, 0, 28, 0, 12, 13, 14, 15, 0,
733
- 0, 0, 0, 0, 0, 0, 78, 79, 0, 80,
734
- 19, 0, 20, 0, 7, 21, 41, 22, 42, 0,
735
- 0, 43, 44, 45, 46, 47, 0, 48, 49, 50,
736
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 0,
737
- 0, 60, 61, 7, 0, 41, 0, 0, 0, 0,
738
- 43, 44, 45, 46, 47, 0, 48, 87, 50, 51,
739
- 52, 53, 54, 55, 56, 57, 58, 59, 0, 0,
740
- 60, 61, 7, 0, 41, 0, 0, 0, 0, 43,
741
- 44, 0, 0, 0, 0, 0, 0, 0, 51, 52,
742
- 53, 54, 55, 56, 57, 58, 59, 0, 0, 60,
743
- 61, 124, 125, 45, 46, 47, 0, 48, 87, 50,
744
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 0,
745
- 0, 60, 61
746
- };
747
-
748
- static const yytype_int16 yycheck[] =
749
- {
750
- 2, 40, 72, 5, 6, 104, 10, 10, 0, 21,
751
- 30, 12, 116, 117, 16, 17, 18, 19, 19, 20,
752
- 32, 32, 34, 34, 30, 30, 20, 35, 38, 31,
753
- 24, 33, 36, 36, 133, 29, 30, 49, 49, 109,
754
- 110, 35, 36, 37, 38, 30, 40, 38, 22, 3,
755
- 17, 63, 63, 36, 38, 12, 36, 33, 70, 40,
756
- 33, 109, 19, 20, 134, 35, 68, 35, 98, 71,
757
- 72, 73, 74, 75, 76, 77, 98, 34, 12, 67,
758
- 37, 120, 39, -1, -1, 19, 20, 81, -1, -1,
759
- 84, 85, 86, -1, -1, 89, -1, -1, -1, -1,
760
- 34, 103, 104, 37, 143, 39, 100, 109, 110, -1,
761
- -1, 105, -1, -1, 116, 117, 128, 119, -1, 113,
762
- 114, 115, -1, -1, 118, -1, 120, -1, 122, -1,
763
- 132, 133, 134, -1, -1, 129, 130, -1, 140, -1,
764
- -1, -1, -1, -1, -1, -1, -1, 141, -1, 143,
765
- -1, -1, -1, 147, -1, -1, 3, 151, 5, 6,
766
- -1, 8, 9, 10, 11, 12, 13, -1, 15, -1,
767
- 17, 18, 19, 20, 21, 22, 23, -1, 25, 26,
768
- 27, 28, 29, -1, 31, 32, -1, 34, 3, 4,
769
- 37, -1, 39, -1, 9, -1, -1, 12, 13, 14,
770
- 15, 16, 17, 18, 19, 20, -1, 12, -1, -1,
771
- 25, 26, 27, -1, 19, 20, -1, 32, -1, 34,
772
- -1, -1, 37, 5, 39, 7, 8, 9, 10, 11,
773
- 12, 13, 37, 15, 39, 17, 18, 19, 20, 21,
774
- 22, 23, -1, 25, 26, 27, 28, 29, -1, 31,
775
- 32, 33, 34, -1, -1, 37, 5, 39, -1, 8,
776
- 9, 10, 11, 12, 13, -1, 15, -1, 17, 18,
777
- 19, 20, 21, 22, 23, -1, 25, 26, 27, 28,
778
- 29, -1, 31, 32, 33, 34, -1, -1, 37, 5,
779
- 39, 7, 8, 9, 10, 11, 12, 13, -1, 15,
780
- -1, 17, 18, 19, 20, 21, 22, 23, -1, 25,
781
- 26, 27, 28, 29, -1, 31, 32, -1, 34, -1,
782
- -1, 37, 5, 39, -1, 8, 9, 10, 11, 12,
783
- 13, -1, 15, -1, 17, 18, 19, 20, 21, 22,
784
- 23, -1, 25, 26, 27, 28, 29, -1, 31, 32,
785
- -1, 34, -1, 5, 37, -1, 39, 9, -1, -1,
786
- 12, 13, -1, 15, -1, 17, 18, 19, 20, 21,
787
- 22, 23, -1, 25, 26, 27, 28, 29, -1, 31,
788
- 32, -1, 34, -1, 7, 37, 9, 39, -1, 12,
789
- 13, -1, 15, -1, 17, 18, 19, 20, -1, -1,
790
- -1, -1, 25, 26, 27, -1, -1, -1, 31, 32,
791
- -1, 34, -1, 7, 37, 9, 39, -1, 12, 13,
792
- -1, 15, -1, 17, 18, 19, 20, -1, -1, -1,
793
- -1, 25, 26, 27, -1, -1, -1, -1, 32, 33,
794
- 34, -1, 7, 37, 9, 39, -1, 12, 13, -1,
795
- 15, -1, 17, 18, 19, 20, -1, -1, -1, -1,
796
- 25, 26, 27, -1, -1, -1, -1, 32, 33, 34,
797
- -1, 7, 37, 9, 39, -1, 12, 13, -1, 15,
798
- -1, 17, 18, 19, 20, -1, -1, -1, -1, 25,
799
- 26, 27, -1, -1, -1, -1, 32, -1, 34, -1,
800
- 7, 37, 9, 39, -1, 12, 13, -1, 15, -1,
801
- 17, 18, 19, 20, -1, -1, -1, -1, 25, 26,
802
- 27, -1, -1, -1, -1, 32, -1, 34, -1, 7,
803
- 37, 9, 39, -1, 12, 13, -1, 15, -1, 17,
804
- 18, 19, 20, -1, -1, -1, -1, 25, 26, 27,
805
- -1, -1, -1, -1, 32, -1, 34, -1, -1, 37,
806
- 9, 39, -1, 12, 13, -1, 15, -1, 17, 18,
807
- 19, 20, 21, 22, 23, -1, 25, 26, 27, 28,
808
- 29, -1, 31, 32, -1, 34, -1, -1, 37, 9,
809
- 39, -1, 12, 13, -1, 15, -1, 17, 18, 19,
810
- 20, -1, 22, 23, -1, 25, 26, 27, 28, 29,
811
- -1, 31, 32, -1, 34, -1, -1, 37, 9, 39,
812
- -1, 12, 13, -1, 15, -1, 17, 18, 19, 20,
813
- -1, -1, 23, -1, 25, 26, 27, 28, 29, -1,
814
- 31, 32, -1, 34, -1, -1, 37, 9, 39, -1,
815
- 12, 13, -1, 15, -1, 17, 18, 19, 20, -1,
816
- -1, -1, -1, 25, 26, 27, 28, 29, -1, 31,
817
- 32, -1, 34, -1, -1, 37, -1, 39, 9, 10,
818
- -1, 12, 13, -1, 15, -1, 17, 18, 19, 20,
819
- -1, -1, -1, -1, 25, 26, 27, -1, -1, -1,
820
- -1, 32, -1, 34, -1, -1, 37, -1, 39, 9,
821
- 10, -1, 12, 13, -1, 15, -1, 17, 18, 19,
822
- 20, -1, -1, -1, -1, 25, 26, 27, -1, -1,
823
- -1, -1, 32, -1, 34, -1, -1, 37, 9, 39,
824
- -1, 12, 13, -1, 15, -1, 17, 18, 19, 20,
825
- -1, -1, -1, -1, 25, 26, 27, -1, -1, -1,
826
- -1, 32, -1, 34, -1, -1, 37, 9, 39, -1,
827
- 12, 13, -1, 15, -1, 17, 18, 19, 20, -1,
828
- -1, -1, -1, -1, -1, -1, 28, 29, -1, 31,
829
- 32, -1, 34, -1, 12, 37, 14, 39, 16, -1,
830
- -1, 19, 20, 21, 22, 23, -1, 25, 26, 27,
831
- 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
832
- -1, 39, 40, 12, -1, 14, -1, -1, -1, -1,
833
- 19, 20, 21, 22, 23, -1, 25, 26, 27, 28,
834
- 29, 30, 31, 32, 33, 34, 35, 36, -1, -1,
835
- 39, 40, 12, -1, 14, -1, -1, -1, -1, 19,
836
- 20, -1, -1, -1, -1, -1, -1, -1, 28, 29,
837
- 30, 31, 32, 33, 34, 35, 36, -1, -1, 39,
838
- 40, 19, 20, 21, 22, 23, -1, 25, 26, 27,
839
- 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
840
- -1, 39, 40
841
- };
842
-
843
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
844
- symbol of state STATE-NUM. */
845
- static const yytype_uint8 yystos[] =
846
- {
847
- 0, 42, 43, 0, 3, 4, 9, 12, 13, 14,
848
- 15, 16, 17, 18, 19, 20, 25, 26, 27, 32,
849
- 34, 37, 39, 44, 45, 47, 55, 13, 15, 45,
850
- 45, 30, 30, 30, 30, 45, 45, 45, 45, 46,
851
- 47, 14, 16, 19, 20, 21, 22, 23, 25, 26,
852
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
853
- 39, 40, 52, 53, 54, 55, 56, 3, 5, 6,
854
- 8, 10, 11, 21, 22, 23, 26, 27, 28, 29,
855
- 31, 45, 47, 57, 10, 36, 45, 26, 52, 45,
856
- 52, 33, 35, 46, 38, 52, 38, 52, 22, 57,
857
- 45, 17, 55, 7, 32, 45, 48, 49, 51, 31,
858
- 32, 50, 51, 45, 45, 45, 10, 10, 10, 47,
859
- 34, 47, 36, 38, 19, 20, 54, 56, 36, 45,
860
- 45, 49, 7, 40, 32, 50, 33, 51, 48, 48,
861
- 47, 45, 46, 34, 47, 55, 33, 45, 49, 33,
862
- 33, 45, 35, 46, 35
863
- };
864
-
865
- #define yyerrok (yyerrstatus = 0)
866
- #define yyclearin (yychar = YYEMPTY)
867
- #define YYEMPTY (-2)
868
- #define YYEOF 0
869
-
870
- #define YYACCEPT goto yyacceptlab
871
- #define YYABORT goto yyabortlab
872
- #define YYERROR goto yyerrorlab
873
-
874
-
875
- /* Like YYERROR except do call yyerror. This remains here temporarily
876
- to ease the transition to the new meaning of YYERROR, for GCC.
877
- Once GCC version 2 has supplanted version 1, this can go. */
878
-
879
- #define YYFAIL goto yyerrlab
880
-
881
- #define YYRECOVERING() (!!yyerrstatus)
882
-
883
- #define YYBACKUP(Token, Value) \
884
- do \
885
- if (yychar == YYEMPTY && yylen == 1) \
886
- { \
887
- yychar = (Token); \
888
- yylval = (Value); \
889
- yytoken = YYTRANSLATE (yychar); \
890
- YYPOPSTACK (1); \
891
- goto yybackup; \
892
- } \
893
- else \
894
- { \
895
- yyerror (YY_("syntax error: cannot back up")); \
896
- YYERROR; \
897
- } \
898
- while (YYID (0))
899
-
900
-
901
- #define YYTERROR 1
902
- #define YYERRCODE 256
903
-
904
-
905
- /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
906
- If N is 0, then set CURRENT to the empty location which ends
907
- the previous symbol: RHS[0] (always defined). */
908
-
909
- #define YYRHSLOC(Rhs, K) ((Rhs)[K])
910
- #ifndef YYLLOC_DEFAULT
911
- # define YYLLOC_DEFAULT(Current, Rhs, N) \
912
- do \
913
- if (YYID (N)) \
914
- { \
915
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
916
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
917
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
918
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
919
- } \
920
- else \
921
- { \
922
- (Current).first_line = (Current).last_line = \
923
- YYRHSLOC (Rhs, 0).last_line; \
924
- (Current).first_column = (Current).last_column = \
925
- YYRHSLOC (Rhs, 0).last_column; \
926
- } \
927
- while (YYID (0))
928
- #endif
929
-
930
-
931
- /* YY_LOCATION_PRINT -- Print the location on the stream.
932
- This macro was not mandated originally: define only if we know
933
- we won't break user code: when these are the locations we know. */
934
-
935
- #ifndef YY_LOCATION_PRINT
936
- # if YYLTYPE_IS_TRIVIAL
937
- # define YY_LOCATION_PRINT(File, Loc) \
938
- fprintf (File, "%d.%d-%d.%d", \
939
- (Loc).first_line, (Loc).first_column, \
940
- (Loc).last_line, (Loc).last_column)
941
- # else
942
- # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
943
- # endif
944
- #endif
945
-
946
-
947
- /* YYLEX -- calling `yylex' with the right arguments. */
948
-
949
- #ifdef YYLEX_PARAM
950
- # define YYLEX yylex (YYLEX_PARAM)
951
- #else
952
- # define YYLEX yylex ()
953
- #endif
954
-
955
- /* Enable debugging if requested. */
956
- #if YYDEBUG
957
-
958
- # ifndef YYFPRINTF
959
- # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
960
- # define YYFPRINTF fprintf
961
- # endif
962
-
963
- # define YYDPRINTF(Args) \
964
- do { \
965
- if (yydebug) \
966
- YYFPRINTF Args; \
967
- } while (YYID (0))
968
-
969
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
970
- do { \
971
- if (yydebug) \
972
- { \
973
- YYFPRINTF (stderr, "%s ", Title); \
974
- yy_symbol_print (stderr, \
975
- Type, Value); \
976
- YYFPRINTF (stderr, "\n"); \
977
- } \
978
- } while (YYID (0))
979
-
980
-
981
- /*--------------------------------.
982
- | Print this symbol on YYOUTPUT. |
983
- `--------------------------------*/
984
-
985
- /*ARGSUSED*/
986
- #if (defined __STDC__ || defined __C99__FUNC__ \
987
- || defined __cplusplus || defined _MSC_VER)
988
- static void
989
- yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
990
- #else
991
- static void
992
- yy_symbol_value_print (yyoutput, yytype, yyvaluep)
993
- FILE *yyoutput;
994
- int yytype;
995
- YYSTYPE const * const yyvaluep;
996
- #endif
997
- {
998
- if (!yyvaluep)
999
- return;
1000
- # ifdef YYPRINT
1001
- if (yytype < YYNTOKENS)
1002
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1003
- # else
1004
- YYUSE (yyoutput);
1005
- # endif
1006
- switch (yytype)
1007
- {
1008
- default:
1009
- break;
1010
- }
1011
- }
1012
-
1013
-
1014
- /*--------------------------------.
1015
- | Print this symbol on YYOUTPUT. |
1016
- `--------------------------------*/
1017
-
1018
- #if (defined __STDC__ || defined __C99__FUNC__ \
1019
- || defined __cplusplus || defined _MSC_VER)
1020
- static void
1021
- yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1022
- #else
1023
- static void
1024
- yy_symbol_print (yyoutput, yytype, yyvaluep)
1025
- FILE *yyoutput;
1026
- int yytype;
1027
- YYSTYPE const * const yyvaluep;
1028
- #endif
1029
- {
1030
- if (yytype < YYNTOKENS)
1031
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
1032
- else
1033
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
1034
-
1035
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1036
- YYFPRINTF (yyoutput, ")");
1037
- }
1038
-
1039
- /*------------------------------------------------------------------.
1040
- | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1041
- | TOP (included). |
1042
- `------------------------------------------------------------------*/
1043
-
1044
- #if (defined __STDC__ || defined __C99__FUNC__ \
1045
- || defined __cplusplus || defined _MSC_VER)
1046
- static void
1047
- yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
1048
- #else
1049
- static void
1050
- yy_stack_print (bottom, top)
1051
- yytype_int16 *bottom;
1052
- yytype_int16 *top;
1053
- #endif
1054
- {
1055
- YYFPRINTF (stderr, "Stack now");
1056
- for (; bottom <= top; ++bottom)
1057
- YYFPRINTF (stderr, " %d", *bottom);
1058
- YYFPRINTF (stderr, "\n");
1059
- }
1060
-
1061
- # define YY_STACK_PRINT(Bottom, Top) \
1062
- do { \
1063
- if (yydebug) \
1064
- yy_stack_print ((Bottom), (Top)); \
1065
- } while (YYID (0))
1066
-
1067
-
1068
- /*------------------------------------------------.
1069
- | Report that the YYRULE is going to be reduced. |
1070
- `------------------------------------------------*/
1071
-
1072
- #if (defined __STDC__ || defined __C99__FUNC__ \
1073
- || defined __cplusplus || defined _MSC_VER)
1074
- static void
1075
- yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
1076
- #else
1077
- static void
1078
- yy_reduce_print (yyvsp, yyrule)
1079
- YYSTYPE *yyvsp;
1080
- int yyrule;
1081
- #endif
1082
- {
1083
- int yynrhs = yyr2[yyrule];
1084
- int yyi;
1085
- unsigned long int yylno = yyrline[yyrule];
1086
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1087
- yyrule - 1, yylno);
1088
- /* The symbols being reduced. */
1089
- for (yyi = 0; yyi < yynrhs; yyi++)
1090
- {
1091
- fprintf (stderr, " $%d = ", yyi + 1);
1092
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
1093
- &(yyvsp[(yyi + 1) - (yynrhs)])
1094
- );
1095
- fprintf (stderr, "\n");
1096
- }
1097
- }
1098
-
1099
- # define YY_REDUCE_PRINT(Rule) \
1100
- do { \
1101
- if (yydebug) \
1102
- yy_reduce_print (yyvsp, Rule); \
1103
- } while (YYID (0))
1104
-
1105
- /* Nonzero means print parse trace. It is left uninitialized so that
1106
- multiple parsers can coexist. */
1107
- int yydebug;
1108
- #else /* !YYDEBUG */
1109
- # define YYDPRINTF(Args)
1110
- # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1111
- # define YY_STACK_PRINT(Bottom, Top)
1112
- # define YY_REDUCE_PRINT(Rule)
1113
- #endif /* !YYDEBUG */
1114
-
1115
-
1116
- /* YYINITDEPTH -- initial size of the parser's stacks. */
1117
- #ifndef YYINITDEPTH
1118
- # define YYINITDEPTH 200
1119
- #endif
1120
-
1121
- /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1122
- if the built-in stack extension method is used).
1123
-
1124
- Do not make this value too large; the results are undefined if
1125
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1126
- evaluated with infinite-precision integer arithmetic. */
1127
-
1128
- #ifndef YYMAXDEPTH
1129
- # define YYMAXDEPTH 10000
1130
- #endif
1131
-
1132
-
1133
-
1134
- #if YYERROR_VERBOSE
1135
-
1136
- # ifndef yystrlen
1137
- # if defined __GLIBC__ && defined _STRING_H
1138
- # define yystrlen strlen
1139
- # else
1140
- /* Return the length of YYSTR. */
1141
- #if (defined __STDC__ || defined __C99__FUNC__ \
1142
- || defined __cplusplus || defined _MSC_VER)
1143
- static YYSIZE_T
1144
- yystrlen (const char *yystr)
1145
- #else
1146
- static YYSIZE_T
1147
- yystrlen (yystr)
1148
- const char *yystr;
1149
- #endif
1150
- {
1151
- YYSIZE_T yylen;
1152
- for (yylen = 0; yystr[yylen]; yylen++)
1153
- continue;
1154
- return yylen;
1155
- }
1156
- # endif
1157
- # endif
1158
-
1159
- # ifndef yystpcpy
1160
- # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1161
- # define yystpcpy stpcpy
1162
- # else
1163
- /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1164
- YYDEST. */
1165
- #if (defined __STDC__ || defined __C99__FUNC__ \
1166
- || defined __cplusplus || defined _MSC_VER)
1167
- static char *
1168
- yystpcpy (char *yydest, const char *yysrc)
1169
- #else
1170
- static char *
1171
- yystpcpy (yydest, yysrc)
1172
- char *yydest;
1173
- const char *yysrc;
1174
- #endif
1175
- {
1176
- char *yyd = yydest;
1177
- const char *yys = yysrc;
1178
-
1179
- while ((*yyd++ = *yys++) != '\0')
1180
- continue;
1181
-
1182
- return yyd - 1;
1183
- }
1184
- # endif
1185
- # endif
1186
-
1187
- # ifndef yytnamerr
1188
- /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1189
- quotes and backslashes, so that it's suitable for yyerror. The
1190
- heuristic is that double-quoting is unnecessary unless the string
1191
- contains an apostrophe, a comma, or backslash (other than
1192
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
1193
- null, do not copy; instead, return the length of what the result
1194
- would have been. */
1195
- static YYSIZE_T
1196
- yytnamerr (char *yyres, const char *yystr)
1197
- {
1198
- if (*yystr == '"')
1199
- {
1200
- YYSIZE_T yyn = 0;
1201
- char const *yyp = yystr;
1202
-
1203
- for (;;)
1204
- switch (*++yyp)
1205
- {
1206
- case '\'':
1207
- case ',':
1208
- goto do_not_strip_quotes;
1209
-
1210
- case '\\':
1211
- if (*++yyp != '\\')
1212
- goto do_not_strip_quotes;
1213
- /* Fall through. */
1214
- default:
1215
- if (yyres)
1216
- yyres[yyn] = *yyp;
1217
- yyn++;
1218
- break;
1219
-
1220
- case '"':
1221
- if (yyres)
1222
- yyres[yyn] = '\0';
1223
- return yyn;
1224
- }
1225
- do_not_strip_quotes: ;
1226
- }
1227
-
1228
- if (! yyres)
1229
- return yystrlen (yystr);
1230
-
1231
- return yystpcpy (yyres, yystr) - yyres;
1232
- }
1233
- # endif
1234
-
1235
- /* Copy into YYRESULT an error message about the unexpected token
1236
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
1237
- including the terminating null byte. If YYRESULT is null, do not
1238
- copy anything; just return the number of bytes that would be
1239
- copied. As a special case, return 0 if an ordinary "syntax error"
1240
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1241
- size calculation. */
1242
- static YYSIZE_T
1243
- yysyntax_error (char *yyresult, int yystate, int yychar)
1244
- {
1245
- int yyn = yypact[yystate];
1246
-
1247
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1248
- return 0;
1249
- else
1250
- {
1251
- int yytype = YYTRANSLATE (yychar);
1252
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1253
- YYSIZE_T yysize = yysize0;
1254
- YYSIZE_T yysize1;
1255
- int yysize_overflow = 0;
1256
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1257
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1258
- int yyx;
1259
-
1260
- # if 0
1261
- /* This is so xgettext sees the translatable formats that are
1262
- constructed on the fly. */
1263
- YY_("syntax error, unexpected %s");
1264
- YY_("syntax error, unexpected %s, expecting %s");
1265
- YY_("syntax error, unexpected %s, expecting %s or %s");
1266
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1267
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1268
- # endif
1269
- char *yyfmt;
1270
- char const *yyf;
1271
- static char const yyunexpected[] = "syntax error, unexpected %s";
1272
- static char const yyexpecting[] = ", expecting %s";
1273
- static char const yyor[] = " or %s";
1274
- char yyformat[sizeof yyunexpected
1275
- + sizeof yyexpecting - 1
1276
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1277
- * (sizeof yyor - 1))];
1278
- char const *yyprefix = yyexpecting;
1279
-
1280
- /* Start YYX at -YYN if negative to avoid negative indexes in
1281
- YYCHECK. */
1282
- int yyxbegin = yyn < 0 ? -yyn : 0;
1283
-
1284
- /* Stay within bounds of both yycheck and yytname. */
1285
- int yychecklim = YYLAST - yyn + 1;
1286
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1287
- int yycount = 1;
1288
-
1289
- yyarg[0] = yytname[yytype];
1290
- yyfmt = yystpcpy (yyformat, yyunexpected);
1291
-
1292
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1293
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1294
- {
1295
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1296
- {
1297
- yycount = 1;
1298
- yysize = yysize0;
1299
- yyformat[sizeof yyunexpected - 1] = '\0';
1300
- break;
1301
- }
1302
- yyarg[yycount++] = yytname[yyx];
1303
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1304
- yysize_overflow |= (yysize1 < yysize);
1305
- yysize = yysize1;
1306
- yyfmt = yystpcpy (yyfmt, yyprefix);
1307
- yyprefix = yyor;
1308
- }
1309
-
1310
- yyf = YY_(yyformat);
1311
- yysize1 = yysize + yystrlen (yyf);
1312
- yysize_overflow |= (yysize1 < yysize);
1313
- yysize = yysize1;
1314
-
1315
- if (yysize_overflow)
1316
- return YYSIZE_MAXIMUM;
1317
-
1318
- if (yyresult)
1319
- {
1320
- /* Avoid sprintf, as that infringes on the user's name space.
1321
- Don't have undefined behavior even if the translation
1322
- produced a string with the wrong number of "%s"s. */
1323
- char *yyp = yyresult;
1324
- int yyi = 0;
1325
- while ((*yyp = *yyf) != '\0')
1326
- {
1327
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1328
- {
1329
- yyp += yytnamerr (yyp, yyarg[yyi++]);
1330
- yyf += 2;
1331
- }
1332
- else
1333
- {
1334
- yyp++;
1335
- yyf++;
1336
- }
1337
- }
1338
- }
1339
- return yysize;
1340
- }
1341
- }
1342
- #endif /* YYERROR_VERBOSE */
1343
-
1344
-
1345
- /*-----------------------------------------------.
1346
- | Release the memory associated to this symbol. |
1347
- `-----------------------------------------------*/
1348
-
1349
- /*ARGSUSED*/
1350
- #if (defined __STDC__ || defined __C99__FUNC__ \
1351
- || defined __cplusplus || defined _MSC_VER)
1352
- static void
1353
- yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1354
- #else
1355
- static void
1356
- yydestruct (yymsg, yytype, yyvaluep)
1357
- const char *yymsg;
1358
- int yytype;
1359
- YYSTYPE *yyvaluep;
1360
- #endif
1361
- {
1362
- YYUSE (yyvaluep);
1363
-
1364
- if (!yymsg)
1365
- yymsg = "Deleting";
1366
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1367
-
1368
- switch (yytype)
1369
- {
1370
-
1371
- default:
1372
- break;
1373
- }
1374
- }
1375
-
1376
-
1377
- /* Prevent warnings from -Wmissing-prototypes. */
1378
-
1379
- #ifdef YYPARSE_PARAM
1380
- #if defined __STDC__ || defined __cplusplus
1381
- int yyparse (void *YYPARSE_PARAM);
1382
- #else
1383
- int yyparse ();
1384
- #endif
1385
- #else /* ! YYPARSE_PARAM */
1386
- #if defined __STDC__ || defined __cplusplus
1387
- int yyparse (void);
1388
- #else
1389
- int yyparse ();
1390
- #endif
1391
- #endif /* ! YYPARSE_PARAM */
1392
-
1393
-
1394
-
1395
- /* The look-ahead symbol. */
1396
- int yychar;
1397
-
1398
- /* The semantic value of the look-ahead symbol. */
1399
- YYSTYPE yylval;
1400
-
1401
- /* Number of syntax errors so far. */
1402
- int yynerrs;
1403
-
1404
-
1405
-
1406
- /*----------.
1407
- | yyparse. |
1408
- `----------*/
1409
-
1410
- #ifdef YYPARSE_PARAM
1411
- #if (defined __STDC__ || defined __C99__FUNC__ \
1412
- || defined __cplusplus || defined _MSC_VER)
1413
- int
1414
- yyparse (void *YYPARSE_PARAM)
1415
- #else
1416
- int
1417
- yyparse (YYPARSE_PARAM)
1418
- void *YYPARSE_PARAM;
1419
- #endif
1420
- #else /* ! YYPARSE_PARAM */
1421
- #if (defined __STDC__ || defined __C99__FUNC__ \
1422
- || defined __cplusplus || defined _MSC_VER)
1423
- int
1424
- yyparse (void)
1425
- #else
1426
- int
1427
- yyparse ()
1428
-
1429
- #endif
1430
- #endif
1431
- {
1432
-
1433
- int yystate;
1434
- int yyn;
1435
- int yyresult;
1436
- /* Number of tokens to shift before error messages enabled. */
1437
- int yyerrstatus;
1438
- /* Look-ahead token as an internal (translated) token number. */
1439
- int yytoken = 0;
1440
- #if YYERROR_VERBOSE
1441
- /* Buffer for error messages, and its allocated size. */
1442
- char yymsgbuf[128];
1443
- char *yymsg = yymsgbuf;
1444
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1445
- #endif
1446
-
1447
- /* Three stacks and their tools:
1448
- `yyss': related to states,
1449
- `yyvs': related to semantic values,
1450
- `yyls': related to locations.
1451
-
1452
- Refer to the stacks thru separate pointers, to allow yyoverflow
1453
- to reallocate them elsewhere. */
1454
-
1455
- /* The state stack. */
1456
- yytype_int16 yyssa[YYINITDEPTH];
1457
- yytype_int16 *yyss = yyssa;
1458
- yytype_int16 *yyssp;
1459
-
1460
- /* The semantic value stack. */
1461
- YYSTYPE yyvsa[YYINITDEPTH];
1462
- YYSTYPE *yyvs = yyvsa;
1463
- YYSTYPE *yyvsp;
1464
-
1465
-
1466
-
1467
- #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1468
-
1469
- YYSIZE_T yystacksize = YYINITDEPTH;
1470
-
1471
- /* The variables used to return semantic value and location from the
1472
- action routines. */
1473
- YYSTYPE yyval;
1474
-
1475
-
1476
- /* The number of symbols on the RHS of the reduced rule.
1477
- Keep to zero when no symbol should be popped. */
1478
- int yylen = 0;
1479
-
1480
- YYDPRINTF ((stderr, "Starting parse\n"));
1481
-
1482
- yystate = 0;
1483
- yyerrstatus = 0;
1484
- yynerrs = 0;
1485
- yychar = YYEMPTY; /* Cause a token to be read. */
1486
-
1487
- /* Initialize stack pointers.
1488
- Waste one element of value and location stack
1489
- so that they stay on the same level as the state stack.
1490
- The wasted elements are never initialized. */
1491
-
1492
- yyssp = yyss;
1493
- yyvsp = yyvs;
1494
-
1495
- goto yysetstate;
1496
-
1497
- /*------------------------------------------------------------.
1498
- | yynewstate -- Push a new state, which is found in yystate. |
1499
- `------------------------------------------------------------*/
1500
- yynewstate:
1501
- /* In all cases, when you get here, the value and location stacks
1502
- have just been pushed. So pushing a state here evens the stacks. */
1503
- yyssp++;
1504
-
1505
- yysetstate:
1506
- *yyssp = yystate;
1507
-
1508
- if (yyss + yystacksize - 1 <= yyssp)
1509
- {
1510
- /* Get the current used size of the three stacks, in elements. */
1511
- YYSIZE_T yysize = yyssp - yyss + 1;
1512
-
1513
- #ifdef yyoverflow
1514
- {
1515
- /* Give user a chance to reallocate the stack. Use copies of
1516
- these so that the &'s don't force the real ones into
1517
- memory. */
1518
- YYSTYPE *yyvs1 = yyvs;
1519
- yytype_int16 *yyss1 = yyss;
1520
-
1521
-
1522
- /* Each stack pointer address is followed by the size of the
1523
- data in use in that stack, in bytes. This used to be a
1524
- conditional around just the two extra args, but that might
1525
- be undefined if yyoverflow is a macro. */
1526
- yyoverflow (YY_("memory exhausted"),
1527
- &yyss1, yysize * sizeof (*yyssp),
1528
- &yyvs1, yysize * sizeof (*yyvsp),
1529
-
1530
- &yystacksize);
1531
-
1532
- yyss = yyss1;
1533
- yyvs = yyvs1;
1534
- }
1535
- #else /* no yyoverflow */
1536
- # ifndef YYSTACK_RELOCATE
1537
- goto yyexhaustedlab;
1538
- # else
1539
- /* Extend the stack our own way. */
1540
- if (YYMAXDEPTH <= yystacksize)
1541
- goto yyexhaustedlab;
1542
- yystacksize *= 2;
1543
- if (YYMAXDEPTH < yystacksize)
1544
- yystacksize = YYMAXDEPTH;
1545
-
1546
- {
1547
- yytype_int16 *yyss1 = yyss;
1548
- union yyalloc *yyptr =
1549
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1550
- if (! yyptr)
1551
- goto yyexhaustedlab;
1552
- YYSTACK_RELOCATE (yyss);
1553
- YYSTACK_RELOCATE (yyvs);
1554
-
1555
- # undef YYSTACK_RELOCATE
1556
- if (yyss1 != yyssa)
1557
- YYSTACK_FREE (yyss1);
1558
- }
1559
- # endif
1560
- #endif /* no yyoverflow */
1561
-
1562
- yyssp = yyss + yysize - 1;
1563
- yyvsp = yyvs + yysize - 1;
1564
-
1565
-
1566
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1567
- (unsigned long int) yystacksize));
1568
-
1569
- if (yyss + yystacksize - 1 <= yyssp)
1570
- YYABORT;
1571
- }
1572
-
1573
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1574
-
1575
- goto yybackup;
1576
-
1577
- /*-----------.
1578
- | yybackup. |
1579
- `-----------*/
1580
- yybackup:
1581
-
1582
- /* Do appropriate processing given the current state. Read a
1583
- look-ahead token if we need one and don't already have one. */
1584
-
1585
- /* First try to decide what to do without reference to look-ahead token. */
1586
- yyn = yypact[yystate];
1587
- if (yyn == YYPACT_NINF)
1588
- goto yydefault;
1589
-
1590
- /* Not known => get a look-ahead token if don't already have one. */
1591
-
1592
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1593
- if (yychar == YYEMPTY)
1594
- {
1595
- YYDPRINTF ((stderr, "Reading a token: "));
1596
- yychar = YYLEX;
1597
- }
1598
-
1599
- if (yychar <= YYEOF)
1600
- {
1601
- yychar = yytoken = YYEOF;
1602
- YYDPRINTF ((stderr, "Now at end of input.\n"));
1603
- }
1604
- else
1605
- {
1606
- yytoken = YYTRANSLATE (yychar);
1607
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1608
- }
1609
-
1610
- /* If the proper action on seeing token YYTOKEN is to reduce or to
1611
- detect an error, take that action. */
1612
- yyn += yytoken;
1613
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1614
- goto yydefault;
1615
- yyn = yytable[yyn];
1616
- if (yyn <= 0)
1617
- {
1618
- if (yyn == 0 || yyn == YYTABLE_NINF)
1619
- goto yyerrlab;
1620
- yyn = -yyn;
1621
- goto yyreduce;
1622
- }
1623
-
1624
- if (yyn == YYFINAL)
1625
- YYACCEPT;
1626
-
1627
- /* Count tokens shifted since error; after three, turn off error
1628
- status. */
1629
- if (yyerrstatus)
1630
- yyerrstatus--;
1631
-
1632
- /* Shift the look-ahead token. */
1633
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1634
-
1635
- /* Discard the shifted token unless it is eof. */
1636
- if (yychar != YYEOF)
1637
- yychar = YYEMPTY;
1638
-
1639
- yystate = yyn;
1640
- *++yyvsp = yylval;
1641
-
1642
- goto yynewstate;
1643
-
1644
-
1645
- /*-----------------------------------------------------------.
1646
- | yydefault -- do the default action for the current state. |
1647
- `-----------------------------------------------------------*/
1648
- yydefault:
1649
- yyn = yydefact[yystate];
1650
- if (yyn == 0)
1651
- goto yyerrlab;
1652
- goto yyreduce;
1653
-
1654
-
1655
- /*-----------------------------.
1656
- | yyreduce -- Do a reduction. |
1657
- `-----------------------------*/
1658
- yyreduce:
1659
- /* yyn is the number of a rule to reduce with. */
1660
- yylen = yyr2[yyn];
1661
-
1662
- /* If YYLEN is nonzero, implement the default value of the action:
1663
- `$$ = $1'.
1664
-
1665
- Otherwise, the following line sets YYVAL to garbage.
1666
- This behavior is undocumented and Bison
1667
- users should not rely upon it. Assigning to YYVAL
1668
- unconditionally makes the parser a bit smaller, and it avoids a
1669
- GCC warning that YYVAL may be used uninitialized. */
1670
- yyval = yyvsp[1-yylen];
1671
-
1672
-
1673
- YY_REDUCE_PRINT (yyn);
1674
- switch (yyn)
1675
- {
1676
- case 2:
1677
- #line 72 "fst-compiler.yy"
1678
- { Result=result((yyvsp[(2) - (3)].expression), Switch); ;}
1679
- break;
1680
-
1681
- case 3:
1682
- #line 75 "fst-compiler.yy"
1683
- {;}
1684
- break;
1685
-
1686
- case 4:
1687
- #line 76 "fst-compiler.yy"
1688
- {;}
1689
- break;
1690
-
1691
- case 5:
1692
- #line 77 "fst-compiler.yy"
1693
- {;}
1694
- break;
1695
-
1696
- case 6:
1697
- #line 80 "fst-compiler.yy"
1698
- { if (def_var((yyvsp[(1) - (3)].name),(yyvsp[(3) - (3)].expression))) warn2("assignment of empty transducer to",(yyvsp[(1) - (3)].name)); ;}
1699
- break;
1700
-
1701
- case 7:
1702
- #line 81 "fst-compiler.yy"
1703
- { if (def_rvar((yyvsp[(1) - (3)].name),(yyvsp[(3) - (3)].expression))) warn2("assignment of empty transducer to",(yyvsp[(1) - (3)].name)); ;}
1704
- break;
1705
-
1706
- case 8:
1707
- #line 82 "fst-compiler.yy"
1708
- { if (def_svar((yyvsp[(1) - (3)].name),(yyvsp[(3) - (3)].range))) warn2("assignment of empty symbol range to",(yyvsp[(1) - (3)].name)); ;}
1709
- break;
1710
-
1711
- case 9:
1712
- #line 83 "fst-compiler.yy"
1713
- { if (def_svar((yyvsp[(1) - (3)].name),(yyvsp[(3) - (3)].range))) warn2("assignment of empty symbol range to",(yyvsp[(1) - (3)].name)); ;}
1714
- break;
1715
-
1716
- case 10:
1717
- #line 84 "fst-compiler.yy"
1718
- { write_to_file((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].value)); ;}
1719
- break;
1720
-
1721
- case 11:
1722
- #line 85 "fst-compiler.yy"
1723
- { def_alphabet((yyvsp[(2) - (2)].expression)); ;}
1724
- break;
1725
-
1726
- case 12:
1727
- #line 88 "fst-compiler.yy"
1728
- { (yyval.expression) = restriction((yyvsp[(1) - (3)].expression),(yyvsp[(2) - (3)].type),(yyvsp[(3) - (3)].contexts),0); ;}
1729
- break;
1730
-
1731
- case 13:
1732
- #line 89 "fst-compiler.yy"
1733
- { (yyval.expression) = restriction((yyvsp[(1) - (4)].expression),(yyvsp[(3) - (4)].type),(yyvsp[(4) - (4)].contexts),1); ;}
1734
- break;
1735
-
1736
- case 14:
1737
- #line 90 "fst-compiler.yy"
1738
- { (yyval.expression) = restriction((yyvsp[(1) - (4)].expression),(yyvsp[(3) - (4)].type),(yyvsp[(4) - (4)].contexts),-1); ;}
1739
- break;
1740
-
1741
- case 15:
1742
- #line 91 "fst-compiler.yy"
1743
- { (yyval.expression) = replace_in_context(minimise(explode((yyvsp[(1) - (3)].expression))),(yyvsp[(2) - (3)].rtype),(yyvsp[(3) - (3)].contexts),false); ;}
1744
- break;
1745
-
1746
- case 16:
1747
- #line 92 "fst-compiler.yy"
1748
- { (yyval.expression) = replace_in_context(minimise(explode((yyvsp[(1) - (4)].expression))),(yyvsp[(2) - (4)].rtype),(yyvsp[(4) - (4)].contexts),true);;}
1749
- break;
1750
-
1751
- case 17:
1752
- #line 93 "fst-compiler.yy"
1753
- { (yyval.expression) = replace(minimise(explode((yyvsp[(1) - (4)].expression))), (yyvsp[(2) - (4)].rtype), false); ;}
1754
- break;
1755
-
1756
- case 18:
1757
- #line 94 "fst-compiler.yy"
1758
- { (yyval.expression) = replace(minimise(explode((yyvsp[(1) - (5)].expression))), (yyvsp[(2) - (5)].rtype), true); ;}
1759
- break;
1760
-
1761
- case 19:
1762
- #line 95 "fst-compiler.yy"
1763
- { (yyval.expression) = make_rule((yyvsp[(1) - (5)].expression),(yyvsp[(2) - (5)].range),(yyvsp[(3) - (5)].type),(yyvsp[(4) - (5)].range),(yyvsp[(5) - (5)].expression)); ;}
1764
- break;
1765
-
1766
- case 20:
1767
- #line 96 "fst-compiler.yy"
1768
- { (yyval.expression) = make_rule((yyvsp[(1) - (4)].expression),(yyvsp[(2) - (4)].range),(yyvsp[(3) - (4)].type),(yyvsp[(4) - (4)].range),NULL); ;}
1769
- break;
1770
-
1771
- case 21:
1772
- #line 97 "fst-compiler.yy"
1773
- { (yyval.expression) = make_rule(NULL,(yyvsp[(1) - (4)].range),(yyvsp[(2) - (4)].type),(yyvsp[(3) - (4)].range),(yyvsp[(4) - (4)].expression)); ;}
1774
- break;
1775
-
1776
- case 22:
1777
- #line 98 "fst-compiler.yy"
1778
- { (yyval.expression) = make_rule(NULL,(yyvsp[(1) - (3)].range),(yyvsp[(2) - (3)].type),(yyvsp[(3) - (3)].range),NULL); ;}
1779
- break;
1780
-
1781
- case 23:
1782
- #line 99 "fst-compiler.yy"
1783
- { (yyval.expression) = composition((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); ;}
1784
- break;
1785
-
1786
- case 24:
1787
- #line 100 "fst-compiler.yy"
1788
- { (yyval.expression) = make_mapping((yyvsp[(2) - (7)].ranges),(yyvsp[(6) - (7)].ranges)); ;}
1789
- break;
1790
-
1791
- case 25:
1792
- #line 101 "fst-compiler.yy"
1793
- { (yyval.expression) = make_mapping(add_range((yyvsp[(1) - (5)].range),NULL),(yyvsp[(4) - (5)].ranges)); ;}
1794
- break;
1795
-
1796
- case 26:
1797
- #line 102 "fst-compiler.yy"
1798
- { (yyval.expression) = make_mapping((yyvsp[(2) - (5)].ranges),add_range((yyvsp[(5) - (5)].range),NULL)); ;}
1799
- break;
1800
-
1801
- case 27:
1802
- #line 103 "fst-compiler.yy"
1803
- { (yyval.expression) = freely_insert((yyvsp[(1) - (5)].expression), (yyvsp[(3) - (5)].character), (yyvsp[(5) - (5)].character)); ;}
1804
- break;
1805
-
1806
- case 28:
1807
- #line 104 "fst-compiler.yy"
1808
- { (yyval.expression) = freely_insert((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].character), (yyvsp[(3) - (3)].character)); ;}
1809
- break;
1810
-
1811
- case 29:
1812
- #line 105 "fst-compiler.yy"
1813
- { (yyval.expression) = new_transducer((yyvsp[(1) - (3)].range),(yyvsp[(3) - (3)].range)); ;}
1814
- break;
1815
-
1816
- case 30:
1817
- #line 106 "fst-compiler.yy"
1818
- { (yyval.expression) = new_transducer((yyvsp[(1) - (1)].range),(yyvsp[(1) - (1)].range)); ;}
1819
- break;
1820
-
1821
- case 31:
1822
- #line 107 "fst-compiler.yy"
1823
- { (yyval.expression) = var_value((yyvsp[(1) - (1)].name)); ;}
1824
- break;
1825
-
1826
- case 32:
1827
- #line 108 "fst-compiler.yy"
1828
- { (yyval.expression) = rvar_value((yyvsp[(1) - (1)].name)); ;}
1829
- break;
1830
-
1831
- case 33:
1832
- #line 109 "fst-compiler.yy"
1833
- { (yyval.expression) = repetition((yyvsp[(1) - (2)].expression)); ;}
1834
- break;
1835
-
1836
- case 34:
1837
- #line 110 "fst-compiler.yy"
1838
- { (yyval.expression) = repetition2((yyvsp[(1) - (2)].expression)); ;}
1839
- break;
1840
-
1841
- case 35:
1842
- #line 111 "fst-compiler.yy"
1843
- { (yyval.expression) = optional((yyvsp[(1) - (2)].expression)); ;}
1844
- break;
1845
-
1846
- case 36:
1847
- #line 112 "fst-compiler.yy"
1848
- { (yyval.expression) = catenate((yyvsp[(1) - (2)].expression), (yyvsp[(2) - (2)].expression)); ;}
1849
- break;
1850
-
1851
- case 37:
1852
- #line 113 "fst-compiler.yy"
1853
- { (yyval.expression) = negation((yyvsp[(2) - (2)].expression)); ;}
1854
- break;
1855
-
1856
- case 38:
1857
- #line 114 "fst-compiler.yy"
1858
- { (yyval.expression) = switch_levels((yyvsp[(2) - (2)].expression)); ;}
1859
- break;
1860
-
1861
- case 39:
1862
- #line 115 "fst-compiler.yy"
1863
- { (yyval.expression) = upper_level((yyvsp[(2) - (2)].expression)); ;}
1864
- break;
1865
-
1866
- case 40:
1867
- #line 116 "fst-compiler.yy"
1868
- { (yyval.expression) = lower_level((yyvsp[(2) - (2)].expression)); ;}
1869
- break;
1870
-
1871
- case 41:
1872
- #line 117 "fst-compiler.yy"
1873
- { (yyval.expression) = conjunction((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); ;}
1874
- break;
1875
-
1876
- case 42:
1877
- #line 118 "fst-compiler.yy"
1878
- { (yyval.expression) = subtraction((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); ;}
1879
- break;
1880
-
1881
- case 43:
1882
- #line 119 "fst-compiler.yy"
1883
- { (yyval.expression) = disjunction((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); ;}
1884
- break;
1885
-
1886
- case 44:
1887
- #line 120 "fst-compiler.yy"
1888
- { (yyval.expression) = (yyvsp[(2) - (3)].expression); ;}
1889
- break;
1890
-
1891
- case 45:
1892
- #line 121 "fst-compiler.yy"
1893
- { (yyval.expression) = read_words((yyvsp[(1) - (1)].value)); ;}
1894
- break;
1895
-
1896
- case 46:
1897
- #line 122 "fst-compiler.yy"
1898
- { (yyval.expression) = read_transducer((yyvsp[(1) - (1)].value)); ;}
1899
- break;
1900
-
1901
- case 47:
1902
- #line 125 "fst-compiler.yy"
1903
- { (yyval.ranges) = add_range((yyvsp[(1) - (2)].range),(yyvsp[(2) - (2)].ranges)); ;}
1904
- break;
1905
-
1906
- case 48:
1907
- #line 126 "fst-compiler.yy"
1908
- { (yyval.ranges) = NULL; ;}
1909
- break;
1910
-
1911
- case 49:
1912
- #line 129 "fst-compiler.yy"
1913
- { (yyval.range)=(yyvsp[(2) - (3)].range); ;}
1914
- break;
1915
-
1916
- case 50:
1917
- #line 130 "fst-compiler.yy"
1918
- { (yyval.range)=complement_range((yyvsp[(3) - (4)].range)); ;}
1919
- break;
1920
-
1921
- case 51:
1922
- #line 131 "fst-compiler.yy"
1923
- { (yyval.range)=rsvar_value((yyvsp[(2) - (3)].name)); ;}
1924
- break;
1925
-
1926
- case 52:
1927
- #line 132 "fst-compiler.yy"
1928
- { (yyval.range)=NULL; ;}
1929
- break;
1930
-
1931
- case 53:
1932
- #line 133 "fst-compiler.yy"
1933
- { (yyval.range)=add_value((yyvsp[(1) - (1)].character),NULL); ;}
1934
- break;
1935
-
1936
- case 54:
1937
- #line 136 "fst-compiler.yy"
1938
- { (yyval.contexts) = (yyvsp[(1) - (1)].contexts); ;}
1939
- break;
1940
-
1941
- case 55:
1942
- #line 137 "fst-compiler.yy"
1943
- { (yyval.contexts) = (yyvsp[(2) - (3)].contexts); ;}
1944
- break;
1945
-
1946
- case 56:
1947
- #line 140 "fst-compiler.yy"
1948
- { (yyval.contexts) = add_context((yyvsp[(1) - (3)].contexts),(yyvsp[(3) - (3)].contexts)); ;}
1949
- break;
1950
-
1951
- case 57:
1952
- #line 141 "fst-compiler.yy"
1953
- { (yyval.contexts) = (yyvsp[(1) - (1)].contexts); ;}
1954
- break;
1955
-
1956
- case 58:
1957
- #line 144 "fst-compiler.yy"
1958
- { (yyval.contexts) = (yyvsp[(1) - (1)].contexts); ;}
1959
- break;
1960
-
1961
- case 59:
1962
- #line 145 "fst-compiler.yy"
1963
- { (yyval.contexts) = (yyvsp[(2) - (3)].contexts); ;}
1964
- break;
1965
-
1966
- case 60:
1967
- #line 148 "fst-compiler.yy"
1968
- { (yyval.contexts) = make_context((yyvsp[(1) - (3)].expression), (yyvsp[(3) - (3)].expression)); ;}
1969
- break;
1970
-
1971
- case 61:
1972
- #line 149 "fst-compiler.yy"
1973
- { (yyval.contexts) = make_context(NULL, (yyvsp[(2) - (2)].expression)); ;}
1974
- break;
1975
-
1976
- case 62:
1977
- #line 150 "fst-compiler.yy"
1978
- { (yyval.contexts) = make_context((yyvsp[(1) - (2)].expression), NULL); ;}
1979
- break;
1980
-
1981
- case 63:
1982
- #line 153 "fst-compiler.yy"
1983
- { (yyval.range)=append_values((yyvsp[(1) - (2)].range),(yyvsp[(2) - (2)].range)); ;}
1984
- break;
1985
-
1986
- case 64:
1987
- #line 154 "fst-compiler.yy"
1988
- { (yyval.range) = (yyvsp[(1) - (1)].range); ;}
1989
- break;
1990
-
1991
- case 65:
1992
- #line 157 "fst-compiler.yy"
1993
- { (yyval.range)=add_values((yyvsp[(1) - (3)].longchar),(yyvsp[(3) - (3)].longchar),NULL); ;}
1994
- break;
1995
-
1996
- case 66:
1997
- #line 158 "fst-compiler.yy"
1998
- { (yyval.range)=svar_value((yyvsp[(1) - (1)].name)); ;}
1999
- break;
2000
-
2001
- case 67:
2002
- #line 159 "fst-compiler.yy"
2003
- { (yyval.range)=add_value(character_code((yyvsp[(1) - (1)].longchar)),NULL); ;}
2004
- break;
2005
-
2006
- case 68:
2007
- #line 160 "fst-compiler.yy"
2008
- { (yyval.range)=add_value((yyvsp[(1) - (1)].character),NULL); ;}
2009
- break;
2010
-
2011
- case 69:
2012
- #line 161 "fst-compiler.yy"
2013
- { (yyval.range)=add_value((yyvsp[(1) - (1)].uchar),NULL); ;}
2014
- break;
2015
-
2016
- case 70:
2017
- #line 164 "fst-compiler.yy"
2018
- { (yyval.longchar)=(yyvsp[(1) - (1)].uchar); ;}
2019
- break;
2020
-
2021
- case 71:
2022
- #line 165 "fst-compiler.yy"
2023
- { (yyval.longchar)=utf8toint((yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); ;}
2024
- break;
2025
-
2026
- case 72:
2027
- #line 166 "fst-compiler.yy"
2028
- { (yyval.longchar)=(yyvsp[(1) - (1)].uchar); ;}
2029
- break;
2030
-
2031
- case 73:
2032
- #line 169 "fst-compiler.yy"
2033
- { (yyval.character)=character_code((yyvsp[(1) - (1)].uchar)); ;}
2034
- break;
2035
-
2036
- case 74:
2037
- #line 170 "fst-compiler.yy"
2038
- { (yyval.character)=symbol_code((yyvsp[(1) - (1)].value)); ;}
2039
- break;
2040
-
2041
- case 75:
2042
- #line 171 "fst-compiler.yy"
2043
- { (yyval.character)=symbol_code((yyvsp[(1) - (1)].name)); ;}
2044
- break;
2045
-
2046
- case 76:
2047
- #line 174 "fst-compiler.yy"
2048
- { (yyval.uchar)=character_code('.'); ;}
2049
- break;
2050
-
2051
- case 77:
2052
- #line 175 "fst-compiler.yy"
2053
- { (yyval.uchar)=character_code('!'); ;}
2054
- break;
2055
-
2056
- case 78:
2057
- #line 176 "fst-compiler.yy"
2058
- { (yyval.uchar)=character_code('?'); ;}
2059
- break;
2060
-
2061
- case 79:
2062
- #line 177 "fst-compiler.yy"
2063
- { (yyval.uchar)=character_code('{'); ;}
2064
- break;
2065
-
2066
- case 80:
2067
- #line 178 "fst-compiler.yy"
2068
- { (yyval.uchar)=character_code('}'); ;}
2069
- break;
2070
-
2071
- case 81:
2072
- #line 179 "fst-compiler.yy"
2073
- { (yyval.uchar)=character_code(')'); ;}
2074
- break;
2075
-
2076
- case 82:
2077
- #line 180 "fst-compiler.yy"
2078
- { (yyval.uchar)=character_code('('); ;}
2079
- break;
2080
-
2081
- case 83:
2082
- #line 181 "fst-compiler.yy"
2083
- { (yyval.uchar)=character_code('&'); ;}
2084
- break;
2085
-
2086
- case 84:
2087
- #line 182 "fst-compiler.yy"
2088
- { (yyval.uchar)=character_code('|'); ;}
2089
- break;
2090
-
2091
- case 85:
2092
- #line 183 "fst-compiler.yy"
2093
- { (yyval.uchar)=character_code('*'); ;}
2094
- break;
2095
-
2096
- case 86:
2097
- #line 184 "fst-compiler.yy"
2098
- { (yyval.uchar)=character_code('+'); ;}
2099
- break;
2100
-
2101
- case 87:
2102
- #line 185 "fst-compiler.yy"
2103
- { (yyval.uchar)=character_code(':'); ;}
2104
- break;
2105
-
2106
- case 88:
2107
- #line 186 "fst-compiler.yy"
2108
- { (yyval.uchar)=character_code(','); ;}
2109
- break;
2110
-
2111
- case 89:
2112
- #line 187 "fst-compiler.yy"
2113
- { (yyval.uchar)=character_code('='); ;}
2114
- break;
2115
-
2116
- case 90:
2117
- #line 188 "fst-compiler.yy"
2118
- { (yyval.uchar)=character_code('_'); ;}
2119
- break;
2120
-
2121
- case 91:
2122
- #line 189 "fst-compiler.yy"
2123
- { (yyval.uchar)=character_code('^'); ;}
2124
- break;
2125
-
2126
- case 92:
2127
- #line 190 "fst-compiler.yy"
2128
- { (yyval.uchar)=character_code('-'); ;}
2129
- break;
2130
-
2131
- case 93:
2132
- #line 193 "fst-compiler.yy"
2133
- {;}
2134
- break;
2135
-
2136
- case 94:
2137
- #line 194 "fst-compiler.yy"
2138
- {;}
2139
- break;
2140
-
2141
-
2142
- /* Line 1267 of yacc.c. */
2143
- #line 2144 "fst-compiler.C"
2144
- default: break;
2145
- }
2146
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2147
-
2148
- YYPOPSTACK (yylen);
2149
- yylen = 0;
2150
- YY_STACK_PRINT (yyss, yyssp);
2151
-
2152
- *++yyvsp = yyval;
2153
-
2154
-
2155
- /* Now `shift' the result of the reduction. Determine what state
2156
- that goes to, based on the state we popped back to and the rule
2157
- number reduced by. */
2158
-
2159
- yyn = yyr1[yyn];
2160
-
2161
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2162
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2163
- yystate = yytable[yystate];
2164
- else
2165
- yystate = yydefgoto[yyn - YYNTOKENS];
2166
-
2167
- goto yynewstate;
2168
-
2169
-
2170
- /*------------------------------------.
2171
- | yyerrlab -- here on detecting error |
2172
- `------------------------------------*/
2173
- yyerrlab:
2174
- /* If not already recovering from an error, report this error. */
2175
- if (!yyerrstatus)
2176
- {
2177
- ++yynerrs;
2178
- #if ! YYERROR_VERBOSE
2179
- yyerror (YY_("syntax error"));
2180
- #else
2181
- {
2182
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2183
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2184
- {
2185
- YYSIZE_T yyalloc = 2 * yysize;
2186
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2187
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
2188
- if (yymsg != yymsgbuf)
2189
- YYSTACK_FREE (yymsg);
2190
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2191
- if (yymsg)
2192
- yymsg_alloc = yyalloc;
2193
- else
2194
- {
2195
- yymsg = yymsgbuf;
2196
- yymsg_alloc = sizeof yymsgbuf;
2197
- }
2198
- }
2199
-
2200
- if (0 < yysize && yysize <= yymsg_alloc)
2201
- {
2202
- (void) yysyntax_error (yymsg, yystate, yychar);
2203
- yyerror (yymsg);
2204
- }
2205
- else
2206
- {
2207
- yyerror (YY_("syntax error"));
2208
- if (yysize != 0)
2209
- goto yyexhaustedlab;
2210
- }
2211
- }
2212
- #endif
2213
- }
2214
-
2215
-
2216
-
2217
- if (yyerrstatus == 3)
2218
- {
2219
- /* If just tried and failed to reuse look-ahead token after an
2220
- error, discard it. */
2221
-
2222
- if (yychar <= YYEOF)
2223
- {
2224
- /* Return failure if at end of input. */
2225
- if (yychar == YYEOF)
2226
- YYABORT;
2227
- }
2228
- else
2229
- {
2230
- yydestruct ("Error: discarding",
2231
- yytoken, &yylval);
2232
- yychar = YYEMPTY;
2233
- }
2234
- }
2235
-
2236
- /* Else will try to reuse look-ahead token after shifting the error
2237
- token. */
2238
- goto yyerrlab1;
2239
-
2240
-
2241
- /*---------------------------------------------------.
2242
- | yyerrorlab -- error raised explicitly by YYERROR. |
2243
- `---------------------------------------------------*/
2244
- yyerrorlab:
2245
-
2246
- /* Pacify compilers like GCC when the user code never invokes
2247
- YYERROR and the label yyerrorlab therefore never appears in user
2248
- code. */
2249
- if (/*CONSTCOND*/ 0)
2250
- goto yyerrorlab;
2251
-
2252
- /* Do not reclaim the symbols of the rule which action triggered
2253
- this YYERROR. */
2254
- YYPOPSTACK (yylen);
2255
- yylen = 0;
2256
- YY_STACK_PRINT (yyss, yyssp);
2257
- yystate = *yyssp;
2258
- goto yyerrlab1;
2259
-
2260
-
2261
- /*-------------------------------------------------------------.
2262
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
2263
- `-------------------------------------------------------------*/
2264
- yyerrlab1:
2265
- yyerrstatus = 3; /* Each real token shifted decrements this. */
2266
-
2267
- for (;;)
2268
- {
2269
- yyn = yypact[yystate];
2270
- if (yyn != YYPACT_NINF)
2271
- {
2272
- yyn += YYTERROR;
2273
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2274
- {
2275
- yyn = yytable[yyn];
2276
- if (0 < yyn)
2277
- break;
2278
- }
2279
- }
2280
-
2281
- /* Pop the current state because it cannot handle the error token. */
2282
- if (yyssp == yyss)
2283
- YYABORT;
2284
-
2285
-
2286
- yydestruct ("Error: popping",
2287
- yystos[yystate], yyvsp);
2288
- YYPOPSTACK (1);
2289
- yystate = *yyssp;
2290
- YY_STACK_PRINT (yyss, yyssp);
2291
- }
2292
-
2293
- if (yyn == YYFINAL)
2294
- YYACCEPT;
2295
-
2296
- *++yyvsp = yylval;
2297
-
2298
-
2299
- /* Shift the error token. */
2300
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2301
-
2302
- yystate = yyn;
2303
- goto yynewstate;
2304
-
2305
-
2306
- /*-------------------------------------.
2307
- | yyacceptlab -- YYACCEPT comes here. |
2308
- `-------------------------------------*/
2309
- yyacceptlab:
2310
- yyresult = 0;
2311
- goto yyreturn;
2312
-
2313
- /*-----------------------------------.
2314
- | yyabortlab -- YYABORT comes here. |
2315
- `-----------------------------------*/
2316
- yyabortlab:
2317
- yyresult = 1;
2318
- goto yyreturn;
2319
-
2320
- #ifndef yyoverflow
2321
- /*-------------------------------------------------.
2322
- | yyexhaustedlab -- memory exhaustion comes here. |
2323
- `-------------------------------------------------*/
2324
- yyexhaustedlab:
2325
- yyerror (YY_("memory exhausted"));
2326
- yyresult = 2;
2327
- /* Fall through. */
2328
- #endif
2329
-
2330
- yyreturn:
2331
- if (yychar != YYEOF && yychar != YYEMPTY)
2332
- yydestruct ("Cleanup: discarding lookahead",
2333
- yytoken, &yylval);
2334
- /* Do not reclaim the symbols of the rule which action triggered
2335
- this YYABORT or YYACCEPT. */
2336
- YYPOPSTACK (yylen);
2337
- YY_STACK_PRINT (yyss, yyssp);
2338
- while (yyssp != yyss)
2339
- {
2340
- yydestruct ("Cleanup: popping",
2341
- yystos[*yyssp], yyvsp);
2342
- YYPOPSTACK (1);
2343
- }
2344
- #ifndef yyoverflow
2345
- if (yyss != yyssa)
2346
- YYSTACK_FREE (yyss);
2347
- #endif
2348
- #if YYERROR_VERBOSE
2349
- if (yymsg != yymsgbuf)
2350
- YYSTACK_FREE (yymsg);
2351
- #endif
2352
- /* Make sure YYID is used. */
2353
- return YYID (yyresult);
2354
- }
2355
-
2356
-
2357
- #line 197 "fst-compiler.yy"
2358
-
2359
-
2360
- extern FILE *yyin;
2361
- static int Compact=0;
2362
- static int LowMem=0;
2363
-
2364
- /*******************************************************************/
2365
- /* */
2366
- /* yyerror */
2367
- /* */
2368
- /*******************************************************************/
2369
-
2370
- void yyerror(char *text)
2371
-
2372
- {
2373
- cerr << "\n" << FileName << ":" << yylineno << ": " << text << " at: ";
2374
- cerr << yytext << "\naborted.\n";
2375
- exit(1);
2376
- }
2377
-
2378
-
2379
- /*******************************************************************/
2380
- /* */
2381
- /* warn */
2382
- /* */
2383
- /*******************************************************************/
2384
-
2385
- void warn(char *text)
2386
-
2387
- {
2388
- cerr << "\n" << FileName << ":" << yylineno << ": warning: " << text << "!\n";
2389
- }
2390
-
2391
-
2392
- /*******************************************************************/
2393
- /* */
2394
- /* warn2 */
2395
- /* */
2396
- /*******************************************************************/
2397
-
2398
- void warn2(char *text, char *text2)
2399
-
2400
- {
2401
- cerr << "\n" << FileName << ":" << yylineno << ": warning: " << text << ": ";
2402
- cerr << text2 << "\n";
2403
- }
2404
-
2405
-
2406
- /*******************************************************************/
2407
- /* */
2408
- /* get_flags */
2409
- /* */
2410
- /*******************************************************************/
2411
-
2412
- void get_flags( int *argc, char **argv )
2413
-
2414
- {
2415
- for( int i=1; i<*argc; i++ ) {
2416
- if (strcmp(argv[i],"-c") == 0) {
2417
- Compact = 1;
2418
- argv[i] = NULL;
2419
- }
2420
- else if (strcmp(argv[i],"-l") == 0) {
2421
- LowMem = 1;
2422
- argv[i] = NULL;
2423
- }
2424
- else if (strcmp(argv[i],"-q") == 0) {
2425
- Verbose = 0;
2426
- argv[i] = NULL;
2427
- }
2428
- else if (strcmp(argv[i],"-s") == 0) {
2429
- Switch = 1;
2430
- argv[i] = NULL;
2431
- }
2432
- }
2433
- // remove flags from the argument list
2434
- int k;
2435
- for( int i=k=1; i<*argc; i++)
2436
- if (argv[i] != NULL)
2437
- argv[k++] = argv[i];
2438
- *argc = k;
2439
- }
2440
-
2441
-
2442
- /*******************************************************************/
2443
- /* */
2444
- /* main */
2445
- /* */
2446
- /*******************************************************************/
2447
-
2448
- int main( int argc, char *argv[] )
2449
-
2450
- {
2451
- FILE *file;
2452
-
2453
- get_flags(&argc, argv);
2454
- if (argc < 3) {
2455
- fprintf(stderr,"\nUsage: %s [options] infile outfile\n", argv[0]);
2456
- fprintf(stderr,"\nOPTIONS:\n");
2457
- fprintf(stderr,"-c\tStore the transducer in fst-infl2 format.\n");
2458
- fprintf(stderr,"-l\tStore the transducer in fst-infl3 format.\n");
2459
- fprintf(stderr,"-s\tSwitch the upper and lower levels producing a transducer for generation rather than recognition.\n");
2460
- fprintf(stderr,"-q\tquiet mode\n\n");
2461
- exit(1);
2462
- }
2463
- if ((file = fopen(argv[1],"rt")) == NULL) {
2464
- fprintf(stderr,"\nError: Cannot open grammar file \"%s\"\n\n", argv[1]);
2465
- exit(1);
2466
- }
2467
- FileName = argv[1];
2468
- Result = NULL;
2469
- TheAlphabet.utf8 = UTF8;
2470
- yyin = file;
2471
- try {
2472
- yyparse();
2473
- Result->alphabet.utf8 = UTF8;
2474
- if (Verbose)
2475
- cerr << "\n";
2476
- if (Result->is_empty())
2477
- warn("resulting transducer is empty");
2478
- if ((file = fopen(argv[2],"wb")) == NULL) {
2479
- fprintf(stderr,"\nError: Cannot open output file %s\n\n", argv[2]);
2480
- exit(1);
2481
- }
2482
- if (Compact) {
2483
- MakeCompactTransducer ca(*Result);
2484
- delete Result;
2485
- ca.store(file);
2486
- }
2487
- else if (LowMem)
2488
- Result->store_lowmem(file);
2489
- else
2490
- Result->store(file);
2491
- fclose(file);
2492
- }
2493
- catch(const char* p) {
2494
- cerr << "\n" << p << "\n\n";
2495
- exit(1);
2496
- }
2497
- }
2498
-