ruco-cpp 0.2.1
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.
- checksums.yaml +7 -0
- data/Rakefile +17 -0
- data/bin/console +14 -0
- data/bin/ruco +30 -0
- data/bin/setup +7 -0
- data/data/ruco/Parser.frame +359 -0
- data/data/ruco/Scanner.frame +896 -0
- data/data/ruco/picojson/Changes +14 -0
- data/data/ruco/picojson/LICENSE +25 -0
- data/data/ruco/picojson/Makefile +8 -0
- data/data/ruco/picojson/README.mkdn +183 -0
- data/data/ruco/picojson/examples/github-issues.cc +110 -0
- data/data/ruco/picojson/examples/iostream.cc +70 -0
- data/data/ruco/picojson/examples/streaming.cc +76 -0
- data/data/ruco/picojson/picojson.h +1299 -0
- data/ext/cocor/Action.cpp +81 -0
- data/ext/cocor/Action.h +59 -0
- data/ext/cocor/ArrayList.cpp +79 -0
- data/ext/cocor/ArrayList.h +52 -0
- data/ext/cocor/BitArray.cpp +156 -0
- data/ext/cocor/BitArray.h +68 -0
- data/ext/cocor/CharClass.cpp +42 -0
- data/ext/cocor/CharClass.h +48 -0
- data/ext/cocor/CharSet.cpp +166 -0
- data/ext/cocor/CharSet.h +68 -0
- data/ext/cocor/Coco.atg +528 -0
- data/ext/cocor/Coco.cpp +173 -0
- data/ext/cocor/Comment.cpp +45 -0
- data/ext/cocor/Comment.h +51 -0
- data/ext/cocor/Copyright.frame +27 -0
- data/ext/cocor/DFA.cpp +865 -0
- data/ext/cocor/DFA.h +132 -0
- data/ext/cocor/Generator.cpp +182 -0
- data/ext/cocor/Generator.h +61 -0
- data/ext/cocor/Graph.h +59 -0
- data/ext/cocor/HashTable.cpp +115 -0
- data/ext/cocor/HashTable.h +84 -0
- data/ext/cocor/Makefile +11 -0
- data/ext/cocor/Melted.cpp +39 -0
- data/ext/cocor/Melted.h +51 -0
- data/ext/cocor/Node.cpp +69 -0
- data/ext/cocor/Node.h +86 -0
- data/ext/cocor/Parser.cpp +925 -0
- data/ext/cocor/Parser.frame +326 -0
- data/ext/cocor/Parser.h +153 -0
- data/ext/cocor/ParserGen.cpp +486 -0
- data/ext/cocor/ParserGen.h +99 -0
- data/ext/cocor/Position.cpp +37 -0
- data/ext/cocor/Position.h +46 -0
- data/ext/cocor/README.md +12 -0
- data/ext/cocor/Scanner.cpp +833 -0
- data/ext/cocor/Scanner.frame +897 -0
- data/ext/cocor/Scanner.h +291 -0
- data/ext/cocor/Sets.h +84 -0
- data/ext/cocor/SortedList.cpp +141 -0
- data/ext/cocor/SortedList.h +68 -0
- data/ext/cocor/State.cpp +77 -0
- data/ext/cocor/State.h +55 -0
- data/ext/cocor/StringBuilder.cpp +88 -0
- data/ext/cocor/StringBuilder.h +29 -0
- data/ext/cocor/Symbol.cpp +61 -0
- data/ext/cocor/Symbol.h +70 -0
- data/ext/cocor/Tab.cpp +1248 -0
- data/ext/cocor/Tab.h +245 -0
- data/ext/cocor/Target.cpp +41 -0
- data/ext/cocor/Target.h +48 -0
- data/ext/cocor/build.bat +3 -0
- data/ext/cocor/build.sh +4 -0
- data/ext/cocor/coc.bat +1 -0
- data/ext/cocor/coc.sh +2 -0
- data/ext/cocor/cocor_ruby_ext.cpp +124 -0
- data/ext/cocor/cygBuild.bat +1 -0
- data/ext/cocor/extconf.rb +5 -0
- data/ext/cocor/mingwbuild.bat +2 -0
- data/ext/cocor/mkmf.log +57 -0
- data/ext/cocor/zipsources.bat +1 -0
- data/lib/cocor.rb +14 -0
- data/lib/ruco/version.rb +3 -0
- data/lib/ruco.rb +728 -0
- metadata +195 -0
data/ext/cocor/Melted.h
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
Compiler Generator Coco/R,
|
3
|
+
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
|
4
|
+
extended by M. Loeberbauer & A. Woess, Univ. of Linz
|
5
|
+
ported to C++ by Csaba Balazs, University of Szeged
|
6
|
+
with improvements by Pat Terry, Rhodes University
|
7
|
+
|
8
|
+
This program is free software; you can redistribute it and/or modify it
|
9
|
+
under the terms of the GNU General Public License as published by the
|
10
|
+
Free Software Foundation; either version 2, or (at your option) any
|
11
|
+
later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful, but
|
14
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
15
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16
|
+
for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License along
|
19
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
20
|
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
As an exception, it is allowed to write an extension of Coco/R that is
|
23
|
+
used as a plugin in non-free software.
|
24
|
+
|
25
|
+
If not otherwise stated, any source code generated by Coco/R (other than
|
26
|
+
Coco/R itself) does not fall under the GNU General Public License.
|
27
|
+
-------------------------------------------------------------------------*/
|
28
|
+
|
29
|
+
#if !defined(COCO_MELTED_H__)
|
30
|
+
#define COCO_MELTED_H__
|
31
|
+
|
32
|
+
#include "State.h"
|
33
|
+
#include "Scanner.h"
|
34
|
+
|
35
|
+
namespace Coco {
|
36
|
+
|
37
|
+
class BitArray;
|
38
|
+
|
39
|
+
class Melted // info about melted states
|
40
|
+
{
|
41
|
+
public:
|
42
|
+
BitArray *set; // set of old states
|
43
|
+
State *state; // new state
|
44
|
+
Melted *next;
|
45
|
+
|
46
|
+
Melted(BitArray *set, State *state);
|
47
|
+
};
|
48
|
+
|
49
|
+
}; // namespace
|
50
|
+
|
51
|
+
#endif // !defined(COCO_MELTED_H__)
|
data/ext/cocor/Node.cpp
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
Compiler Generator Coco/R,
|
3
|
+
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
|
4
|
+
extended by M. Loeberbauer & A. Woess, Univ. of Linz
|
5
|
+
ported to C++ by Csaba Balazs, University of Szeged
|
6
|
+
with improvements by Pat Terry, Rhodes University
|
7
|
+
|
8
|
+
This program is free software; you can redistribute it and/or modify it
|
9
|
+
under the terms of the GNU General Public License as published by the
|
10
|
+
Free Software Foundation; either version 2, or (at your option) any
|
11
|
+
later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful, but
|
14
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
15
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16
|
+
for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License along
|
19
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
20
|
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
As an exception, it is allowed to write an extension of Coco/R that is
|
23
|
+
used as a plugin in non-free software.
|
24
|
+
|
25
|
+
If not otherwise stated, any source code generated by Coco/R (other than
|
26
|
+
Coco/R itself) does not fall under the GNU General Public License.
|
27
|
+
-------------------------------------------------------------------------*/
|
28
|
+
|
29
|
+
#include "Node.h"
|
30
|
+
|
31
|
+
namespace Coco {
|
32
|
+
|
33
|
+
// constants for node kinds
|
34
|
+
int Node::t = 1; // terminal symbol
|
35
|
+
int Node::pr = 2; // pragma
|
36
|
+
int Node::nt = 3; // nonterminal symbol
|
37
|
+
int Node::clas = 4; // character class
|
38
|
+
int Node::chr = 5; // character
|
39
|
+
int Node::wt = 6; // weak terminal symbol
|
40
|
+
int Node::any = 7; //
|
41
|
+
int Node::eps = 8; // empty
|
42
|
+
int Node::sync = 9; // synchronization symbol
|
43
|
+
int Node::sem = 10; // semantic action: (. .)
|
44
|
+
int Node::alt = 11; // alternative: |
|
45
|
+
int Node::iter = 12; // iteration: { }
|
46
|
+
int Node::opt = 13; // option: [ ]
|
47
|
+
int Node::rslv = 14; // resolver expr
|
48
|
+
|
49
|
+
int Node::normalTrans = 0; // transition codes
|
50
|
+
int Node::contextTrans = 1;
|
51
|
+
|
52
|
+
|
53
|
+
Node::Node(int typ, Symbol *sym, int line) {
|
54
|
+
this->n = 0;
|
55
|
+
this->next = NULL;
|
56
|
+
this->down = NULL;
|
57
|
+
this->sub = NULL;
|
58
|
+
this->up = false;
|
59
|
+
this->val = 0;
|
60
|
+
this->code = 0;
|
61
|
+
this->set = NULL;
|
62
|
+
this->pos = NULL;
|
63
|
+
this->state = NULL;
|
64
|
+
this->state = 0;
|
65
|
+
|
66
|
+
this->typ = typ; this->sym = sym; this->line = line;
|
67
|
+
}
|
68
|
+
|
69
|
+
}; // namespace
|
data/ext/cocor/Node.h
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
/*-------------------------------------------------------------------------
|
2
|
+
Compiler Generator Coco/R,
|
3
|
+
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
|
4
|
+
extended by M. Loeberbauer & A. Woess, Univ. of Linz
|
5
|
+
ported to C++ by Csaba Balazs, University of Szeged
|
6
|
+
with improvements by Pat Terry, Rhodes University
|
7
|
+
|
8
|
+
This program is free software; you can redistribute it and/or modify it
|
9
|
+
under the terms of the GNU General Public License as published by the
|
10
|
+
Free Software Foundation; either version 2, or (at your option) any
|
11
|
+
later version.
|
12
|
+
|
13
|
+
This program is distributed in the hope that it will be useful, but
|
14
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
15
|
+
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16
|
+
for more details.
|
17
|
+
|
18
|
+
You should have received a copy of the GNU General Public License along
|
19
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
20
|
+
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
21
|
+
|
22
|
+
As an exception, it is allowed to write an extension of Coco/R that is
|
23
|
+
used as a plugin in non-free software.
|
24
|
+
|
25
|
+
If not otherwise stated, any source code generated by Coco/R (other than
|
26
|
+
Coco/R itself) does not fall under the GNU General Public License.
|
27
|
+
-------------------------------------------------------------------------*/
|
28
|
+
|
29
|
+
#if !defined(COCO_NODE_H__)
|
30
|
+
#define COCO_NODE_H__
|
31
|
+
|
32
|
+
#include <stdio.h>
|
33
|
+
#include "Position.h"
|
34
|
+
#include "State.h"
|
35
|
+
#include "Scanner.h"
|
36
|
+
|
37
|
+
namespace Coco {
|
38
|
+
|
39
|
+
class Symbol;
|
40
|
+
class BitArray;
|
41
|
+
|
42
|
+
class Node {
|
43
|
+
public:
|
44
|
+
// constants for node kinds
|
45
|
+
static int t; // terminal symbol
|
46
|
+
static int pr; // pragma
|
47
|
+
static int nt; // nonterminal symbol
|
48
|
+
static int clas; // character class
|
49
|
+
static int chr; // character
|
50
|
+
static int wt; // weak terminal symbol
|
51
|
+
static int any; //
|
52
|
+
static int eps; // empty
|
53
|
+
static int sync; // synchronization symbol
|
54
|
+
static int sem; // semantic action: (. .)
|
55
|
+
static int alt; // alternative: |
|
56
|
+
static int iter; // iteration: { }
|
57
|
+
static int opt; // option: [ ]
|
58
|
+
static int rslv; // resolver expr
|
59
|
+
|
60
|
+
static int normalTrans; // transition codes
|
61
|
+
static int contextTrans;
|
62
|
+
|
63
|
+
int n; // node number
|
64
|
+
int typ; // t, nt, wt, chr, clas, any, eps, sem, sync, alt, iter, opt, rslv
|
65
|
+
Node *next; // to successor node
|
66
|
+
Node *down; // alt: to next alternative
|
67
|
+
Node *sub; // alt, iter, opt: to first node of substructure
|
68
|
+
bool up; // true: "next" leads to successor in enclosing structure
|
69
|
+
Symbol *sym; // nt, t, wt: symbol represented by this node
|
70
|
+
int val; // chr: ordinal character value
|
71
|
+
// clas: index of character class
|
72
|
+
int code; // chr, clas: transition code
|
73
|
+
BitArray *set; // any, sync: the set represented by this node
|
74
|
+
Position *pos; // nt, t, wt: pos of actual attributes
|
75
|
+
// sem: pos of semantic action in source text
|
76
|
+
// rslv: pos of resolver in source text
|
77
|
+
int line; // source text line number of item in this node
|
78
|
+
State *state; // DFA state corresponding to this node
|
79
|
+
// (only used in DFA.ConvertToStates)
|
80
|
+
|
81
|
+
Node(int typ, Symbol *sym, int line);
|
82
|
+
};
|
83
|
+
|
84
|
+
}; // namespace
|
85
|
+
|
86
|
+
#endif // !defined(COCO_NODE_H__)
|