ruco-cpp 0.4.0 → 0.5.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ruco +27 -2
  3. data/lib/ruco/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 148946021e8cbdc944f3ab6da6043a6166be80cd
4
- data.tar.gz: dc4a66d080db5cb0210eb16fbce507b817dcd9d9
3
+ metadata.gz: 7c8882435b1fd99eebef6b07d7e00273934f6f47
4
+ data.tar.gz: ed82ad7551bbb55fbc589abaeb074ab2de17cf05
5
5
  SHA512:
6
- metadata.gz: 0bdef0134ee6bbfce97aa50d0e1d3bd5f5788ea3e03dd0faf1c234077ca0fe03f7a3191c72ce325b26f4d52773dac82122ac581caef89a70c339d013ecb71019
7
- data.tar.gz: 419e4fb2e975e35056911b2264a0b1be1407d34a4661b5fe3f3b5a4a4e3c62907aa04a7ec568cdbe6a921c151d2a452c52217113fbe64a1a366f2a1b82a930e7
6
+ metadata.gz: e8b1333221d0061e48728e7187c0b4a569d66fe39868e72ed83deab021ebe17f6c2205f133cc713f8b7827e4a6ced041c5a4dbde8339f528e09090569dcac312
7
+ data.tar.gz: cc926f9b2347e19c1a309faaa15908067e03bcd2eb38060161341ee02fef8d3dd444ceb492da86e16aabcad703da3dbef6f43b8e775d75db31849f0f4203fd28
data/bin/ruco CHANGED
@@ -22,10 +22,35 @@ File.write("#{grammar_name.capitalize}.hpp",rr.generate_header)
22
22
  File.write("parse_#{grammar_name}.cpp",rr.generate_libcpp)
23
23
  File.write("parse_#{grammar_name}.hpp",rr.generate_libhpp)
24
24
  File.write("Makefile", rr.generate_makefile) unless File.exists? "Makefile"
25
- FileUtils.cp(File.join(Gem.datadir("ruco-cpp"), "picojson", "picojson.h"),"picojson.hpp")
25
+ File.write("#{grammar_name}.cpp", <<-EXAMPLE_FILE ) unless File.exists? "#{grammar_name}.cpp"
26
+ #include "parse_#{grammar_name}.hpp"
27
+
28
+ // This is an example of how you would parse a file and print its AST.
29
+
30
+ int main()
31
+ {
32
+ try
33
+ {
34
+ auto a = #{grammar_name.capitalize}::Parse("test.#{grammar_name}");
35
+ std::wcout << #{grammar_name.capitalize}::Jsonify(a).serialize() << std::endl;
36
+ return EXIT_SUCCESS;
37
+ }
38
+ catch(#{grammar_name.capitalize}::FileNotFoundException e)
39
+ {
40
+ std::wcout << "File test.#{grammar_name} not found." << std::endl;
41
+ }
42
+ catch(#{grammar_name.capitalize}::ParserException e)
43
+ {
44
+ std::wcout << e.GetMessage() << std::endl;
45
+ }
46
+ return EXIT_SUCCESS;
47
+ }
48
+ EXAMPLE_FILE
49
+
50
+ FileUtils.cp(File.join(Gem.loaded_specs['ruco-cpp'].full_gem_path, "data", "ruco-cpp", "picojson", "picojson.h"),"picojson.hpp")
26
51
 
27
52
  atg = File.join(Dir.pwd, "#{grammar_name}.atg")
28
- datadir = Gem.datadir "ruco-cpp"
53
+ datadir = File.join(Gem.loaded_specs['ruco-cpp'].full_gem_path, "data", "ruco-cpp")
29
54
  puts atg
30
55
 
31
56
  Cocor.compile atg, datadir, grammar_name.capitalize, "#{Dir.pwd}/"
@@ -1,3 +1,3 @@
1
1
  module Ruco
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco-cpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.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: 2018-03-05 00:00:00.000000000 Z
11
+ date: 2018-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.6.11
190
+ rubygems_version: 2.6.14
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Boilerplate generator for Coco/R