kumi-parser 0.0.30 → 0.0.32
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 +7 -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: a48abb72f68e3db4876b1e3d7a56563f048046a34524359a042829d7a98360dd
|
|
4
|
+
data.tar.gz: 8ae0bb61111aa3179a8e097b7a4f0b9f47f11e6b20d71aa48a51742eaed84487
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92bd51d6b1df52e197c912226a04dedb94fb162d9f8302ead05a1e6f5acd2917124909f0d212564c50ae74ab92b17c579871463f9fe8bb4bf43c8cc23802dfba
|
|
7
|
+
data.tar.gz: 89c50b842361f72dc4249b129532425efae1089e7729deb1b9b5d9bcdcda41afd6f5ae994b5dce4b78526c8a28d68579ac7aa17a82c5ee6356dbd4727e882aa5
|
|
@@ -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
|
|
@@ -417,6 +422,7 @@ module Kumi
|
|
|
417
422
|
'select' => '__select__',
|
|
418
423
|
'shift' => 'shift',
|
|
419
424
|
'roll' => 'roll',
|
|
425
|
+
'cross' => 'cross',
|
|
420
426
|
'index' => 'index',
|
|
421
427
|
'to_decimal' => 'to_decimal',
|
|
422
428
|
'to_integer' => 'to_integer',
|
|
@@ -432,6 +438,7 @@ module Kumi
|
|
|
432
438
|
'let' => :let,
|
|
433
439
|
'trait' => :trait,
|
|
434
440
|
'import' => :import,
|
|
441
|
+
'codegen' => :codegen,
|
|
435
442
|
'from' => :from,
|
|
436
443
|
'do' => :do,
|
|
437
444
|
'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.32
|
|
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-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: parslet
|