ruby-sfst 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +1 -0
- data/Manifest +1 -0
- data/README.rdoc +2 -0
- data/Rakefile +1 -1
- data/ext/sfst_machine/alphabet.C +18 -14
- data/ext/sfst_machine/alphabet.h +10 -19
- data/ext/sfst_machine/compact.C +2 -2
- data/ext/sfst_machine/determinise.C +0 -1
- data/ext/sfst_machine/extconf.rb +1 -1
- data/ext/sfst_machine/fst-compiler.C +127 -4
- data/ext/sfst_machine/fst-compiler.h +2 -2
- data/ext/sfst_machine/fst-compiler.yy +3 -3
- data/ext/sfst_machine/fst.C +54 -20
- data/ext/sfst_machine/fst.h +15 -11
- data/ext/sfst_machine/interface.C +62 -58
- data/ext/sfst_machine/interface.h +0 -1
- data/ext/sfst_machine/make-compact.C +0 -1
- data/ext/sfst_machine/sfst_machine.cc +0 -1
- data/ext/sfst_machine/sgi.h +44 -0
- data/ext/sfst_machine/utf8-scanner.C +73 -91
- data/ext/sfst_machine/utf8-scanner.ll +24 -28
- data/ruby-sfst.gemspec +8 -6
- metadata +5 -4
@@ -9,7 +9,7 @@
|
|
9
9
|
#define FLEX_SCANNER
|
10
10
|
#define YY_FLEX_MAJOR_VERSION 2
|
11
11
|
#define YY_FLEX_MINOR_VERSION 5
|
12
|
-
#define YY_FLEX_SUBMINOR_VERSION
|
12
|
+
#define YY_FLEX_SUBMINOR_VERSION 33
|
13
13
|
#if YY_FLEX_SUBMINOR_VERSION > 0
|
14
14
|
#define FLEX_BETA
|
15
15
|
#endif
|
@@ -31,7 +31,7 @@
|
|
31
31
|
|
32
32
|
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
33
33
|
|
34
|
-
#if
|
34
|
+
#if __STDC_VERSION__ >= 199901L
|
35
35
|
|
36
36
|
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
37
37
|
* if you want the limit (max/min) macros for int types.
|
@@ -94,12 +94,11 @@ typedef unsigned int flex_uint32_t;
|
|
94
94
|
|
95
95
|
#else /* ! __cplusplus */
|
96
96
|
|
97
|
-
|
98
|
-
#if defined (__STDC__)
|
97
|
+
#if __STDC__
|
99
98
|
|
100
99
|
#define YY_USE_CONST
|
101
100
|
|
102
|
-
#endif /*
|
101
|
+
#endif /* __STDC__ */
|
103
102
|
#endif /* ! __cplusplus */
|
104
103
|
|
105
104
|
#ifdef YY_USE_CONST
|
@@ -195,13 +194,11 @@ extern FILE *yyin, *yyout;
|
|
195
194
|
/* The following is because we cannot portably get our hands on size_t
|
196
195
|
* (without autoconf's help, which isn't available because we want
|
197
196
|
* flex-generated scanners to compile on their own).
|
198
|
-
* Given that the standard has decreed that size_t exists since 1989,
|
199
|
-
* I guess we can afford to depend on it. Manoj.
|
200
197
|
*/
|
201
198
|
|
202
199
|
#ifndef YY_TYPEDEF_YY_SIZE_T
|
203
200
|
#define YY_TYPEDEF_YY_SIZE_T
|
204
|
-
typedef
|
201
|
+
typedef unsigned int yy_size_t;
|
205
202
|
#endif
|
206
203
|
|
207
204
|
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
@@ -683,7 +680,7 @@ static void print_lineno() {
|
|
683
680
|
|
684
681
|
extern void yyerror(char *text);
|
685
682
|
|
686
|
-
#line
|
683
|
+
#line 684 "utf8-scanner.C"
|
687
684
|
|
688
685
|
#define INITIAL 0
|
689
686
|
#define incl 1
|
@@ -744,7 +741,7 @@ static int input (void );
|
|
744
741
|
/* This used to be an fputs(), but since the string might contain NUL's,
|
745
742
|
* we now use fwrite().
|
746
743
|
*/
|
747
|
-
#define ECHO fwrite( yytext, yyleng, 1, yyout )
|
744
|
+
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
|
748
745
|
#endif
|
749
746
|
|
750
747
|
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
@@ -755,7 +752,7 @@ static int input (void );
|
|
755
752
|
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
756
753
|
{ \
|
757
754
|
int c = '*'; \
|
758
|
-
|
755
|
+
size_t n; \
|
759
756
|
for ( n = 0; n < max_size && \
|
760
757
|
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
761
758
|
buf[n] = (char) c; \
|
@@ -843,7 +840,7 @@ YY_DECL
|
|
843
840
|
#line 71 "utf8-scanner.ll"
|
844
841
|
|
845
842
|
|
846
|
-
#line
|
843
|
+
#line 844 "utf8-scanner.C"
|
847
844
|
|
848
845
|
if ( !(yy_init) )
|
849
846
|
{
|
@@ -954,162 +951,159 @@ YY_RULE_SETUP
|
|
954
951
|
{ /* got the include file name */
|
955
952
|
FILE *file;
|
956
953
|
char *name=unquote(yytext);
|
957
|
-
if ( Include_Stack_Ptr >= MAX_INCLUDE_DEPTH )
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
}
|
954
|
+
if ( Include_Stack_Ptr >= MAX_INCLUDE_DEPTH ) {
|
955
|
+
fprintf( stderr, "Includes nested too deeply" );
|
956
|
+
exit( 1 );
|
957
|
+
}
|
962
958
|
if (Verbose) fputc('\n', stderr);
|
963
959
|
file = fopen( name, "rt" );
|
964
960
|
if (!file)
|
965
|
-
error2("Can't open include file",name);
|
966
|
-
else
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
}
|
961
|
+
error2("Can't open include file", name);
|
962
|
+
else {
|
963
|
+
Name_Stack[Include_Stack_Ptr] = FileName;
|
964
|
+
FileName = name;
|
965
|
+
Lineno_Stack[Include_Stack_Ptr] = yylineno;
|
966
|
+
yylineno = 1;
|
967
|
+
Include_Stack[Include_Stack_Ptr++]=YY_CURRENT_BUFFER;
|
968
|
+
yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
|
969
|
+
yyin = file;
|
970
|
+
print_lineno();
|
971
|
+
BEGIN(INITIAL);
|
972
|
+
}
|
978
973
|
}
|
979
974
|
YY_BREAK
|
980
975
|
case YY_STATE_EOF(INITIAL):
|
981
976
|
case YY_STATE_EOF(incl):
|
982
|
-
#line
|
977
|
+
#line 99 "utf8-scanner.ll"
|
983
978
|
{
|
984
979
|
if (Verbose)
|
985
980
|
fputc('\n', stderr);
|
986
981
|
if ( --Include_Stack_Ptr < 0 )
|
987
982
|
yyterminate();
|
988
|
-
else
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
}
|
983
|
+
else {
|
984
|
+
free(FileName);
|
985
|
+
FileName = Name_Stack[Include_Stack_Ptr];
|
986
|
+
yylineno = Lineno_Stack[Include_Stack_Ptr];
|
987
|
+
yy_delete_buffer(YY_CURRENT_BUFFER );
|
988
|
+
yy_switch_to_buffer(Include_Stack[Include_Stack_Ptr]);
|
989
|
+
}
|
996
990
|
}
|
997
991
|
YY_BREAK
|
998
992
|
case 5:
|
999
993
|
/* rule 5 can match eol */
|
1000
994
|
YY_RULE_SETUP
|
1001
|
-
#line
|
995
|
+
#line 114 "utf8-scanner.ll"
|
1002
996
|
{ print_lineno(); /* ignore comments */ }
|
1003
997
|
YY_BREAK
|
1004
998
|
case 6:
|
1005
999
|
/* rule 6 can match eol */
|
1006
1000
|
YY_RULE_SETUP
|
1007
|
-
#line
|
1001
|
+
#line 116 "utf8-scanner.ll"
|
1008
1002
|
{ print_lineno(); /* ignore comments */ }
|
1009
1003
|
YY_BREAK
|
1010
1004
|
case 7:
|
1011
1005
|
YY_RULE_SETUP
|
1012
|
-
#line
|
1006
|
+
#line 118 "utf8-scanner.ll"
|
1013
1007
|
{ /* ignore comments */ }
|
1014
1008
|
YY_BREAK
|
1015
1009
|
case 8:
|
1016
1010
|
YY_RULE_SETUP
|
1017
|
-
#line
|
1011
|
+
#line 121 "utf8-scanner.ll"
|
1018
1012
|
{ return ALPHA; }
|
1019
1013
|
YY_BREAK
|
1020
1014
|
case 9:
|
1021
1015
|
YY_RULE_SETUP
|
1022
|
-
#line
|
1016
|
+
#line 123 "utf8-scanner.ll"
|
1023
1017
|
{ return COMPOSE; }
|
1024
1018
|
YY_BREAK
|
1025
1019
|
case 10:
|
1026
1020
|
YY_RULE_SETUP
|
1027
|
-
#line
|
1021
|
+
#line 124 "utf8-scanner.ll"
|
1028
1022
|
{ yylval.type = twol_both; return ARROW; }
|
1029
1023
|
YY_BREAK
|
1030
1024
|
case 11:
|
1031
1025
|
YY_RULE_SETUP
|
1032
|
-
#line
|
1026
|
+
#line 125 "utf8-scanner.ll"
|
1033
1027
|
{ yylval.type = twol_right;return ARROW; }
|
1034
1028
|
YY_BREAK
|
1035
1029
|
case 12:
|
1036
1030
|
YY_RULE_SETUP
|
1037
|
-
#line
|
1031
|
+
#line 126 "utf8-scanner.ll"
|
1038
1032
|
{ yylval.type = twol_left; return ARROW; }
|
1039
1033
|
YY_BREAK
|
1040
1034
|
case 13:
|
1041
1035
|
YY_RULE_SETUP
|
1042
|
-
#line
|
1036
|
+
#line 127 "utf8-scanner.ll"
|
1043
1037
|
{ yylval.rtype = repl_up; return REPLACE; }
|
1044
1038
|
YY_BREAK
|
1045
1039
|
case 14:
|
1046
1040
|
YY_RULE_SETUP
|
1047
|
-
#line
|
1041
|
+
#line 128 "utf8-scanner.ll"
|
1048
1042
|
{ yylval.rtype = repl_down; return REPLACE; }
|
1049
1043
|
YY_BREAK
|
1050
1044
|
case 15:
|
1051
1045
|
YY_RULE_SETUP
|
1052
|
-
#line
|
1046
|
+
#line 129 "utf8-scanner.ll"
|
1053
1047
|
{ yylval.rtype = repl_right;return REPLACE; }
|
1054
1048
|
YY_BREAK
|
1055
1049
|
case 16:
|
1056
1050
|
YY_RULE_SETUP
|
1057
|
-
#line
|
1051
|
+
#line 130 "utf8-scanner.ll"
|
1058
1052
|
{ yylval.rtype = repl_left; return REPLACE; }
|
1059
1053
|
YY_BREAK
|
1060
1054
|
case 17:
|
1061
1055
|
YY_RULE_SETUP
|
1062
|
-
#line
|
1056
|
+
#line 131 "utf8-scanner.ll"
|
1063
1057
|
{ return PRINT; }
|
1064
1058
|
YY_BREAK
|
1065
1059
|
case 18:
|
1066
1060
|
YY_RULE_SETUP
|
1067
|
-
#line
|
1061
|
+
#line 132 "utf8-scanner.ll"
|
1068
1062
|
{ return INSERT; }
|
1069
1063
|
YY_BREAK
|
1070
1064
|
case 19:
|
1071
1065
|
YY_RULE_SETUP
|
1072
|
-
#line
|
1066
|
+
#line 133 "utf8-scanner.ll"
|
1073
1067
|
{ return POS; }
|
1074
1068
|
YY_BREAK
|
1075
1069
|
case 20:
|
1076
1070
|
YY_RULE_SETUP
|
1077
|
-
#line
|
1078
|
-
{ return
|
1071
|
+
#line 134 "utf8-scanner.ll"
|
1072
|
+
{ return SWITCH; }
|
1079
1073
|
YY_BREAK
|
1080
1074
|
case 21:
|
1081
1075
|
YY_RULE_SETUP
|
1082
|
-
#line
|
1076
|
+
#line 136 "utf8-scanner.ll"
|
1083
1077
|
{ return yytext[0]; }
|
1084
1078
|
YY_BREAK
|
1085
1079
|
case 22:
|
1086
1080
|
YY_RULE_SETUP
|
1087
|
-
#line
|
1081
|
+
#line 138 "utf8-scanner.ll"
|
1088
1082
|
{ yylval.name = fst_strdup(yytext); return RVAR; }
|
1089
1083
|
YY_BREAK
|
1090
1084
|
case 23:
|
1091
1085
|
YY_RULE_SETUP
|
1092
|
-
#line
|
1086
|
+
#line 140 "utf8-scanner.ll"
|
1093
1087
|
{ yylval.name = fst_strdup(yytext); return VAR; }
|
1094
1088
|
YY_BREAK
|
1095
1089
|
case 24:
|
1096
1090
|
YY_RULE_SETUP
|
1097
|
-
#line
|
1091
|
+
#line 142 "utf8-scanner.ll"
|
1098
1092
|
{ yylval.name = fst_strdup(yytext); return RSVAR; }
|
1099
1093
|
YY_BREAK
|
1100
1094
|
case 25:
|
1101
1095
|
YY_RULE_SETUP
|
1102
|
-
#line
|
1096
|
+
#line 144 "utf8-scanner.ll"
|
1103
1097
|
{ yylval.name = fst_strdup(yytext); return SVAR; }
|
1104
1098
|
YY_BREAK
|
1105
1099
|
case 26:
|
1106
1100
|
YY_RULE_SETUP
|
1107
|
-
#line
|
1101
|
+
#line 146 "utf8-scanner.ll"
|
1108
1102
|
{ yylval.name = unquote(yytext,false); return SYMBOL; }
|
1109
1103
|
YY_BREAK
|
1110
1104
|
case 27:
|
1111
1105
|
YY_RULE_SETUP
|
1112
|
-
#line
|
1106
|
+
#line 148 "utf8-scanner.ll"
|
1113
1107
|
{
|
1114
1108
|
yylval.value = unquote(yytext)+1;
|
1115
1109
|
yylval.value[strlen(yylval.value)-1] = 0;
|
@@ -1118,7 +1112,7 @@ YY_RULE_SETUP
|
|
1118
1112
|
YY_BREAK
|
1119
1113
|
case 28:
|
1120
1114
|
YY_RULE_SETUP
|
1121
|
-
#line
|
1115
|
+
#line 154 "utf8-scanner.ll"
|
1122
1116
|
{
|
1123
1117
|
yylval.value = unquote(yytext);
|
1124
1118
|
return STRING;
|
@@ -1126,24 +1120,24 @@ YY_RULE_SETUP
|
|
1126
1120
|
YY_BREAK
|
1127
1121
|
case 29:
|
1128
1122
|
YY_RULE_SETUP
|
1129
|
-
#line
|
1123
|
+
#line 159 "utf8-scanner.ll"
|
1130
1124
|
{ /* ignored */ }
|
1131
1125
|
YY_BREAK
|
1132
1126
|
case 30:
|
1133
1127
|
/* rule 30 can match eol */
|
1134
1128
|
YY_RULE_SETUP
|
1135
|
-
#line
|
1129
|
+
#line 160 "utf8-scanner.ll"
|
1136
1130
|
{ print_lineno(); /* ignored */ }
|
1137
1131
|
YY_BREAK
|
1138
1132
|
case 31:
|
1139
1133
|
/* rule 31 can match eol */
|
1140
1134
|
YY_RULE_SETUP
|
1141
|
-
#line
|
1135
|
+
#line 161 "utf8-scanner.ll"
|
1142
1136
|
{ print_lineno(); return NEWLINE; }
|
1143
1137
|
YY_BREAK
|
1144
1138
|
case 32:
|
1145
1139
|
YY_RULE_SETUP
|
1146
|
-
#line
|
1140
|
+
#line 163 "utf8-scanner.ll"
|
1147
1141
|
{ long l=atol(yytext+1);
|
1148
1142
|
if (l <= 1114112) { yylval.uchar=l; return CHARACTER; }
|
1149
1143
|
yyerror("invalid expression");
|
@@ -1151,36 +1145,36 @@ YY_RULE_SETUP
|
|
1151
1145
|
YY_BREAK
|
1152
1146
|
case 33:
|
1153
1147
|
YY_RULE_SETUP
|
1154
|
-
#line
|
1148
|
+
#line 169 "utf8-scanner.ll"
|
1155
1149
|
{ yylval.value=fst_strdup(yytext+1); return UTF8CHAR; }
|
1156
1150
|
YY_BREAK
|
1157
1151
|
case 34:
|
1158
1152
|
/* rule 34 can match eol */
|
1159
1153
|
YY_RULE_SETUP
|
1160
|
-
#line
|
1154
|
+
#line 170 "utf8-scanner.ll"
|
1161
1155
|
{ yylval.value=fst_strdup(yytext); return UTF8CHAR; }
|
1162
1156
|
YY_BREAK
|
1163
1157
|
case 35:
|
1164
1158
|
YY_RULE_SETUP
|
1165
|
-
#line
|
1159
|
+
#line 171 "utf8-scanner.ll"
|
1166
1160
|
{ yylval.value=fst_strdup(yytext); return UTF8CHAR; }
|
1167
1161
|
YY_BREAK
|
1168
1162
|
case 36:
|
1169
1163
|
YY_RULE_SETUP
|
1170
|
-
#line
|
1164
|
+
#line 172 "utf8-scanner.ll"
|
1171
1165
|
{ yylval.value=fst_strdup(yytext); return UTF8CHAR; }
|
1172
1166
|
YY_BREAK
|
1173
1167
|
case 37:
|
1174
1168
|
YY_RULE_SETUP
|
1175
|
-
#line
|
1169
|
+
#line 173 "utf8-scanner.ll"
|
1176
1170
|
{ yylval.value=fst_strdup(yytext); return UTF8CHAR; }
|
1177
1171
|
YY_BREAK
|
1178
1172
|
case 38:
|
1179
1173
|
YY_RULE_SETUP
|
1180
|
-
#line
|
1174
|
+
#line 175 "utf8-scanner.ll"
|
1181
1175
|
ECHO;
|
1182
1176
|
YY_BREAK
|
1183
|
-
#line
|
1177
|
+
#line 1178 "utf8-scanner.C"
|
1184
1178
|
|
1185
1179
|
case YY_END_OF_BUFFER:
|
1186
1180
|
{
|
@@ -1410,7 +1404,7 @@ static int yy_get_next_buffer (void)
|
|
1410
1404
|
|
1411
1405
|
/* Read in more data. */
|
1412
1406
|
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
|
1413
|
-
(yy_n_chars),
|
1407
|
+
(yy_n_chars), num_to_read );
|
1414
1408
|
|
1415
1409
|
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
|
1416
1410
|
}
|
@@ -1434,14 +1428,6 @@ static int yy_get_next_buffer (void)
|
|
1434
1428
|
else
|
1435
1429
|
ret_val = EOB_ACT_CONTINUE_SCAN;
|
1436
1430
|
|
1437
|
-
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
|
1438
|
-
/* Extend the array by 50%, plus the number we really need. */
|
1439
|
-
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
|
1440
|
-
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
|
1441
|
-
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
|
1442
|
-
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
|
1443
|
-
}
|
1444
|
-
|
1445
1431
|
(yy_n_chars) += number_to_move;
|
1446
1432
|
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
|
1447
1433
|
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
|
@@ -1868,9 +1854,7 @@ static void yyensure_buffer_stack (void)
|
|
1868
1854
|
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
|
1869
1855
|
(num_to_alloc * sizeof(struct yy_buffer_state*)
|
1870
1856
|
);
|
1871
|
-
|
1872
|
-
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
1873
|
-
|
1857
|
+
|
1874
1858
|
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
1875
1859
|
|
1876
1860
|
(yy_buffer_stack_max) = num_to_alloc;
|
@@ -1888,8 +1872,6 @@ static void yyensure_buffer_stack (void)
|
|
1888
1872
|
((yy_buffer_stack),
|
1889
1873
|
num_to_alloc * sizeof(struct yy_buffer_state*)
|
1890
1874
|
);
|
1891
|
-
if ( ! (yy_buffer_stack) )
|
1892
|
-
YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
|
1893
1875
|
|
1894
1876
|
/* zero only the new slots.*/
|
1895
1877
|
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
|
@@ -1934,7 +1916,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
|
|
1934
1916
|
|
1935
1917
|
/** Setup the input buffer state to scan a string. The next call to yylex() will
|
1936
1918
|
* scan from a @e copy of @a str.
|
1937
|
-
* @param
|
1919
|
+
* @param str a NUL-terminated string to scan
|
1938
1920
|
*
|
1939
1921
|
* @return the newly allocated buffer state object.
|
1940
1922
|
* @note If you want to scan bytes that may contain NUL values, then use
|
@@ -2191,7 +2173,7 @@ void yyfree (void * ptr )
|
|
2191
2173
|
|
2192
2174
|
#define YYTABLES_NAME "yytables"
|
2193
2175
|
|
2194
|
-
#line
|
2176
|
+
#line 175 "utf8-scanner.ll"
|
2195
2177
|
|
2196
2178
|
|
2197
2179
|
|
@@ -76,42 +76,38 @@ FN [A-Za-z0-9._/\-*+]
|
|
76
76
|
<incl>\"{FN}+\" { /* got the include file name */
|
77
77
|
FILE *file;
|
78
78
|
char *name=unquote(yytext);
|
79
|
-
if ( Include_Stack_Ptr >= MAX_INCLUDE_DEPTH )
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
79
|
+
if ( Include_Stack_Ptr >= MAX_INCLUDE_DEPTH ) {
|
80
|
+
fprintf( stderr, "Includes nested too deeply" );
|
81
|
+
exit( 1 );
|
82
|
+
}
|
84
83
|
if (Verbose) fputc('\n', stderr);
|
85
84
|
file = fopen( name, "rt" );
|
86
85
|
if (!file)
|
87
|
-
error2("Can't open include file",name);
|
88
|
-
else
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
BEGIN(INITIAL);
|
100
|
-
}
|
86
|
+
error2("Can't open include file", name);
|
87
|
+
else {
|
88
|
+
Name_Stack[Include_Stack_Ptr] = FileName;
|
89
|
+
FileName = name;
|
90
|
+
Lineno_Stack[Include_Stack_Ptr] = yylineno;
|
91
|
+
yylineno = 1;
|
92
|
+
Include_Stack[Include_Stack_Ptr++]=YY_CURRENT_BUFFER;
|
93
|
+
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
|
94
|
+
yyin = file;
|
95
|
+
print_lineno();
|
96
|
+
BEGIN(INITIAL);
|
97
|
+
}
|
101
98
|
}
|
102
99
|
<<EOF>> {
|
103
100
|
if (Verbose)
|
104
101
|
fputc('\n', stderr);
|
105
102
|
if ( --Include_Stack_Ptr < 0 )
|
106
103
|
yyterminate();
|
107
|
-
else
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
}
|
104
|
+
else {
|
105
|
+
free(FileName);
|
106
|
+
FileName = Name_Stack[Include_Stack_Ptr];
|
107
|
+
yylineno = Lineno_Stack[Include_Stack_Ptr];
|
108
|
+
yy_delete_buffer( YY_CURRENT_BUFFER );
|
109
|
+
yy_switch_to_buffer(Include_Stack[Include_Stack_Ptr]);
|
110
|
+
}
|
115
111
|
}
|
116
112
|
|
117
113
|
|
@@ -135,7 +131,7 @@ FN [A-Za-z0-9._/\-*+]
|
|
135
131
|
">>" { return PRINT; }
|
136
132
|
"<<" { return INSERT; }
|
137
133
|
"__" { return POS; }
|
138
|
-
"^_" { return
|
134
|
+
"^_" { return SWITCH; }
|
139
135
|
|
140
136
|
[.,{}\[\]()&!?|*+:=_\^\-] { return yytext[0]; }
|
141
137
|
|
data/ruby-sfst.gemspec
CHANGED
@@ -1,21 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = %q{ruby-sfst}
|
3
|
-
s.version = "0.
|
5
|
+
s.version = "0.2.0"
|
4
6
|
|
5
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
6
8
|
s.authors = ["Marius L. J\303\270hndal"]
|
7
|
-
s.date = %q{
|
9
|
+
s.date = %q{2009-02-09}
|
8
10
|
s.description = %q{A wrapper for the Stuttgart Finite State Transducer Tools (SFST).}
|
9
11
|
s.email = %q{mariuslj (at) ifi [dot] uio (dot) no}
|
10
12
|
s.extensions = ["ext/sfst_machine/extconf.rb"]
|
11
13
|
s.extra_rdoc_files = ["README.rdoc", "lib/sfst.rb"]
|
12
|
-
s.files = ["README.rdoc", "Rakefile", "Manifest", "test/test_sfst.rb", "test/test_sfst.fst", "CHANGELOG", "ext/sfst_machine/fst-compiler.h", "ext/sfst_machine/utf8.C", "ext/sfst_machine/operators.C", "ext/sfst_machine/utf8-scanner.ll", "ext/sfst_machine/determinise.C", "ext/sfst_machine/interface.C", "ext/sfst_machine/compact.h", "ext/sfst_machine/basic.h", "ext/sfst_machine/fst.h", "ext/sfst_machine/make-compact.h", "ext/sfst_machine/fst-compiler.yy", "ext/sfst_machine/mem.h", "ext/sfst_machine/compact.C", "ext/sfst_machine/basic.C", "ext/sfst_machine/interface.h", "ext/sfst_machine/sfst_machine.cc", "ext/sfst_machine/extconf.rb", "ext/sfst_machine/alphabet.C", "ext/sfst_machine/fst.C", "ext/sfst_machine/alphabet.h", "ext/sfst_machine/make-compact.C", "ext/sfst_machine/fst-compiler.C", "ext/sfst_machine/utf8.h", "ext/sfst_machine/utf8-scanner.C", "lib/sfst.rb", "ruby-sfst.gemspec"]
|
14
|
+
s.files = ["README.rdoc", "Rakefile", "Manifest", "test/test_sfst.rb", "test/test_sfst.fst", "CHANGELOG", "ext/sfst_machine/fst-compiler.h", "ext/sfst_machine/utf8.C", "ext/sfst_machine/operators.C", "ext/sfst_machine/utf8-scanner.ll", "ext/sfst_machine/determinise.C", "ext/sfst_machine/interface.C", "ext/sfst_machine/compact.h", "ext/sfst_machine/sgi.h", "ext/sfst_machine/basic.h", "ext/sfst_machine/fst.h", "ext/sfst_machine/make-compact.h", "ext/sfst_machine/fst-compiler.yy", "ext/sfst_machine/mem.h", "ext/sfst_machine/compact.C", "ext/sfst_machine/basic.C", "ext/sfst_machine/interface.h", "ext/sfst_machine/sfst_machine.cc", "ext/sfst_machine/extconf.rb", "ext/sfst_machine/alphabet.C", "ext/sfst_machine/fst.C", "ext/sfst_machine/alphabet.h", "ext/sfst_machine/make-compact.C", "ext/sfst_machine/fst-compiler.C", "ext/sfst_machine/utf8.h", "ext/sfst_machine/utf8-scanner.C", "lib/sfst.rb", "ruby-sfst.gemspec"]
|
13
15
|
s.has_rdoc = true
|
14
16
|
s.homepage = %q{http://github.com/mlj/ruby-sfst}
|
15
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby-sfst", "--main", "README.rdoc"]
|
16
18
|
s.require_paths = ["lib", "ext"]
|
17
19
|
s.rubyforge_project = %q{sfst}
|
18
|
-
s.rubygems_version = %q{1.
|
20
|
+
s.rubygems_version = %q{1.3.1}
|
19
21
|
s.summary = %q{A wrapper for the Stuttgart Finite State Transducer Tools (SFST).}
|
20
22
|
s.test_files = ["test/test_sfst.rb"]
|
21
23
|
|
@@ -23,7 +25,7 @@ Gem::Specification.new do |s|
|
|
23
25
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
26
|
s.specification_version = 2
|
25
27
|
|
26
|
-
if
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
29
|
s.add_development_dependency(%q<echoe>, [">= 0"])
|
28
30
|
else
|
29
31
|
s.add_dependency(%q<echoe>, [">= 0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-sfst
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Marius L. J\xC3\xB8hndal"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-02-09 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- ext/sfst_machine/determinise.C
|
46
46
|
- ext/sfst_machine/interface.C
|
47
47
|
- ext/sfst_machine/compact.h
|
48
|
+
- ext/sfst_machine/sgi.h
|
48
49
|
- ext/sfst_machine/basic.h
|
49
50
|
- ext/sfst_machine/fst.h
|
50
51
|
- ext/sfst_machine/make-compact.h
|
@@ -85,14 +86,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
86
|
version:
|
86
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
88
|
requirements:
|
88
|
-
- - "
|
89
|
+
- - ">="
|
89
90
|
- !ruby/object:Gem::Version
|
90
91
|
version: "1.2"
|
91
92
|
version:
|
92
93
|
requirements: []
|
93
94
|
|
94
95
|
rubyforge_project: sfst
|
95
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 1.3.1
|
96
97
|
signing_key:
|
97
98
|
specification_version: 2
|
98
99
|
summary: A wrapper for the Stuttgart Finite State Transducer Tools (SFST).
|