lrama 0.5.6 → 0.5.8

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.
@@ -37,76 +37,4 @@
37
37
  /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38
38
  especially those whose name start with YY_ or yy_. They are
39
39
  private implementation details that can be changed or removed. */
40
-
41
- <%# b4_shared_declarations -%>
42
- <%# b4_shared_declarations -%>
43
- <%-# b4_cpp_guard_open([b4_spec_mapped_header_file]) -%>
44
- <%- if output.spec_mapped_header_file -%>
45
- #ifndef <%= output.b4_cpp_guard__b4_spec_mapped_header_file %>
46
- # define <%= output.b4_cpp_guard__b4_spec_mapped_header_file %>
47
- <%- end -%>
48
- <%-# b4_declare_yydebug & b4_YYDEBUG_define -%>
49
- /* Debug traces. */
50
- #ifndef YYDEBUG
51
- # define YYDEBUG 0
52
- #endif
53
- #if YYDEBUG
54
- extern int yydebug;
55
- #endif
56
- <%-# b4_percent_code_get([[requires]]). %code is not supported -%>
57
-
58
- <%-# b4_token_enums_defines -%>
59
- /* Token kinds. */
60
- #ifndef YYTOKENTYPE
61
- # define YYTOKENTYPE
62
- enum yytokentype
63
- {
64
- <%= output.token_enums -%>
65
- };
66
- typedef enum yytokentype yytoken_kind_t;
67
- #endif
68
-
69
- <%-# b4_declare_yylstype -%>
70
- <%-# b4_value_type_define -%>
71
- /* Value type. */
72
- #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
73
- union YYSTYPE
74
- {
75
- #line <%= output.grammar.union.lineno %> "<%= output.grammar_file_path %>"
76
- <%= output.grammar.union.braces_less_code %>
77
- #line [@oline@] [@ofile@]
78
-
79
- };
80
- typedef union YYSTYPE YYSTYPE;
81
- # define YYSTYPE_IS_TRIVIAL 1
82
- # define YYSTYPE_IS_DECLARED 1
83
- #endif
84
-
85
- <%-# b4_location_type_define -%>
86
- /* Location type. */
87
- #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
88
- typedef struct YYLTYPE YYLTYPE;
89
- struct YYLTYPE
90
- {
91
- int first_line;
92
- int first_column;
93
- int last_line;
94
- int last_column;
95
- };
96
- # define YYLTYPE_IS_DECLARED 1
97
- # define YYLTYPE_IS_TRIVIAL 1
98
- #endif
99
-
100
-
101
-
102
-
103
- <%-# b4_declare_yyerror_and_yylex. Not supported -%>
104
- <%-# b4_declare_yyparse -%>
105
- int yyparse (<%= output.parse_param %>);
106
-
107
-
108
- <%-# b4_percent_code_get([[provides]]). %code is not supported -%>
109
- <%-# b4_cpp_guard_close([b4_spec_mapped_header_file]) -%>
110
- <%- if output.spec_mapped_header_file -%>
111
- #endif /* !<%= output.b4_cpp_guard__b4_spec_mapped_header_file %> */
112
- <%- end -%>
40
+ <%= output.render_partial("bison/_yacc.h") %>
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.5.6
4
+ version: 0.5.8
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-09-13 00:00:00.000000000 Z
11
+ date: 2023-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: LALR (1) parser generator written by Ruby
14
14
  email:
@@ -18,7 +18,9 @@ executables:
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".codespellignore"
21
22
  - ".github/dependabot.yml"
23
+ - ".github/workflows/codespell.yaml"
22
24
  - ".github/workflows/test.yaml"
23
25
  - ".gitignore"
24
26
  - ".rspec"
@@ -58,7 +60,6 @@ files:
58
60
  - lib/lrama/options.rb
59
61
  - lib/lrama/output.rb
60
62
  - lib/lrama/parser.rb
61
- - lib/lrama/parser/token_scanner.rb
62
63
  - lib/lrama/report.rb
63
64
  - lib/lrama/report/duration.rb
64
65
  - lib/lrama/report/profile.rb
@@ -75,15 +76,19 @@ files:
75
76
  - lib/lrama/version.rb
76
77
  - lib/lrama/warning.rb
77
78
  - lrama.gemspec
79
+ - parser.y
78
80
  - rbs_collection.lock.yaml
79
81
  - rbs_collection.yaml
80
82
  - sample/calc.output
81
83
  - sample/calc.y
82
84
  - sample/parse.y
83
85
  - sig/lrama/bitmap.rbs
86
+ - sig/lrama/digraph.rbs
87
+ - sig/lrama/lexer/token/type.rbs
84
88
  - sig/lrama/report/duration.rbs
85
89
  - sig/lrama/report/profile.rbs
86
90
  - sig/lrama/warning.rbs
91
+ - template/bison/_yacc.h
87
92
  - template/bison/yacc.c
88
93
  - template/bison/yacc.h
89
94
  homepage: https://github.com/ruby/lrama
@@ -1,56 +0,0 @@
1
- module Lrama
2
- class Parser
3
- class TokenScanner
4
- def initialize(tokens)
5
- @tokens = tokens
6
- @index = 0
7
- end
8
-
9
- def current_token
10
- @tokens[@index]
11
- end
12
-
13
- def current_type
14
- current_token&.type
15
- end
16
-
17
- def previous_token
18
- @tokens[@index - 1]
19
- end
20
-
21
- def next
22
- token = current_token
23
- @index += 1
24
- return token
25
- end
26
-
27
- def consume(*token_types)
28
- if token_types.include?(current_type)
29
- return self.next
30
- end
31
-
32
- return nil
33
- end
34
-
35
- def consume!(*token_types)
36
- consume(*token_types) || (raise "#{token_types} is expected but #{current_type}. #{current_token}")
37
- end
38
-
39
- def consume_multi(*token_types)
40
- a = []
41
-
42
- while token_types.include?(current_type)
43
- a << self.next
44
- end
45
-
46
- raise "No token is consumed. #{token_types}" if a.empty?
47
-
48
- return a
49
- end
50
-
51
- def eots?
52
- current_token.nil?
53
- end
54
- end
55
- end
56
- end