ruco-cpp 0.2.8 → 0.3.0

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: 7ea9a7d1f24ec125e36bf7f1b36b92346b6952bf
4
- data.tar.gz: e17d83e242264ced49021b412f4b45ab88dd8982
3
+ metadata.gz: a6703adcbdc82415083f1d8798d6b74ff0a8580f
4
+ data.tar.gz: 2e1e889dbcb20cb8842e82fdb0cd3e26ab140acf
5
5
  SHA512:
6
- metadata.gz: cff2dc32980df4615dfadb8240c3913d2debd9e9c1e822a6907329a11fdb4d26f4ba78ee87c3c703e42a10433197c900957241f39d74cc180aae299f4d50e2e8
7
- data.tar.gz: 1185c51a35cf9c1025e3e2c7bd062b852908553ba27597771bf48f54c01a3cbfadd7076dd962b5bc4b374aff77d641d43b54b500294dc2d449e17ae73b9b5f17
6
+ metadata.gz: 1b68ae6e8f3abf0031faac1a00aa11aa571b37c3ac6164310ca711fbe269a1dabfb893a4acb6db14369295c99c1cfad1e05b9159ef1f8a2c358f76a1cc33e98e
7
+ data.tar.gz: 3f496105b8c62a239366101293ad3e6ba6f726c1f85e0dbde14c0e54bce3cd461faade18dee612f514917b36f3923909ea518e4e485e38b0e3b99d88c7a1d9df
data/lib/ruco.rb CHANGED
@@ -212,6 +212,7 @@ module Ruco
212
212
  @name = grammar_name
213
213
  super(grammar_name)
214
214
  @productions = {grammar_name => self}
215
+ @custom_tokens = {}
215
216
  instance_eval(&block)
216
217
  end
217
218
 
@@ -239,7 +240,7 @@ module Ruco
239
240
  @productions[name] = p
240
241
  end
241
242
 
242
- def token(name, type)
243
+ def token(name, type, definitionstring)
243
244
  p = Production.new(name)
244
245
  case type
245
246
  when :pascal_case
@@ -266,6 +267,11 @@ module Ruco
266
267
  p.instance_eval do
267
268
  one Token.new("char", @prodset)
268
269
  end
270
+ when :custom
271
+ @custom_tokens["customToken#{name}"] = "#{definitionstring}"
272
+ p.instance_eval do
273
+ one Token.new("customToken#{name}", @prodset)
274
+ end
269
275
  end
270
276
  @productions[name] = p
271
277
  end
@@ -440,6 +446,7 @@ namespace #{@name}
440
446
  end
441
447
 
442
448
  def generate_libhpp()
449
+
443
450
  <<-HPPCONTENT
444
451
 
445
452
  #ifndef PARSE_#{@name.upcase}_HPP
@@ -756,6 +763,10 @@ $(OUT)/%.o:%.cpp $(OUT)/%.d
756
763
 
757
764
  productions = productionlist.join("\n")
758
765
 
766
+ custom_tokens = @custom_tokens.map do |k,v|
767
+ "\t#{k} = #{v}."
768
+ end.join("\n")
769
+
759
770
  <<-FRAMEEND
760
771
 
761
772
  #include <iostream>
@@ -788,7 +799,7 @@ TOKENS
788
799
  pascalcase = bigletter { bigletter | letter | digit }.
789
800
  camelcase = letter { bigletter | letter | digit }.
790
801
 
791
- number = digit { digit } [ '.' { digit } ].
802
+ number = digit { digit } [ '.' digit { digit } ].
792
803
  hexinteger = '0' 'x' hex { hex }.
793
804
 
794
805
  string = '"' { stringCh | '\\\\' printable } '"'.
@@ -796,6 +807,8 @@ TOKENS
796
807
  char = '\\'' ( charCh | '\\\\' printable { hex } ) '\\''.
797
808
  endOfLine = cr | lf.
798
809
 
810
+ #{custom_tokens}
811
+
799
812
  PRAGMAS
800
813
  ddtSym = '$' { digit | letter }.
801
814
  optionSym = '$' letter { letter } '='
data/lib/ruco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ruco
2
- VERSION = "0.2.8"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco-cpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-24 00:00:00.000000000 Z
11
+ date: 2017-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.2'
20
20
  type: :runtime
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: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.10'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake-compiler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.9.5
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.9.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '3.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.3'
83
83
  description: Generates an LL(1) parser for a grammar described in a .ruco file
@@ -162,7 +162,6 @@ files:
162
162
  - ext/cocor/cygBuild.bat
163
163
  - ext/cocor/extconf.rb
164
164
  - ext/cocor/mingwbuild.bat
165
- - ext/cocor/mkmf.log
166
165
  - ext/cocor/zipsources.bat
167
166
  - lib/cocor.rb
168
167
  - lib/ruco.rb
@@ -178,17 +177,17 @@ require_paths:
178
177
  - lib
179
178
  required_ruby_version: !ruby/object:Gem::Requirement
180
179
  requirements:
181
- - - '>='
180
+ - - ">="
182
181
  - !ruby/object:Gem::Version
183
182
  version: '2.0'
184
183
  required_rubygems_version: !ruby/object:Gem::Requirement
185
184
  requirements:
186
- - - '>='
185
+ - - ">="
187
186
  - !ruby/object:Gem::Version
188
187
  version: '0'
189
188
  requirements: []
190
189
  rubyforge_project:
191
- rubygems_version: 2.4.7
190
+ rubygems_version: 2.4.8
192
191
  signing_key:
193
192
  specification_version: 4
194
193
  summary: Boilerplate generator for Coco/R
data/ext/cocor/mkmf.log DELETED
@@ -1,57 +0,0 @@
1
- have_library: checking for main() in -lstdc++... -------------------- yes
2
-
3
- "gcc -o conftest -I/opt/chef/embedded/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/opt/chef/embedded/include/ruby-1.9.1/ruby/backward -I/opt/chef/embedded/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/chef/embedded/include -I/opt/chef/embedded/include -I/opt/chef/embedded/include/ncurses -arch x86_64 -O3 -g -pipe -Qunused-arguments -fno-common conftest.c -L. -L/opt/chef/embedded/lib -L/opt/chef/embedded/lib -L. -L/opt/chef/embedded/lib -arch x86_64 -L/opt/chef/embedded/lib -m64 -lruby.1.9.1 -lpthread -ldl -lobjc "
4
- checked program was:
5
- /* begin */
6
- 1: #include "ruby.h"
7
- 2:
8
- 3: int main(int argc, char **argv)
9
- 4: {
10
- 5: return 0;
11
- 6: }
12
- /* end */
13
-
14
- "gcc -o conftest -I/opt/chef/embedded/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/opt/chef/embedded/include/ruby-1.9.1/ruby/backward -I/opt/chef/embedded/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/chef/embedded/include -I/opt/chef/embedded/include -I/opt/chef/embedded/include/ncurses -arch x86_64 -O3 -g -pipe -Qunused-arguments -fno-common conftest.c -L. -L/opt/chef/embedded/lib -L/opt/chef/embedded/lib -L. -L/opt/chef/embedded/lib -arch x86_64 -L/opt/chef/embedded/lib -m64 -lruby.1.9.1 -lstdc++ -lpthread -ldl -lobjc "
15
- conftest.c:4:53: error: use of undeclared identifier 'main'
16
- int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
17
- ^
18
- 1 error generated.
19
- checked program was:
20
- /* begin */
21
- 1: #include "ruby.h"
22
- 2:
23
- 3: /*top*/
24
- 4: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
25
- 5: int main(int argc, char **argv)
26
- 6: {
27
- 7: if (argc > 1000000) {
28
- 8: printf("%p", &t);
29
- 9: }
30
- 10:
31
- 11: return 0;
32
- 12: }
33
- /* end */
34
-
35
- "gcc -o conftest -I/opt/chef/embedded/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/opt/chef/embedded/include/ruby-1.9.1/ruby/backward -I/opt/chef/embedded/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/chef/embedded/include -I/opt/chef/embedded/include -I/opt/chef/embedded/include/ncurses -arch x86_64 -O3 -g -pipe -Qunused-arguments -fno-common conftest.c -L. -L/opt/chef/embedded/lib -L/opt/chef/embedded/lib -L. -L/opt/chef/embedded/lib -arch x86_64 -L/opt/chef/embedded/lib -m64 -lruby.1.9.1 -lstdc++ -lpthread -ldl -lobjc "
36
- conftest.c:4:11: warning: implicit declaration of function 'main' is invalid in C99 [-Wimplicit-function-declaration]
37
- int t() { main(); return 0; }
38
- ^
39
- 1 warning generated.
40
- checked program was:
41
- /* begin */
42
- 1: #include "ruby.h"
43
- 2:
44
- 3: /*top*/
45
- 4: int t() { main(); return 0; }
46
- 5: int main(int argc, char **argv)
47
- 6: {
48
- 7: if (argc > 1000000) {
49
- 8: printf("%p", &t);
50
- 9: }
51
- 10:
52
- 11: return 0;
53
- 12: }
54
- /* end */
55
-
56
- --------------------
57
-