kumi-parser 0.0.6 → 0.0.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 119563dd70c4e400274c70034d942036f1c07e8525d94dbb1a78fcd9f850be9b
|
4
|
+
data.tar.gz: 77e331ee47ac3428e2a13e58b461367d2a7d44756515e976cfc54a12a4749a90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a7802b011dc8e21c890e9fb3f0c981c856bd03a39c277479fc1e2736de08c345e72085407fb07c5d339b3cd948bfc81e40d19257572f6b415d16a14f68d466
|
7
|
+
data.tar.gz: a08624024f172abc6602e238c09c6250f23c082b7d7580e8289ad318aec7c41787d039ddf154cdbf8ec60929b4095e23d2585307612717117c8d6befc878cf94
|
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'token_metadata'
|
4
|
+
require_relative 'token'
|
5
|
+
require_relative 'errors'
|
4
6
|
|
5
7
|
module Kumi
|
6
8
|
module Parser
|
@@ -243,6 +245,20 @@ module Kumi
|
|
243
245
|
location = Kumi::Syntax::Location.new(file: @source_file, line: @line, column: start_column)
|
244
246
|
@tokens << Token.new(:lt, '<', location, Kumi::Parser::TOKEN_METADATA[:lt])
|
245
247
|
end
|
248
|
+
when '*'
|
249
|
+
if peek_char == '*'
|
250
|
+
advance
|
251
|
+
advance
|
252
|
+
location = Kumi::Syntax::Location.new(file: @source_file, line: @line, column: start_column)
|
253
|
+
@tokens << Token.new(:exponent, '**', location, Kumi::Parser::TOKEN_METADATA[:exponent])
|
254
|
+
else
|
255
|
+
# Single asterisk: fall through to single character handling
|
256
|
+
token_type = CHAR_TO_TOKEN[char]
|
257
|
+
metadata = Kumi::Parser::TOKEN_METADATA[token_type].dup
|
258
|
+
location = Kumi::Syntax::Location.new(file: @source_file, line: @line, column: start_column)
|
259
|
+
@tokens << Token.new(token_type, char, location, metadata)
|
260
|
+
advance
|
261
|
+
end
|
246
262
|
when '.'
|
247
263
|
if peek_char == '.'
|
248
264
|
advance
|
@@ -36,6 +36,7 @@ module Kumi
|
|
36
36
|
FN = :fn
|
37
37
|
|
38
38
|
# Operators (by precedence)
|
39
|
+
EXPONENT = :exponent # **
|
39
40
|
MULTIPLY = :multiply # *
|
40
41
|
DIVIDE = :divide # /
|
41
42
|
MODULO = :modulo # %
|
@@ -151,6 +152,12 @@ module Kumi
|
|
151
152
|
},
|
152
153
|
|
153
154
|
# Operators with precedence and associativity
|
155
|
+
exponent: {
|
156
|
+
category: :operator,
|
157
|
+
precedence: 7,
|
158
|
+
associativity: :right,
|
159
|
+
arity: :binary
|
160
|
+
},
|
154
161
|
multiply: {
|
155
162
|
category: :operator,
|
156
163
|
precedence: 6,
|
data/lib/kumi/parser/version.rb
CHANGED