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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +2 -3
- data/Gemfile +1 -1
- data/NEWS.md +107 -1
- data/Steepfile +3 -0
- data/lib/lrama/grammar/code/destructor_code.rb +40 -0
- data/lib/lrama/grammar/code.rb +1 -0
- data/lib/lrama/grammar/destructor.rb +9 -0
- data/lib/lrama/grammar/rule_builder.rb +4 -3
- data/lib/lrama/grammar/stdlib.y +42 -0
- data/lib/lrama/grammar/symbol.rb +4 -2
- data/lib/lrama/grammar/symbols/resolver.rb +21 -4
- data/lib/lrama/grammar.rb +8 -1
- data/lib/lrama/lexer/token/user_code.rb +2 -0
- data/lib/lrama/lexer/token.rb +1 -1
- data/lib/lrama/lexer.rb +1 -0
- data/lib/lrama/option_parser.rb +25 -12
- data/lib/lrama/options.rb +1 -0
- data/lib/lrama/output.rb +19 -0
- data/lib/lrama/parser.rb +143 -134
- data/lib/lrama/version.rb +1 -1
- data/parser.y +9 -1
- data/sig/lrama/grammar/binding.rbs +0 -1
- data/sig/lrama/grammar/code/destructor_code.rbs +15 -0
- data/sig/lrama/grammar/destructor.rbs +11 -0
- data/sig/lrama/grammar/parameterizing_rule/resolver.rbs +0 -1
- data/sig/lrama/grammar/reference.rbs +0 -1
- data/sig/lrama/grammar/symbol.rbs +1 -0
- data/sig/lrama/lexer/token/user_code.rbs +1 -0
- data/sig/lrama/options.rbs +17 -0
- data/template/bison/yacc.c +6 -1
- metadata +7 -2
data/lib/lrama/version.rb
CHANGED
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
|
@@ -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
|
|
@@ -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
|
data/template/bison/yacc.c
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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
|