mathematical 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +20 -9
- data/Rakefile +5 -24
- data/ext/mathematical/extconf.rb +8 -3
- data/ext/mathematical/lasem/src/lsmdomparser.c +7 -7
- data/ext/mathematical/lasem/src/lsmdomparser.h +2 -2
- data/ext/mathematical/lasem/src/lsmitex.c +8 -5
- data/ext/mathematical/lasem/src/lsmitex.h +1 -1
- data/ext/mathematical/lasem/src/lsmmathmldocument.c +2 -2
- data/ext/mathematical/lasem/src/lsmmathmldocument.h +1 -1
- data/ext/mathematical/lasem/tests/lsmtest.c +2 -2
- data/ext/mathematical/mathematical.c +119 -10
- data/ext/mathematical/mtex2MML/ext/extconf.rb +4 -0
- data/ext/mathematical/mtex2MML/src/lex.yy.c +6791 -0
- data/ext/mathematical/mtex2MML/src/mtex2MML.h +59 -0
- data/ext/mathematical/mtex2MML/src/parse_extras.c +306 -0
- data/ext/mathematical/mtex2MML/src/parse_extras.h +78 -0
- data/ext/mathematical/mtex2MML/src/stack.c +80 -0
- data/ext/mathematical/mtex2MML/src/stack.h +101 -0
- data/ext/mathematical/mtex2MML/src/string_extras.c +211 -0
- data/ext/mathematical/mtex2MML/src/string_extras.h +46 -0
- data/ext/mathematical/mtex2MML/src/y.tab.c +7090 -0
- data/ext/mathematical/mtex2MML/src/y.tab.h +393 -0
- data/lib/mathematical.rb +1 -0
- data/lib/mathematical/corrections.rb +34 -0
- data/lib/mathematical/render.rb +21 -12
- data/lib/mathematical/version.rb +1 -1
- data/mathematical.gemspec +2 -2
- data/test/mathematical/corrections_test.rb +56 -0
- data/test/mathematical/fixtures/png/pmatrix.png +0 -0
- data/test/mathematical/fixtures_test.rb +11 -1
- data/test/mathematical/maliciousness_test.rb +10 -2
- data/test/mathematical/mathml_test.rb +22 -0
- data/test/mathematical/png_test.rb +26 -0
- data/test/test_helper.rb +13 -0
- metadata +150 -134
- data/ext/mathematical/itexToMML/itex2MML.h +0 -63
- data/ext/mathematical/itexToMML/lex.yy.c +0 -6548
- data/ext/mathematical/itexToMML/y.tab.c +0 -6179
- data/ext/mathematical/itexToMML/y.tab.h +0 -389
@@ -1,389 +0,0 @@
|
|
1
|
-
/* A Bison parser, made by GNU Bison 2.3. */
|
2
|
-
|
3
|
-
/* Skeleton interface 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
|
-
/* Tokens. */
|
37
|
-
#ifndef YYTOKENTYPE
|
38
|
-
# define YYTOKENTYPE
|
39
|
-
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
40
|
-
know about them. */
|
41
|
-
enum yytokentype {
|
42
|
-
TEXATOP = 258,
|
43
|
-
TEXOVER = 259,
|
44
|
-
CHAR = 260,
|
45
|
-
STARTMATH = 261,
|
46
|
-
STARTDMATH = 262,
|
47
|
-
ENDMATH = 263,
|
48
|
-
MI = 264,
|
49
|
-
MIB = 265,
|
50
|
-
MN = 266,
|
51
|
-
MO = 267,
|
52
|
-
SUP = 268,
|
53
|
-
SUB = 269,
|
54
|
-
MROWOPEN = 270,
|
55
|
-
MROWCLOSE = 271,
|
56
|
-
LEFT = 272,
|
57
|
-
RIGHT = 273,
|
58
|
-
BIG = 274,
|
59
|
-
BBIG = 275,
|
60
|
-
BIGG = 276,
|
61
|
-
BBIGG = 277,
|
62
|
-
BIGL = 278,
|
63
|
-
BBIGL = 279,
|
64
|
-
BIGGL = 280,
|
65
|
-
BBIGGL = 281,
|
66
|
-
FRAC = 282,
|
67
|
-
TFRAC = 283,
|
68
|
-
OPERATORNAME = 284,
|
69
|
-
MATHOP = 285,
|
70
|
-
MATHBIN = 286,
|
71
|
-
MATHREL = 287,
|
72
|
-
MOP = 288,
|
73
|
-
MOL = 289,
|
74
|
-
MOLL = 290,
|
75
|
-
MOF = 291,
|
76
|
-
MOR = 292,
|
77
|
-
PERIODDELIM = 293,
|
78
|
-
OTHERDELIM = 294,
|
79
|
-
LEFTDELIM = 295,
|
80
|
-
RIGHTDELIM = 296,
|
81
|
-
MOS = 297,
|
82
|
-
MOB = 298,
|
83
|
-
SQRT = 299,
|
84
|
-
ROOT = 300,
|
85
|
-
BINOM = 301,
|
86
|
-
TBINOM = 302,
|
87
|
-
UNDER = 303,
|
88
|
-
OVER = 304,
|
89
|
-
OVERBRACE = 305,
|
90
|
-
UNDERLINE = 306,
|
91
|
-
UNDERBRACE = 307,
|
92
|
-
UNDEROVER = 308,
|
93
|
-
TENSOR = 309,
|
94
|
-
MULTI = 310,
|
95
|
-
ARRAYALIGN = 311,
|
96
|
-
COLUMNALIGN = 312,
|
97
|
-
ARRAY = 313,
|
98
|
-
COLSEP = 314,
|
99
|
-
ROWSEP = 315,
|
100
|
-
ARRAYOPTS = 316,
|
101
|
-
COLLAYOUT = 317,
|
102
|
-
COLALIGN = 318,
|
103
|
-
ROWALIGN = 319,
|
104
|
-
ALIGN = 320,
|
105
|
-
EQROWS = 321,
|
106
|
-
EQCOLS = 322,
|
107
|
-
ROWLINES = 323,
|
108
|
-
COLLINES = 324,
|
109
|
-
FRAME = 325,
|
110
|
-
PADDING = 326,
|
111
|
-
ATTRLIST = 327,
|
112
|
-
ITALICS = 328,
|
113
|
-
SANS = 329,
|
114
|
-
TT = 330,
|
115
|
-
BOLD = 331,
|
116
|
-
BOXED = 332,
|
117
|
-
SLASHED = 333,
|
118
|
-
RM = 334,
|
119
|
-
BB = 335,
|
120
|
-
ST = 336,
|
121
|
-
END = 337,
|
122
|
-
BBLOWERCHAR = 338,
|
123
|
-
BBUPPERCHAR = 339,
|
124
|
-
BBDIGIT = 340,
|
125
|
-
CALCHAR = 341,
|
126
|
-
FRAKCHAR = 342,
|
127
|
-
CAL = 343,
|
128
|
-
FRAK = 344,
|
129
|
-
CLAP = 345,
|
130
|
-
LLAP = 346,
|
131
|
-
RLAP = 347,
|
132
|
-
ROWOPTS = 348,
|
133
|
-
TEXTSIZE = 349,
|
134
|
-
SCSIZE = 350,
|
135
|
-
SCSCSIZE = 351,
|
136
|
-
DISPLAY = 352,
|
137
|
-
TEXTSTY = 353,
|
138
|
-
TEXTBOX = 354,
|
139
|
-
TEXTSTRING = 355,
|
140
|
-
XMLSTRING = 356,
|
141
|
-
CELLOPTS = 357,
|
142
|
-
ROWSPAN = 358,
|
143
|
-
COLSPAN = 359,
|
144
|
-
THINSPACE = 360,
|
145
|
-
MEDSPACE = 361,
|
146
|
-
THICKSPACE = 362,
|
147
|
-
QUAD = 363,
|
148
|
-
QQUAD = 364,
|
149
|
-
NEGSPACE = 365,
|
150
|
-
NEGMEDSPACE = 366,
|
151
|
-
NEGTHICKSPACE = 367,
|
152
|
-
PHANTOM = 368,
|
153
|
-
HREF = 369,
|
154
|
-
UNKNOWNCHAR = 370,
|
155
|
-
EMPTYMROW = 371,
|
156
|
-
STATLINE = 372,
|
157
|
-
TOOLTIP = 373,
|
158
|
-
TOGGLE = 374,
|
159
|
-
TOGGLESTART = 375,
|
160
|
-
TOGGLEEND = 376,
|
161
|
-
FGHIGHLIGHT = 377,
|
162
|
-
BGHIGHLIGHT = 378,
|
163
|
-
SPACE = 379,
|
164
|
-
INTONE = 380,
|
165
|
-
INTTWO = 381,
|
166
|
-
INTTHREE = 382,
|
167
|
-
BAR = 383,
|
168
|
-
WIDEBAR = 384,
|
169
|
-
VEC = 385,
|
170
|
-
WIDEVEC = 386,
|
171
|
-
HAT = 387,
|
172
|
-
WIDEHAT = 388,
|
173
|
-
CHECK = 389,
|
174
|
-
WIDECHECK = 390,
|
175
|
-
TILDE = 391,
|
176
|
-
WIDETILDE = 392,
|
177
|
-
DOT = 393,
|
178
|
-
DDOT = 394,
|
179
|
-
DDDOT = 395,
|
180
|
-
DDDDOT = 396,
|
181
|
-
UNARYMINUS = 397,
|
182
|
-
UNARYPLUS = 398,
|
183
|
-
BEGINENV = 399,
|
184
|
-
ENDENV = 400,
|
185
|
-
MATRIX = 401,
|
186
|
-
PMATRIX = 402,
|
187
|
-
BMATRIX = 403,
|
188
|
-
BBMATRIX = 404,
|
189
|
-
VMATRIX = 405,
|
190
|
-
VVMATRIX = 406,
|
191
|
-
SVG = 407,
|
192
|
-
ENDSVG = 408,
|
193
|
-
SMALLMATRIX = 409,
|
194
|
-
CASES = 410,
|
195
|
-
ALIGNED = 411,
|
196
|
-
GATHERED = 412,
|
197
|
-
SUBSTACK = 413,
|
198
|
-
PMOD = 414,
|
199
|
-
RMCHAR = 415,
|
200
|
-
COLOR = 416,
|
201
|
-
BGCOLOR = 417,
|
202
|
-
XARROW = 418,
|
203
|
-
OPTARGOPEN = 419,
|
204
|
-
OPTARGCLOSE = 420,
|
205
|
-
ITEXNUM = 421,
|
206
|
-
RAISEBOX = 422,
|
207
|
-
NEG = 423
|
208
|
-
};
|
209
|
-
#endif
|
210
|
-
/* Tokens. */
|
211
|
-
#define TEXATOP 258
|
212
|
-
#define TEXOVER 259
|
213
|
-
#define CHAR 260
|
214
|
-
#define STARTMATH 261
|
215
|
-
#define STARTDMATH 262
|
216
|
-
#define ENDMATH 263
|
217
|
-
#define MI 264
|
218
|
-
#define MIB 265
|
219
|
-
#define MN 266
|
220
|
-
#define MO 267
|
221
|
-
#define SUP 268
|
222
|
-
#define SUB 269
|
223
|
-
#define MROWOPEN 270
|
224
|
-
#define MROWCLOSE 271
|
225
|
-
#define LEFT 272
|
226
|
-
#define RIGHT 273
|
227
|
-
#define BIG 274
|
228
|
-
#define BBIG 275
|
229
|
-
#define BIGG 276
|
230
|
-
#define BBIGG 277
|
231
|
-
#define BIGL 278
|
232
|
-
#define BBIGL 279
|
233
|
-
#define BIGGL 280
|
234
|
-
#define BBIGGL 281
|
235
|
-
#define FRAC 282
|
236
|
-
#define TFRAC 283
|
237
|
-
#define OPERATORNAME 284
|
238
|
-
#define MATHOP 285
|
239
|
-
#define MATHBIN 286
|
240
|
-
#define MATHREL 287
|
241
|
-
#define MOP 288
|
242
|
-
#define MOL 289
|
243
|
-
#define MOLL 290
|
244
|
-
#define MOF 291
|
245
|
-
#define MOR 292
|
246
|
-
#define PERIODDELIM 293
|
247
|
-
#define OTHERDELIM 294
|
248
|
-
#define LEFTDELIM 295
|
249
|
-
#define RIGHTDELIM 296
|
250
|
-
#define MOS 297
|
251
|
-
#define MOB 298
|
252
|
-
#define SQRT 299
|
253
|
-
#define ROOT 300
|
254
|
-
#define BINOM 301
|
255
|
-
#define TBINOM 302
|
256
|
-
#define UNDER 303
|
257
|
-
#define OVER 304
|
258
|
-
#define OVERBRACE 305
|
259
|
-
#define UNDERLINE 306
|
260
|
-
#define UNDERBRACE 307
|
261
|
-
#define UNDEROVER 308
|
262
|
-
#define TENSOR 309
|
263
|
-
#define MULTI 310
|
264
|
-
#define ARRAYALIGN 311
|
265
|
-
#define COLUMNALIGN 312
|
266
|
-
#define ARRAY 313
|
267
|
-
#define COLSEP 314
|
268
|
-
#define ROWSEP 315
|
269
|
-
#define ARRAYOPTS 316
|
270
|
-
#define COLLAYOUT 317
|
271
|
-
#define COLALIGN 318
|
272
|
-
#define ROWALIGN 319
|
273
|
-
#define ALIGN 320
|
274
|
-
#define EQROWS 321
|
275
|
-
#define EQCOLS 322
|
276
|
-
#define ROWLINES 323
|
277
|
-
#define COLLINES 324
|
278
|
-
#define FRAME 325
|
279
|
-
#define PADDING 326
|
280
|
-
#define ATTRLIST 327
|
281
|
-
#define ITALICS 328
|
282
|
-
#define SANS 329
|
283
|
-
#define TT 330
|
284
|
-
#define BOLD 331
|
285
|
-
#define BOXED 332
|
286
|
-
#define SLASHED 333
|
287
|
-
#define RM 334
|
288
|
-
#define BB 335
|
289
|
-
#define ST 336
|
290
|
-
#define END 337
|
291
|
-
#define BBLOWERCHAR 338
|
292
|
-
#define BBUPPERCHAR 339
|
293
|
-
#define BBDIGIT 340
|
294
|
-
#define CALCHAR 341
|
295
|
-
#define FRAKCHAR 342
|
296
|
-
#define CAL 343
|
297
|
-
#define FRAK 344
|
298
|
-
#define CLAP 345
|
299
|
-
#define LLAP 346
|
300
|
-
#define RLAP 347
|
301
|
-
#define ROWOPTS 348
|
302
|
-
#define TEXTSIZE 349
|
303
|
-
#define SCSIZE 350
|
304
|
-
#define SCSCSIZE 351
|
305
|
-
#define DISPLAY 352
|
306
|
-
#define TEXTSTY 353
|
307
|
-
#define TEXTBOX 354
|
308
|
-
#define TEXTSTRING 355
|
309
|
-
#define XMLSTRING 356
|
310
|
-
#define CELLOPTS 357
|
311
|
-
#define ROWSPAN 358
|
312
|
-
#define COLSPAN 359
|
313
|
-
#define THINSPACE 360
|
314
|
-
#define MEDSPACE 361
|
315
|
-
#define THICKSPACE 362
|
316
|
-
#define QUAD 363
|
317
|
-
#define QQUAD 364
|
318
|
-
#define NEGSPACE 365
|
319
|
-
#define NEGMEDSPACE 366
|
320
|
-
#define NEGTHICKSPACE 367
|
321
|
-
#define PHANTOM 368
|
322
|
-
#define HREF 369
|
323
|
-
#define UNKNOWNCHAR 370
|
324
|
-
#define EMPTYMROW 371
|
325
|
-
#define STATLINE 372
|
326
|
-
#define TOOLTIP 373
|
327
|
-
#define TOGGLE 374
|
328
|
-
#define TOGGLESTART 375
|
329
|
-
#define TOGGLEEND 376
|
330
|
-
#define FGHIGHLIGHT 377
|
331
|
-
#define BGHIGHLIGHT 378
|
332
|
-
#define SPACE 379
|
333
|
-
#define INTONE 380
|
334
|
-
#define INTTWO 381
|
335
|
-
#define INTTHREE 382
|
336
|
-
#define BAR 383
|
337
|
-
#define WIDEBAR 384
|
338
|
-
#define VEC 385
|
339
|
-
#define WIDEVEC 386
|
340
|
-
#define HAT 387
|
341
|
-
#define WIDEHAT 388
|
342
|
-
#define CHECK 389
|
343
|
-
#define WIDECHECK 390
|
344
|
-
#define TILDE 391
|
345
|
-
#define WIDETILDE 392
|
346
|
-
#define DOT 393
|
347
|
-
#define DDOT 394
|
348
|
-
#define DDDOT 395
|
349
|
-
#define DDDDOT 396
|
350
|
-
#define UNARYMINUS 397
|
351
|
-
#define UNARYPLUS 398
|
352
|
-
#define BEGINENV 399
|
353
|
-
#define ENDENV 400
|
354
|
-
#define MATRIX 401
|
355
|
-
#define PMATRIX 402
|
356
|
-
#define BMATRIX 403
|
357
|
-
#define BBMATRIX 404
|
358
|
-
#define VMATRIX 405
|
359
|
-
#define VVMATRIX 406
|
360
|
-
#define SVG 407
|
361
|
-
#define ENDSVG 408
|
362
|
-
#define SMALLMATRIX 409
|
363
|
-
#define CASES 410
|
364
|
-
#define ALIGNED 411
|
365
|
-
#define GATHERED 412
|
366
|
-
#define SUBSTACK 413
|
367
|
-
#define PMOD 414
|
368
|
-
#define RMCHAR 415
|
369
|
-
#define COLOR 416
|
370
|
-
#define BGCOLOR 417
|
371
|
-
#define XARROW 418
|
372
|
-
#define OPTARGOPEN 419
|
373
|
-
#define OPTARGCLOSE 420
|
374
|
-
#define ITEXNUM 421
|
375
|
-
#define RAISEBOX 422
|
376
|
-
#define NEG 423
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
382
|
-
typedef int YYSTYPE;
|
383
|
-
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
384
|
-
# define YYSTYPE_IS_DECLARED 1
|
385
|
-
# define YYSTYPE_IS_TRIVIAL 1
|
386
|
-
#endif
|
387
|
-
|
388
|
-
extern YYSTYPE itex2MML_yylval;
|
389
|
-
|