kumi-parser 0.0.30 → 0.0.31
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/lib/kumi/parser/direct_parser.rb +34 -0
- data/lib/kumi/parser/token_constants.rb +6 -0
- data/lib/kumi/parser/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fe93181ef41b314a4f54f493421ec310f55e3c5d2b9f095aac23f047a03c18b
|
|
4
|
+
data.tar.gz: f85b995019ffa3e93d124ace608694b1c67342acee419601977d995d5d5c7c28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f2a820269a5d73a222f8c83fb8dce8b7df19ed424afbe2a6fe3eea40b42e425c55c9dc84989c30f458966685ee0da03b5d7700c00b70a4d3ec82b312954d54b
|
|
7
|
+
data.tar.gz: ec04563982bff87bf05336450d8f5908f728d73cd83122a124d62330111a6b3d57a7bcf6585da6b21075e017762db82ee470c09b49f7bb30dfeb1b0b01128c81
|
|
@@ -64,6 +64,7 @@ module Kumi
|
|
|
64
64
|
skip_comments_and_newlines
|
|
65
65
|
import_declarations = parse_imports
|
|
66
66
|
@imported_names.merge(import_declarations.flat_map(&:names))
|
|
67
|
+
root_hints = parse_codegen_directives
|
|
67
68
|
|
|
68
69
|
input_declarations = parse_input_block
|
|
69
70
|
|
|
@@ -90,10 +91,43 @@ module Kumi
|
|
|
90
91
|
value_declarations, # values
|
|
91
92
|
trait_declarations,
|
|
92
93
|
import_declarations,
|
|
94
|
+
hints: root_hints,
|
|
93
95
|
loc: schema_token.location
|
|
94
96
|
)
|
|
95
97
|
end
|
|
96
98
|
|
|
99
|
+
def parse_codegen_directives
|
|
100
|
+
hints = {}
|
|
101
|
+
skip_comments_and_newlines
|
|
102
|
+
|
|
103
|
+
while current_token.type == :codegen
|
|
104
|
+
expect_token(:codegen)
|
|
105
|
+
opts = parse_codegen_options
|
|
106
|
+
hints[:codegen] = (hints[:codegen] || {}).merge(opts)
|
|
107
|
+
skip_comments_and_newlines
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
hints
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def parse_codegen_options
|
|
114
|
+
opts = {}
|
|
115
|
+
|
|
116
|
+
loop do
|
|
117
|
+
key_token = expect_token(:label)
|
|
118
|
+
raise_parse_error("Unknown codegen option '#{key_token.value}'") unless key_token.value == 'streaming'
|
|
119
|
+
|
|
120
|
+
value_token = expect_token(:boolean)
|
|
121
|
+
opts[:streaming] = value_token.value == 'true'
|
|
122
|
+
break unless current_token.type == :comma
|
|
123
|
+
|
|
124
|
+
expect_token(:comma)
|
|
125
|
+
skip_comments_and_newlines
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
opts
|
|
129
|
+
end
|
|
130
|
+
|
|
97
131
|
# Parse import declarations: 'import' :symbol, from: Module
|
|
98
132
|
def parse_imports
|
|
99
133
|
imports = []
|
|
@@ -21,6 +21,7 @@ module Kumi
|
|
|
21
21
|
VALUE = :value
|
|
22
22
|
TRAIT = :trait
|
|
23
23
|
IMPORT = :import
|
|
24
|
+
CODEGEN = :codegen
|
|
24
25
|
FROM = :from
|
|
25
26
|
DO = :do
|
|
26
27
|
END_KW = :end
|
|
@@ -106,6 +107,10 @@ module Kumi
|
|
|
106
107
|
category: :keyword,
|
|
107
108
|
import_declaration: true
|
|
108
109
|
},
|
|
110
|
+
codegen: {
|
|
111
|
+
category: :keyword,
|
|
112
|
+
schema_directive: true
|
|
113
|
+
},
|
|
109
114
|
from: {
|
|
110
115
|
category: :keyword,
|
|
111
116
|
import_source: true
|
|
@@ -432,6 +437,7 @@ module Kumi
|
|
|
432
437
|
'let' => :let,
|
|
433
438
|
'trait' => :trait,
|
|
434
439
|
'import' => :import,
|
|
440
|
+
'codegen' => :codegen,
|
|
435
441
|
'from' => :from,
|
|
436
442
|
'do' => :do,
|
|
437
443
|
'end' => :end,
|
data/lib/kumi/parser/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kumi-parser
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.31
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kumi Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-06-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parslet
|