ruco-cpp 0.2.2 → 0.2.4

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: 85829b09e058c0903da7fe2b554af396b2661fae
4
- data.tar.gz: 46bae6758f49a1ab323e6098ba74e3ce9fb8c03b
3
+ metadata.gz: 8456b33c27c7b0f589ce32b10785f6da9437ae21
4
+ data.tar.gz: 859c0745003b7c4a2741e4d14daccb1043e9f464
5
5
  SHA512:
6
- metadata.gz: 0d8365621e15db8c8f21a6f14ff303a0ca90c57ac2aa18d4457ca179bb59f73bb5196b2044925871ba9912d1eb8500bbd123d3db36cfa4364dba8cb230d7b079
7
- data.tar.gz: 958d9807dea7093356ec94e18da8d5d0a6e5c5d2c78a945db21597110fa3edfe1c23126aaf4aa54158147691e54c1baa5d6734dd37b3b63e6a4c7799a23457ae
6
+ metadata.gz: 1ac5de3e243e7882839e3eb1773c86e258c2d129e91354a94fe94c87b3afe274577628d9268ebd788e3b3b9e2410c5999bef470deea7e3c6a66dcfd35f8e909d
7
+ data.tar.gz: 2ae249b86e0c9d982dc311e5894e246116178a8a6a403d895acc2f93eddecbb18104806a881ebc1ff7cca5cbc9768902b8c70de52963a353bceba09e9fcbd77e
data/bin/ruco CHANGED
@@ -21,10 +21,11 @@ File.write("#{grammar_name}.atg",rr.generate_atg)
21
21
  File.write("#{grammar_name}.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
- FileUtils.cp(File.join(Gem.datadir("ruco"), "picojson", "picojson.h"),"picojson.hpp")
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
26
 
26
27
  atg = File.join(Dir.pwd, "#{grammar_name}.atg")
27
- datadir = Gem.datadir "ruco"
28
+ datadir = Gem.datadir "ruco-cpp"
28
29
  puts atg
29
30
 
30
31
  Cocor.compile atg, datadir, grammar_name.capitalize, "#{Dir.pwd}/"
data/lib/ruco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ruco
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/ruco.rb CHANGED
@@ -620,6 +620,63 @@ namespace #{@name}
620
620
  CPPCONTENT
621
621
  end
622
622
 
623
+ def generate_makefile
624
+ <<-MAKEFILEEND
625
+ V = 0
626
+ AT_0 := @
627
+ AT_1 :=
628
+ REDIR_0 := > /dev/null
629
+ REDIR_1 :=
630
+ AT = $(AT_$(V))
631
+ REDIR = $(REDIR_$(V))
632
+
633
+ CXXFLAGS=-g -Wall -std=gnu++11
634
+
635
+ LDFLAGS=
636
+ TARGET=#{@name.downcase}_parse
637
+ SRCDIR=.
638
+ SRC=$(shell find $(SRCDIR) -name "*.cpp")
639
+ OUT=obj
640
+ OBJS=$(SRC:%.cpp=$(OUT)/%.o)
641
+ DEPS=$(SRC:%.cpp=$(OUT)/%.d)
642
+ NODEPS=clean
643
+
644
+ .PHONY = all clean
645
+
646
+ .SECONDEXPANSION:
647
+
648
+ all: $(TARGET)
649
+ $(AT)echo "Build complete"
650
+
651
+ clean:
652
+ $(AT)-rm -rf $(TARGET) $(OUT)
653
+
654
+ ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS))))
655
+ -include $(DEPS)
656
+ endif
657
+
658
+ $(TARGET): $(OBJS) $(LUA)
659
+ $(AT)echo [LINK] $@
660
+ $(AT)$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
661
+
662
+ %/.f:
663
+ $(AT)echo [MKDIR] $(dir $@)
664
+ $(AT)mkdir -p $(dir $@)
665
+ $(AT)touch $@
666
+
667
+ $(OUT)/%.d:%.cpp $$(@D)/.f
668
+ $(AT)echo [DEP] $<
669
+ $(AT)$(CXX) $(CXXFLAGS) -MM -MT '$(patsubst %.d,%.o,$@)' $< -MF $@
670
+
671
+ $(OUT)/%.o:%.cpp $(OUT)/%.d
672
+ $(AT)echo [C++] $<
673
+ $(AT)$(CXX) $< $(CXXFLAGS) -c -o $@
674
+
675
+ .PRECIOUS: %/.f
676
+
677
+ MAKEFILEEND
678
+ end
679
+
623
680
  def generate_atg()
624
681
 
625
682
  productionlist = []
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco-cpp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Siaw
@@ -93,16 +93,16 @@ files:
93
93
  - bin/console
94
94
  - bin/ruco
95
95
  - bin/setup
96
- - data/ruco/Parser.frame
97
- - data/ruco/Scanner.frame
98
- - data/ruco/picojson/Changes
99
- - data/ruco/picojson/LICENSE
100
- - data/ruco/picojson/Makefile
101
- - data/ruco/picojson/README.mkdn
102
- - data/ruco/picojson/examples/github-issues.cc
103
- - data/ruco/picojson/examples/iostream.cc
104
- - data/ruco/picojson/examples/streaming.cc
105
- - data/ruco/picojson/picojson.h
96
+ - data/ruco-cpp/Parser.frame
97
+ - data/ruco-cpp/Scanner.frame
98
+ - data/ruco-cpp/picojson/Changes
99
+ - data/ruco-cpp/picojson/LICENSE
100
+ - data/ruco-cpp/picojson/Makefile
101
+ - data/ruco-cpp/picojson/README.mkdn
102
+ - data/ruco-cpp/picojson/examples/github-issues.cc
103
+ - data/ruco-cpp/picojson/examples/iostream.cc
104
+ - data/ruco-cpp/picojson/examples/streaming.cc
105
+ - data/ruco-cpp/picojson/picojson.h
106
106
  - ext/cocor/Action.cpp
107
107
  - ext/cocor/Action.h
108
108
  - ext/cocor/ArrayList.cpp
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes