lrama 0.5.5 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.5
4
+ version: 0.5.7
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-08-28 00:00:00.000000000 Z
11
+ date: 2023-10-23 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"
@@ -54,9 +56,10 @@ files:
54
56
  - lib/lrama/lexer.rb
55
57
  - lib/lrama/lexer/token.rb
56
58
  - lib/lrama/lexer/token/type.rb
59
+ - lib/lrama/option_parser.rb
60
+ - lib/lrama/options.rb
57
61
  - lib/lrama/output.rb
58
62
  - lib/lrama/parser.rb
59
- - lib/lrama/parser/token_scanner.rb
60
63
  - lib/lrama/report.rb
61
64
  - lib/lrama/report/duration.rb
62
65
  - lib/lrama/report/profile.rb
@@ -73,15 +76,19 @@ files:
73
76
  - lib/lrama/version.rb
74
77
  - lib/lrama/warning.rb
75
78
  - lrama.gemspec
79
+ - parser.y
76
80
  - rbs_collection.lock.yaml
77
81
  - rbs_collection.yaml
78
82
  - sample/calc.output
79
83
  - sample/calc.y
80
84
  - sample/parse.y
81
85
  - sig/lrama/bitmap.rbs
86
+ - sig/lrama/digraph.rbs
87
+ - sig/lrama/lexer/token/type.rbs
82
88
  - sig/lrama/report/duration.rbs
83
89
  - sig/lrama/report/profile.rbs
84
90
  - sig/lrama/warning.rbs
91
+ - template/bison/_yacc.h
85
92
  - template/bison/yacc.c
86
93
  - template/bison/yacc.h
87
94
  homepage: https://github.com/ruby/lrama
@@ -103,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
110
  - !ruby/object:Gem::Version
104
111
  version: '0'
105
112
  requirements: []
106
- rubygems_version: 3.4.1
113
+ rubygems_version: 3.5.0.dev
107
114
  signing_key:
108
115
  specification_version: 4
109
116
  summary: LALR (1) parser generator written by Ruby
@@ -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