lrama 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef1a46b0de83840d8353cf0e832898b7567a6a546b5ab8402cee59be5178d3af
4
- data.tar.gz: 81e546a5f907ed2a1a2ca4e1028f5be05df8251bd59fb8c7d8a3a7565e0f9dce
3
+ metadata.gz: 0a8a1b04a3e761af04029af3e3b74aaaf4fe9a9e2741205f430264ee3399f66c
4
+ data.tar.gz: a97ec2c2b2007f3bad6cbe5d1b37baa87d520cc3025e82403a9d8a70cddccc8a
5
5
  SHA512:
6
- metadata.gz: d388d548999a8e96d08698d191a44ea5c71893060eef624a1fd7845cfe23f96f27720646897fc12930f948f3dc27771a0e69ec26f57b604711ebe537984cb752
7
- data.tar.gz: afe54b54f3852fd65c243bff4a800a2186bc89cdfc92a83bae85eabf10aae7b4989d9daea9904477bff109fd48ae38af0aefaf1e10d245cb74f107397db5ae55
6
+ metadata.gz: 820bce06aefc235c02995cc957f9e0d9b2e8d588ce7748225896f0d63c319135068da39977be860815276c360a66e3dd6c2132802aa30e3292d706bc6ae7ef9d
7
+ data.tar.gz: d5c4ec405196bca888c78bf8a16cc9aef47da0f9943d7eee2bf9033c104f9a07fcb07c4cb6aabb3bb49f0e3665bf37932e2206cd9acad925702c30c7124210fb
@@ -40,10 +40,12 @@ jobs:
40
40
  bundler-cache: true
41
41
  - run: git clone --depth=1 https://github.com/ruby/ruby.git -b ${{ matrix.ruby_branch }} ../ruby
42
42
  working-directory:
43
- - run: mkdir tool/lrama
43
+ - run: mkdir -p tool/lrama
44
44
  working-directory: ../ruby
45
45
  - name: Copy Lrama to ruby/tool
46
- run: cp -r exe lib template ../ruby/tool/lrama
46
+ run: cp -r exe lib ../ruby/tool/lrama
47
+ # TODO: Consider how to manage changes on ruby/ruby master and ruby/lrama
48
+ # run: cp -r exe lib template ../ruby/tool/lrama
47
49
  working-directory:
48
50
  - run: tree tool/lrama
49
51
  working-directory: ../ruby
data/lib/lrama/command.rb CHANGED
@@ -57,14 +57,18 @@ module Lrama
57
57
  end
58
58
 
59
59
  if !grammar_file
60
- puts "File should be specified\n"
61
- exit 1
60
+ abort "File should be specified\n"
62
61
  end
63
62
 
64
63
  Report::Duration.enable if trace_opts[:time]
65
64
 
66
65
  warning = Lrama::Warning.new
67
- y = File.read(grammar_file)
66
+ if grammar_file == '-'
67
+ grammar_file = argv.shift or abort "File name for STDIN should be specified\n"
68
+ y = STDIN.read
69
+ else
70
+ y = File.read(grammar_file)
71
+ end
68
72
  grammar = Lrama::Parser.new(y).parse
69
73
  states = Lrama::States.new(grammar, warning, trace_state: (trace_opts[:automaton] || trace_opts[:closure]))
70
74
  states.compute
data/lib/lrama/output.rb CHANGED
@@ -53,9 +53,7 @@ module Lrama
53
53
  if @header_out
54
54
  @header_out << tmp
55
55
  else
56
- File.open(@header_file_path, "w+") do |f|
57
- f << tmp
58
- end
56
+ File.write(@header_file_path, tmp)
59
57
  end
60
58
  end
61
59
  end
data/lib/lrama/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lrama
2
- VERSION = "0.4.0".freeze
2
+ VERSION = "0.5.0".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  <%# b4_generated_by -%>
2
- /* A Bison parser, made by GNU Bison 3.8.2. */
2
+ /* A Bison parser, made by Lrama <%= Lrama::VERSION %>. */
3
3
 
4
4
  <%# b4_copyright -%>
5
5
  /* Bison implementation for Yacc-like parsers in C
@@ -1,5 +1,5 @@
1
1
  <%# b4_generated_by -%>
2
- /* A Bison parser, made by GNU Bison 3.8.2. */
2
+ /* A Bison parser, made by Lrama <%= Lrama::VERSION %>. */
3
3
 
4
4
  <%# b4_copyright -%>
5
5
  /* Bison interface for Yacc-like parsers in C
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lrama
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
  - Yuichiro Kaneko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2023-05-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: LALR (1) parser generator written by Ruby
14
14
  email: