lrama 0.6.3 → 0.6.5

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.
data/lib/lrama/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lrama
2
- VERSION = "0.6.3".freeze
2
+ VERSION = "0.6.5".freeze
3
3
  end
data/parser.y CHANGED
@@ -97,6 +97,13 @@ rule
97
97
  end_c_declaration
98
98
  }
99
99
  "}" generic_symlist
100
+ {
101
+ @grammar.add_destructor(
102
+ ident_or_tags: val[6],
103
+ token_code: val[3],
104
+ lineno: val[3].line
105
+ )
106
+ }
100
107
  | "%printer" "{"
101
108
  {
102
109
  begin_c_declaration("}")
@@ -455,10 +462,11 @@ rule
455
462
  {
456
463
  end_c_declaration
457
464
  }
458
- "}" named_ref_opt
465
+ "}" named_ref_opt tag_opt
459
466
  {
460
467
  user_code = val[3]
461
468
  user_code.alias_name = val[6]
469
+ user_code.tag = val[7]
462
470
  builder = val[0]
463
471
  builder.user_code = user_code
464
472
  result = builder
@@ -4,7 +4,6 @@ module Lrama
4
4
  attr_reader actual_args: Array[Lexer::Token]
5
5
  attr_reader count: Integer
6
6
 
7
- @rule_name: String
8
7
  @required_parameters_count: Integer
9
8
  @parameters: Array[Lexer::Token]
10
9
  @parameter_to_arg: untyped
@@ -0,0 +1,15 @@
1
+ module Lrama
2
+ class Grammar
3
+ class Code
4
+ class DestructorCode < Code
5
+ @tag: untyped
6
+ def initialize: (type: untyped, token_code: untyped, tag: untyped) -> void
7
+
8
+ private
9
+
10
+ # ref: Lrama::Grammar::Code.token_code.references
11
+ def reference_to_c: (untyped ref) -> untyped
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ module Lrama
2
+ class Grammar
3
+ class Destructor
4
+ attr_accessor ident_or_tags: Array[Lexer::Token::Ident|Lexer::Token::Tag]
5
+ attr_accessor token_code: Grammar::Code
6
+ attr_accessor lineno: Integer
7
+
8
+ def translated_code: (Lexer::Token member) -> String
9
+ end
10
+ end
11
+ end
@@ -8,7 +8,6 @@ module Lrama
8
8
 
9
9
  def initialize: () -> void
10
10
  def add_parameterizing_rule: (Grammar::ParameterizingRule::Rule rule) -> void
11
- def defined?: (Lexer::Token::InstantiateRule token) -> bool
12
11
  def find: (Lexer::Token::InstantiateRule token) -> Grammar::ParameterizingRule::Rule?
13
12
  def created_lhs: (String lhs_s_value) -> Lexer::Token?
14
13
 
@@ -17,7 +17,6 @@ module Lrama
17
17
  ) -> void
18
18
 
19
19
  def value: () -> (String|Integer)
20
- def tag: () -> untyped
21
20
  end
22
21
  end
23
22
  end
@@ -10,6 +10,7 @@ module Lrama
10
10
  attr_accessor nullable: bool
11
11
  attr_accessor precedence: Precedence?
12
12
  attr_accessor printer: Printer?
13
+ attr_accessor destructor: Destructor?
13
14
  attr_accessor error_token: ErrorToken
14
15
 
15
16
  attr_accessor first_set: Set[Array[Symbol]]
@@ -2,6 +2,7 @@ module Lrama
2
2
  class Lexer
3
3
  class Token
4
4
  class UserCode < Token
5
+ attr_accessor tag: Lexer::Token::Tag
5
6
  @references: Array[Lrama::Grammar::Reference]
6
7
 
7
8
  def references: () -> Array[Lrama::Grammar::Reference]
@@ -0,0 +1,17 @@
1
+ module Lrama
2
+ class Options
3
+ attr_accessor skeleton: String
4
+ attr_accessor header: bool
5
+ attr_accessor header_file: String?
6
+ attr_accessor report_file: String?
7
+ attr_accessor outfile: String
8
+ attr_accessor error_recovery: bool
9
+ attr_accessor grammar_file: String?
10
+ attr_accessor trace_opts: Hash[Symbol, bool]?
11
+ attr_accessor report_opts: Hash[Symbol, bool]?
12
+ attr_accessor y: IO
13
+ attr_accessor debug: bool
14
+
15
+ def initialize: () -> void
16
+ end
17
+ end
@@ -1145,7 +1145,12 @@ yydestruct (const char *yymsg,
1145
1145
  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp<%= output.user_args %>);
1146
1146
 
1147
1147
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1148
- YY_USE (yykind);
1148
+ switch (yykind)
1149
+ {
1150
+ <%= output.symbol_actions_for_destructor -%>
1151
+ default:
1152
+ break;
1153
+ }
1149
1154
  YY_IGNORE_MAYBE_UNINITIALIZED_END
1150
1155
  }
1151
1156
 
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.6.3
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuichiro Kaneko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-14 00:00:00.000000000 Z
11
+ date: 2024-03-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: LALR (1) parser generator written by Ruby
14
14
  email:
@@ -50,11 +50,13 @@ files:
50
50
  - lib/lrama/grammar/auxiliary.rb
51
51
  - lib/lrama/grammar/binding.rb
52
52
  - lib/lrama/grammar/code.rb
53
+ - lib/lrama/grammar/code/destructor_code.rb
53
54
  - lib/lrama/grammar/code/initial_action_code.rb
54
55
  - lib/lrama/grammar/code/no_reference_code.rb
55
56
  - lib/lrama/grammar/code/printer_code.rb
56
57
  - lib/lrama/grammar/code/rule_action.rb
57
58
  - lib/lrama/grammar/counter.rb
59
+ - lib/lrama/grammar/destructor.rb
58
60
  - lib/lrama/grammar/error_token.rb
59
61
  - lib/lrama/grammar/parameterizing_rule.rb
60
62
  - lib/lrama/grammar/parameterizing_rule/resolver.rb
@@ -111,8 +113,10 @@ files:
111
113
  - sig/lrama/grammar.rbs
112
114
  - sig/lrama/grammar/binding.rbs
113
115
  - sig/lrama/grammar/code.rbs
116
+ - sig/lrama/grammar/code/destructor_code.rbs
114
117
  - sig/lrama/grammar/code/printer_code.rbs
115
118
  - sig/lrama/grammar/counter.rbs
119
+ - sig/lrama/grammar/destructor.rbs
116
120
  - sig/lrama/grammar/error_token.rbs
117
121
  - sig/lrama/grammar/parameterizing_rule.rbs
118
122
  - sig/lrama/grammar/parameterizing_rule/resolver.rbs
@@ -135,6 +139,7 @@ files:
135
139
  - sig/lrama/lexer/token/instantiate_rule.rbs
136
140
  - sig/lrama/lexer/token/tag.rbs
137
141
  - sig/lrama/lexer/token/user_code.rbs
142
+ - sig/lrama/options.rbs
138
143
  - sig/lrama/report/duration.rbs
139
144
  - sig/lrama/report/profile.rbs
140
145
  - sig/lrama/warning.rbs