mvinl 0.1.4 → 0.1.5
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/bin/imvnl +5 -3
- data/lib/mvinl/context.rb +24 -0
- data/lib/mvinl/info.rb +2 -2
- data/lib/mvinl/lexer.rb +21 -15
- data/lib/mvinl/parser.rb +13 -7
- data/lib/mvinl.rb +16 -3
- data/rakelib/build.rake +4 -25
- data/spec/program_spec.rb +62 -33
- data/syntax/mvinl.tab.rb +237 -190
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ceac64e8ec7e1ff3f8fab41d82d4b69a577098bca195f7ed01205dfc3b54b2d
|
4
|
+
data.tar.gz: f8592113d9ac37d001048f8f49c4e46e4c1f09d6209e32800f73f821549fab61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31891e65cde3f3de7124ec7665eaf89561f3a5db04201e03c316ee214e09b5d67db5f79d108eee5ddeae30daaddea187dbe27bcec2881aa7ff1bb4970b50536
|
7
|
+
data.tar.gz: 2b05bef7791eec6129ba210fd146f3ea575098d7ab70afe44cf709297319d2915ad7d5c876cf0dfe64a9f177dc299bb46a17a3769ed40d0317b77d6d0ebdbeb2
|
data/bin/imvnl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen-string-literal: true
|
3
3
|
|
4
|
-
=begin
|
4
|
+
=begin imvnl
|
5
5
|
Copyright (c) 2018, 2024, Daniel Sierpiński All rights reserved.
|
6
6
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -27,14 +27,16 @@ require 'readline'
|
|
27
27
|
require 'pry'
|
28
28
|
require 'mvinl/lexer'
|
29
29
|
require 'mvinl/parser'
|
30
|
+
require 'mvinl/context'
|
30
31
|
require 'mvinl/info'
|
31
32
|
|
32
33
|
PSL = "mvnl(#{MVinl::Version})".freeze
|
33
34
|
PS1 = "#{PSL}>".freeze
|
34
35
|
|
35
36
|
module MVinl::REPL
|
36
|
-
|
37
|
-
|
37
|
+
CONTEXT = MVinl::Context.new
|
38
|
+
LEXER = MVinl::Lexer.new(CONTEXT, '')
|
39
|
+
PARSER = MVinl::Parser.new(LEXER, CONTEXT)
|
38
40
|
|
39
41
|
def self.run
|
40
42
|
while (input = Readline.readline("#{PS1} ", true))
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen-string-literal: true
|
2
|
+
|
3
|
+
module MVinl
|
4
|
+
# Lexer and parser shared context
|
5
|
+
class Context
|
6
|
+
attr_accessor :variables, :functions, :state
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
reset
|
10
|
+
end
|
11
|
+
|
12
|
+
def reset
|
13
|
+
@variables = {}
|
14
|
+
@functions = {}
|
15
|
+
@state = {
|
16
|
+
in_prop: false,
|
17
|
+
in_var: false,
|
18
|
+
in_keyword_arg: false,
|
19
|
+
keyword_arg_depth: 0,
|
20
|
+
depth: 0
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/mvinl/info.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# info.rb
|
4
4
|
# Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
#
|
6
6
|
# See Copyright Notice in mvnil.rb
|
7
7
|
|
8
8
|
module MVinl
|
9
|
-
VERSION = '0.1.
|
9
|
+
VERSION = '0.1.5'
|
10
10
|
Version = VERSION
|
11
11
|
Copyright = 'Copyright (c) 2024, Daniel Sierpiński'
|
12
12
|
end
|
data/lib/mvinl/lexer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin lexer.rb
|
4
4
|
Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
See Copyright Notice in mvnil.rb
|
@@ -28,6 +28,7 @@ module MVinl
|
|
28
28
|
KEYWORD_ARG: /(#{ID_REGEX}):/,
|
29
29
|
ID: ID_REGEX,
|
30
30
|
GROUP: /@(#{ID_REGEX})/,
|
31
|
+
VARIABLE: /!(#{ID_REGEX})/,
|
31
32
|
FLOAT: /[+-]?\d+\.\d+/,
|
32
33
|
NUMBER: /[+-]?\d+/,
|
33
34
|
MULTILINE_STRING: /"((?:\\.|[^"\\])*)"\s*\\\s*/,
|
@@ -38,7 +39,8 @@ module MVinl
|
|
38
39
|
END_TAG: /\./
|
39
40
|
}.freeze
|
40
41
|
|
41
|
-
def initialize(input)
|
42
|
+
def initialize(context, input = '')
|
43
|
+
@context = context
|
42
44
|
@ss = StringScanner.new(input)
|
43
45
|
@args_n = 0
|
44
46
|
@in_group = false
|
@@ -52,6 +54,11 @@ module MVinl
|
|
52
54
|
def next_token
|
53
55
|
return process_eos if @ss.eos?
|
54
56
|
|
57
|
+
# Check if variable name been used
|
58
|
+
@context.variables.each_key do |var_name|
|
59
|
+
return [:VARIABLE_CALL, @context.variables[var_name]] if @ss.scan(/\A#{Regexp.escape var_name.to_s}\b/)
|
60
|
+
end
|
61
|
+
|
55
62
|
TOKENS.each do |type, regex|
|
56
63
|
if @ss.scan regex
|
57
64
|
@last_type = type
|
@@ -72,13 +79,13 @@ module MVinl
|
|
72
79
|
next_token
|
73
80
|
when :OPEN_PAREN then [:OPEN_PAREN, '(']
|
74
81
|
when :CLOSE_PAREN
|
75
|
-
unless
|
82
|
+
unless @context.state[:depth].positive?
|
76
83
|
raise UnexpectedTokenError, 'CLOSE_PARAM found with no matching OPEN_PARAM'
|
77
84
|
end
|
78
85
|
|
79
86
|
[:CLOSE_PAREN, ')']
|
80
87
|
when :OPER
|
81
|
-
unless
|
88
|
+
unless @context.state[:depth].positive?
|
82
89
|
raise UnexpectedTokenError, 'OPER found with no matching OPEN_PARAM'
|
83
90
|
end
|
84
91
|
|
@@ -88,30 +95,29 @@ module MVinl
|
|
88
95
|
|
89
96
|
[:KEYWORD, @ss.matched]
|
90
97
|
when :KEYWORD_ARG
|
91
|
-
if
|
98
|
+
if !@context.state[:in_prop]
|
92
99
|
raise UnexpectedTokenError, 'Looking for identifier but found KEYWORD_ARG'
|
93
|
-
elsif
|
100
|
+
elsif @context.state[:in_keyword_arg]
|
94
101
|
raise UnexpectedTokenError, 'Looking for a keyword argument value but found KEYWORD_ARG'
|
95
102
|
end
|
96
103
|
|
97
104
|
[:KEYWORD_ARG, @ss[1]]
|
98
105
|
when :GROUP
|
99
106
|
# Group gets canceled whenever encountered another group id or a matching end tag
|
100
|
-
if
|
107
|
+
if @context.state[:in_keyword_arg]
|
101
108
|
raise UnexpectedTokenError, 'Looking for a keyword argument value but found GROUP'
|
102
109
|
end
|
103
110
|
|
104
111
|
@in_group = true
|
105
112
|
[:GROUP, @ss[1]]
|
113
|
+
when :VARIABLE then [:VARIABLE, @ss[1]]
|
106
114
|
when :ID then [:ID, @ss.matched]
|
107
|
-
when :MULTILINE_STRING
|
108
|
-
[:MULTILINE_STRING, @ss[1]]
|
109
|
-
when :NUMBER, :FLOAT, :STRING, :SYMBOL
|
115
|
+
when :NUMBER, :FLOAT, :STRING, :SYMBOL, :MULTILINE_STRING
|
110
116
|
# Values can't be used outside an property or a lambda
|
111
|
-
if
|
117
|
+
if !@context.state[:in_prop] && !@context.state[:depth].positive? && !@context.state[:in_var]
|
112
118
|
raise UnexpectedTokenError, "Looking for ID or OPEN_PAREN but found #{@last_type}"
|
113
|
-
elsif
|
114
|
-
|
119
|
+
elsif !@context.state[:in_keyword_arg] && @context.state[:keyword_arg_depth].positive? &&
|
120
|
+
!@context.state[:depth].positive? && !@context.state[:in_var]
|
115
121
|
raise UnexpectedTokenError, "Looking for END_TAG or KEYWORD_ARG but found #{@last_type}"
|
116
122
|
end
|
117
123
|
|
@@ -140,8 +146,8 @@ module MVinl
|
|
140
146
|
|
141
147
|
# Auto end properties
|
142
148
|
lookahead = @ss.check(/\A(?:#{TOKENS[:GROUP]}|#{TOKENS[:ID]}$|#{TOKENS[:END_TAG]}|#{TOKENS[:NEW_LINE]})/)
|
143
|
-
warn "Continue? in_prop?: #{
|
144
|
-
|
149
|
+
warn "Continue? in_prop?: #{@context.state[:in_prop].inspect}, lookahead: #{lookahead.inspect}"
|
150
|
+
@context.state[:in_prop] ? !lookahead : true
|
145
151
|
end
|
146
152
|
|
147
153
|
# Move the cursor to the next new line tag
|
data/lib/mvinl/parser.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin parser.rb
|
4
4
|
Copyright (c) 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
See Copyright Notice in mvnil.rb
|
@@ -8,15 +8,25 @@ See Copyright Notice in mvnil.rb
|
|
8
8
|
|
9
9
|
require 'mvinl.tab'
|
10
10
|
|
11
|
+
# Generated parser class
|
11
12
|
class MVinl::Parser < MVinl::Program
|
12
|
-
def initialize(lexer, debug: false)
|
13
|
-
@yydebug = debug
|
13
|
+
def initialize(lexer, context, debug: false)
|
14
14
|
@lexer = lexer
|
15
|
+
@context = context
|
16
|
+
@yydebug = debug
|
15
17
|
@tokens = []
|
16
18
|
@done = false
|
17
19
|
super()
|
18
20
|
end
|
19
21
|
|
22
|
+
def parse
|
23
|
+
do_parse
|
24
|
+
end
|
25
|
+
|
26
|
+
def feed(input)
|
27
|
+
@lexer.feed input
|
28
|
+
end
|
29
|
+
|
20
30
|
def next_token
|
21
31
|
if @tokens.empty?
|
22
32
|
@lexer.next_token
|
@@ -36,8 +46,4 @@ class MVinl::Parser < MVinl::Program
|
|
36
46
|
def parsing_done?
|
37
47
|
@done && @tokens.empty?
|
38
48
|
end
|
39
|
-
|
40
|
-
def parse
|
41
|
-
do_parse
|
42
|
-
end
|
43
49
|
end
|
data/lib/mvinl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
=begin
|
3
|
+
=begin mvinl.rb
|
4
4
|
Copyright (c) 2018, 2024, Daniel Sierpiński All rights reserved.
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -24,14 +24,27 @@ THE SOFTWARE.
|
|
24
24
|
|
25
25
|
require 'mvinl/parser'
|
26
26
|
require 'mvinl/lexer'
|
27
|
+
require 'mvinl/context'
|
27
28
|
|
29
|
+
# Library entry point
|
28
30
|
module MVinl
|
31
|
+
@context = Context.new
|
32
|
+
@parser = Parser.new(Lexer.new(@context, ''), @context)
|
33
|
+
|
29
34
|
def self.eval(input)
|
30
|
-
parser
|
31
|
-
parser.parse
|
35
|
+
@parser.feed input
|
36
|
+
@parser.parse
|
32
37
|
end
|
33
38
|
|
34
39
|
def self.eval_from_file(path)
|
35
40
|
self.eval File.read(path)
|
36
41
|
end
|
42
|
+
|
43
|
+
def self.context
|
44
|
+
@context
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.reset
|
48
|
+
@context.reset
|
49
|
+
end
|
37
50
|
end
|
data/rakelib/build.rake
CHANGED
@@ -1,32 +1,11 @@
|
|
1
1
|
# frozen-string-literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'mvinl/info'
|
3
|
+
require 'bundler/gem_tasks'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
GRAMMAR_FILE = 'syntax/mvinl.y'
|
10
|
-
COMPILED_FILE = 'syntax/mvinl.tab.rb'
|
11
|
-
|
12
|
-
gemspec = Gem::Specification.load 'mvinl.gemspec'
|
13
|
-
gemfile = "#{gemspec.name}-#{gemspec.version}.gem"
|
14
|
-
|
15
|
-
task push: [:build] do
|
16
|
-
#binding.pry
|
17
|
-
system('gem', 'push', '-v', Shellwords.escape(gemspec.version.to_s), Shellwords.escape(gemspec.name))
|
18
|
-
end
|
19
|
-
|
20
|
-
task install: [:build] do
|
21
|
-
Gem.install(gemfile)
|
22
|
-
puts "Installed #{gemfile}"
|
23
|
-
end
|
24
|
-
|
25
|
-
task build: [:compile] do
|
26
|
-
Gem::Package.build(gemspec)
|
27
|
-
puts "Build #{gemfile}"
|
28
|
-
end
|
5
|
+
desc 'Push MVinl gem; use this task in stead of \'release\''
|
6
|
+
task push: %I[compile build release]
|
29
7
|
|
8
|
+
desc 'Compile the grammar file'
|
30
9
|
task :compile do
|
31
10
|
system('racc', GRAMMAR_FILE, '-o', COMPILED_FILE)
|
32
11
|
end
|
data/spec/program_spec.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative 'spec_helper'
|
4
4
|
require 'mvinl'
|
5
|
+
require 'pry'
|
5
6
|
|
6
7
|
describe MVinl, '#eval' do
|
7
8
|
context 'no input' do
|
@@ -10,78 +11,106 @@ describe MVinl, '#eval' do
|
|
10
11
|
expect(result).to eq({})
|
11
12
|
end
|
12
13
|
end
|
14
|
+
|
13
15
|
context 'groups' do
|
14
16
|
it 'retruns a single group' do
|
15
17
|
result = MVinl.eval('@x')
|
16
18
|
expect(result).to eq({ x: {} })
|
17
19
|
end
|
18
|
-
|
19
20
|
it 'returns two groups' do
|
20
21
|
result = MVinl.eval('@x @y')
|
21
22
|
expect(result).to eq({ x: {}, y: {} })
|
22
23
|
end
|
23
24
|
end
|
25
|
+
|
24
26
|
context 'properties' do
|
25
27
|
it 'return a single property' do
|
26
28
|
result = MVinl.eval('@x a')
|
27
29
|
expect(result).to eq({ x: { a: [[], {}] } })
|
28
30
|
end
|
29
|
-
|
30
31
|
it 'returns two properties' do
|
31
32
|
result = MVinl.eval('@x a b')
|
32
33
|
expect(result).to eq({ x: { a: [[], {}], b: [[], {}] } })
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
37
|
+
context 'variables' do
|
38
|
+
it 'stores a single variable' do
|
39
|
+
MVinl.eval('!n 0')
|
40
|
+
expect(MVinl.context.variables[:n]).to be_truthy
|
41
|
+
end
|
42
|
+
it 'stores a two variables' do
|
43
|
+
MVinl.eval('!n 3 !m 6')
|
44
|
+
expect(MVinl.context.variables[:n] && MVinl.context.variables[:m]).to be_truthy
|
45
|
+
end
|
46
|
+
it 'stores a single variable with it\'s value' do
|
47
|
+
MVinl.eval('!n 5')
|
48
|
+
expect(MVinl.context.variables[:n]).to eq 5
|
49
|
+
end
|
50
|
+
it 'evaluates a single variable' do
|
51
|
+
result = MVinl.eval('!n 5 x n')
|
52
|
+
expect(result).to eq({ x: [[5], {}] })
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
36
56
|
context 'functions' do
|
37
|
-
it '
|
57
|
+
it 'stores function definition with \'+\' OPER and no arguments' do
|
38
58
|
MVinl.eval('def (f (+ 1))')
|
39
|
-
expect(MVinl
|
59
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:+, 1] } })
|
40
60
|
end
|
41
|
-
|
42
|
-
it 'Stores function definition with \'-\' OPER and no arguments' do
|
61
|
+
it 'stores function definition with \'-\' OPER and no arguments' do
|
43
62
|
MVinl.eval('def (f (- 1))')
|
44
|
-
expect(MVinl
|
63
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:-, 1] } })
|
45
64
|
end
|
46
|
-
|
47
|
-
it 'Stores function definition with \'*\' OPER and no arguments' do
|
65
|
+
it 'stores function definition with \'*\' OPER and no arguments' do
|
48
66
|
MVinl.eval('def (f (* 1))')
|
49
|
-
expect(MVinl
|
67
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:*, 1] } })
|
50
68
|
end
|
51
|
-
|
52
|
-
it 'Stores function definition with \'/\' OPER and no arguments' do
|
69
|
+
it 'stores function definition with \'/\' OPER and no arguments' do
|
53
70
|
MVinl.eval('def (f (/ 1))')
|
54
|
-
expect(MVinl
|
71
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:/, 1] } })
|
55
72
|
end
|
56
|
-
|
57
|
-
it 'Stores function definition with \'%\' OPER and no arguments' do
|
73
|
+
it 'stores function definition with \'%\' OPER and no arguments' do
|
58
74
|
MVinl.eval('def (f (% 1))')
|
59
|
-
expect(MVinl
|
75
|
+
expect(MVinl.context.functions).to eq({ f: { args: [], body: [:%, 1] } })
|
60
76
|
end
|
61
|
-
|
62
|
-
it 'Stores function definition with a single argument' do
|
77
|
+
it 'stores function definition with a single argument' do
|
63
78
|
MVinl.eval('def (f a (+ a a))')
|
64
|
-
expect(MVinl
|
79
|
+
expect(MVinl.context.functions).to eq({ f: { args: %I[a], body: %I[+ a a] } })
|
65
80
|
end
|
66
|
-
|
67
|
-
it 'Stores function definition with two arguments' do
|
81
|
+
it 'stores function definition with two arguments' do
|
68
82
|
MVinl.eval('def (f a b (+ a b))')
|
69
|
-
expect(MVinl
|
83
|
+
expect(MVinl.context.functions).to eq({ f: { args: %I[a b], body: %I[+ a b] } })
|
70
84
|
end
|
71
|
-
|
72
|
-
|
73
|
-
result
|
74
|
-
expect(result).to eq({ x: { x: [[4], {}] } })
|
85
|
+
it 'evaluates anonimous function' do
|
86
|
+
result = MVinl.eval('x (+ 2 2)')
|
87
|
+
expect(result).to eq({ x: [[4], {}] })
|
75
88
|
end
|
76
|
-
|
77
|
-
|
78
|
-
result
|
79
|
-
|
89
|
+
it 'evaluates function' do
|
90
|
+
result = MVinl.eval('def (foo (+ 5)) x (foo)')
|
91
|
+
expect(result).to eq({ x: [[5], {}] })
|
92
|
+
end
|
93
|
+
it 'evaluates function calling another function' do
|
94
|
+
result = MVinl.eval('def (foo (+ 5)) def (bar (foo)) x (bar)')
|
95
|
+
expect(result).to eq({ x: [[5], {}] })
|
96
|
+
end
|
97
|
+
it 'evaluates function inside a variable' do
|
98
|
+
MVinl.eval('def (foo (+ 7)) !n (foo)')
|
99
|
+
expect(MVinl.context.variables[:n]).to eq 7
|
80
100
|
end
|
101
|
+
end
|
102
|
+
end
|
81
103
|
|
82
|
-
|
83
|
-
|
84
|
-
|
104
|
+
describe MVinl, '#eval_from_file' do
|
105
|
+
context 'stack example' do
|
106
|
+
it 'evaluates a basic example' do
|
107
|
+
MVinl.reset
|
108
|
+
result = MVinl.eval_from_file('spec/stack.mvnl')
|
109
|
+
expect(result).to eq({ menu: { Menu: [[], { New_Game: :state_next, Exit: :abord }] },
|
110
|
+
game: { Mouse: [[], {}], Board: [[3, 3], {}],
|
111
|
+
Button: [[' Hello Vinl!'], {
|
112
|
+
line_height: 25, padding: 8
|
113
|
+
}] } })
|
85
114
|
end
|
86
115
|
end
|
87
116
|
end
|
data/syntax/mvinl.tab.rb
CHANGED
@@ -8,22 +8,13 @@ require 'racc/parser.rb'
|
|
8
8
|
module MVinl
|
9
9
|
class Program < Racc::Parser
|
10
10
|
|
11
|
-
module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y',
|
12
|
-
|
13
|
-
FUNCTIONS = {}
|
14
|
-
STATE = {
|
15
|
-
in_prop: false,
|
16
|
-
in_keyword_arg: false,
|
17
|
-
keyword_arg_depth: 0,
|
18
|
-
depth: 0
|
19
|
-
}
|
20
|
-
|
11
|
+
module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 121)
|
21
12
|
class MVinl::ParserError < StandardError; end
|
22
13
|
|
23
14
|
private
|
24
15
|
|
25
16
|
def create_property(id, positional_args = [], keyword_args = {})
|
26
|
-
|
17
|
+
@context.state[:in_prop] = false
|
27
18
|
{id => [positional_args, keyword_args]}
|
28
19
|
end
|
29
20
|
|
@@ -31,8 +22,15 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 112)
|
|
31
22
|
properties || Hash.new
|
32
23
|
end
|
33
24
|
|
25
|
+
|
26
|
+
def define_variable(name, value)
|
27
|
+
@context.state[:in_var] = false
|
28
|
+
@context.variables[name] = value
|
29
|
+
value
|
30
|
+
end
|
31
|
+
|
34
32
|
def define_function(name, args, body)
|
35
|
-
|
33
|
+
@context.functions[name.to_sym] = {args: args, body: body}
|
36
34
|
nil
|
37
35
|
end
|
38
36
|
|
@@ -47,8 +45,8 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 112)
|
|
47
45
|
end
|
48
46
|
end
|
49
47
|
|
50
|
-
if
|
51
|
-
function =
|
48
|
+
if @context.functions.key?(operator)
|
49
|
+
function = @context.functions[operator]
|
52
50
|
raise MVinl::ParserError, "Argument mismatch for #{operator}" if operands.size != function[:args].size
|
53
51
|
|
54
52
|
# Map arguments to operands
|
@@ -81,137 +79,152 @@ module_eval(<<'...end mvinl.y/module_eval...', 'mvinl.y', 112)
|
|
81
79
|
##### State transition tables begin ###
|
82
80
|
|
83
81
|
racc_action_table = [
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
nil,
|
91
|
-
|
92
|
-
|
82
|
+
-13, 12, -13, -13, -13, -13, 2, 16, 7, 9,
|
83
|
+
10, 25, 26, -13, 36, 16, 36, 16, -13, 11,
|
84
|
+
20, 21, 22, 24, 25, 26, 28, 28, 47, 50,
|
85
|
+
31, 16, 20, 21, 22, 24, 25, 26, 16, 28,
|
86
|
+
47, 50, 16, 16, 21, 22, 24, 25, 26, 45,
|
87
|
+
28, 47, nil, nil, 16, 21, 22, 24, 25, 26,
|
88
|
+
nil, 28, 47, nil, nil, 16, 21, 22, 24, 25,
|
89
|
+
26, nil, 28, 47, nil, nil, 16, -19, 20, 21,
|
90
|
+
22, 24, 25, 26, nil, 28, 20, 21, 22, 24,
|
91
|
+
25, 26, nil, 28, 20, 21, 22, 24, 25, 26,
|
92
|
+
nil, 28 ]
|
93
93
|
|
94
94
|
racc_action_check = [
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
nil,
|
102
|
-
|
103
|
-
|
95
|
+
14, 2, 14, 14, 14, 14, 1, 4, 1, 1,
|
96
|
+
1, 26, 26, 14, 27, 27, 53, 53, 14, 1,
|
97
|
+
40, 40, 40, 40, 40, 40, 11, 40, 40, 40,
|
98
|
+
13, 40, 41, 41, 41, 41, 41, 41, 29, 41,
|
99
|
+
41, 41, 30, 41, 42, 42, 42, 42, 42, 38,
|
100
|
+
42, 52, nil, nil, 42, 60, 60, 60, 60, 60,
|
101
|
+
nil, 60, 60, nil, nil, 60, 61, 61, 61, 61,
|
102
|
+
61, nil, 61, 61, nil, nil, 61, 32, 32, 32,
|
103
|
+
32, 32, 32, 32, nil, 32, 8, 8, 8, 8,
|
104
|
+
8, 8, nil, 8, 44, 44, 44, 44, 44, 44,
|
105
|
+
nil, 44 ]
|
104
106
|
|
105
107
|
racc_action_pointer = [
|
106
|
-
nil, 6, 1, nil, nil, nil, nil,
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
108
|
+
nil, 6, 1, nil, -11, nil, nil, nil, 79, nil,
|
109
|
+
nil, 12, nil, 25, 0, nil, nil, nil, nil, nil,
|
110
|
+
nil, nil, nil, nil, nil, nil, 0, -3, nil, 20,
|
111
|
+
24, nil, 71, nil, nil, nil, nil, nil, 43, nil,
|
112
|
+
13, 25, 36, nil, 87, nil, nil, nil, nil, nil,
|
113
|
+
nil, nil, 36, -1, nil, nil, nil, nil, nil, nil,
|
114
|
+
47, 58, nil, nil, nil ]
|
112
115
|
|
113
116
|
racc_action_default = [
|
114
|
-
-1, -
|
115
|
-
-
|
116
|
-
-
|
117
|
-
-
|
118
|
-
-
|
119
|
-
-
|
117
|
+
-1, -10, -49, -2, -3, -4, -5, -6, -49, -8,
|
118
|
+
-10, -49, 65, -11, -17, -16, -48, -7, -23, -24,
|
119
|
+
-25, -26, -27, -28, -29, -30, -49, -49, -37, -9,
|
120
|
+
-49, -12, -14, -31, -43, -43, -47, -39, -15, -18,
|
121
|
+
-49, -49, -49, -20, -49, -22, -35, -38, -44, -45,
|
122
|
+
-46, -36, -42, -49, -40, -41, -21, -32, -39, -39,
|
123
|
+
-49, -49, -33, -42, -34 ]
|
120
124
|
|
121
125
|
racc_goto_table = [
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
126
|
+
30, 42, 15, 1, 35, 17, 4, 40, 41, 3,
|
127
|
+
5, 6, 46, 51, 8, 29, 55, 32, 38, 43,
|
128
|
+
44, 33, 60, 61, 57, 34, 52, 15, 37, 39,
|
129
|
+
59, 53, 62, 64, 55, 55, nil, nil, 49, 49,
|
130
|
+
nil, 56, nil, nil, nil, nil, nil, nil, nil, 53,
|
131
|
+
53, 58 ]
|
127
132
|
|
128
133
|
racc_goto_check = [
|
129
|
-
|
130
|
-
21, 21,
|
131
|
-
|
132
|
-
18,
|
133
|
-
|
134
|
+
18, 19, 12, 1, 22, 7, 3, 23, 23, 2,
|
135
|
+
4, 5, 21, 21, 6, 3, 15, 10, 11, 13,
|
136
|
+
14, 17, 19, 19, 21, 12, 20, 12, 12, 7,
|
137
|
+
22, 18, 21, 21, 15, 15, nil, nil, 12, 12,
|
138
|
+
nil, 7, nil, nil, nil, nil, nil, nil, nil, 18,
|
139
|
+
18, 12 ]
|
134
140
|
|
135
141
|
racc_goto_pointer = [
|
136
|
-
nil,
|
137
|
-
-
|
138
|
-
-
|
142
|
+
nil, 3, 8, 5, 9, 10, 13, -3, nil, nil,
|
143
|
+
3, -14, -2, -19, -18, -26, nil, -5, -11, -36,
|
144
|
+
-16, -28, -23, -27 ]
|
139
145
|
|
140
146
|
racc_goto_default = [
|
141
|
-
nil, nil, nil, nil, nil, nil, nil,
|
142
|
-
|
143
|
-
nil, nil ]
|
147
|
+
nil, nil, nil, nil, nil, nil, nil, 48, 13, 14,
|
148
|
+
nil, nil, 54, nil, nil, 18, 19, 23, 27, nil,
|
149
|
+
63, nil, nil, nil ]
|
144
150
|
|
145
151
|
racc_reduce_table = [
|
146
152
|
0, 0, :racc_error,
|
147
|
-
0,
|
148
|
-
2,
|
149
|
-
2,
|
150
|
-
2,
|
151
|
-
2,
|
152
|
-
|
153
|
-
2,
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
2,
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
1,
|
169
|
-
1,
|
170
|
-
1,
|
171
|
-
1,
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
153
|
+
0, 20, :_reduce_1,
|
154
|
+
2, 20, :_reduce_2,
|
155
|
+
2, 20, :_reduce_3,
|
156
|
+
2, 20, :_reduce_4,
|
157
|
+
2, 20, :_reduce_5,
|
158
|
+
2, 20, :_reduce_6,
|
159
|
+
2, 23, :_reduce_7,
|
160
|
+
1, 25, :_reduce_8,
|
161
|
+
2, 21, :_reduce_9,
|
162
|
+
0, 22, :_reduce_10,
|
163
|
+
2, 22, :_reduce_11,
|
164
|
+
3, 22, :_reduce_12,
|
165
|
+
1, 27, :_reduce_13,
|
166
|
+
2, 27, :_reduce_14,
|
167
|
+
3, 27, :_reduce_15,
|
168
|
+
1, 28, :_reduce_16,
|
169
|
+
0, 29, :_reduce_17,
|
170
|
+
2, 29, :_reduce_18,
|
171
|
+
0, 30, :_reduce_19,
|
172
|
+
2, 30, :_reduce_20,
|
173
|
+
2, 32, :_reduce_21,
|
174
|
+
1, 33, :_reduce_22,
|
175
|
+
1, 26, :_reduce_23,
|
176
|
+
1, 26, :_reduce_24,
|
177
|
+
1, 26, :_reduce_25,
|
178
|
+
1, 34, :_reduce_26,
|
179
|
+
1, 34, :_reduce_27,
|
180
|
+
1, 34, :_reduce_28,
|
181
|
+
1, 34, :_reduce_29,
|
182
|
+
1, 36, :_reduce_30,
|
183
|
+
2, 36, :_reduce_31,
|
184
|
+
6, 24, :_reduce_32,
|
185
|
+
4, 39, :_reduce_33,
|
186
|
+
4, 39, :_reduce_34,
|
187
|
+
4, 35, :_reduce_35,
|
188
|
+
4, 35, :_reduce_36,
|
189
|
+
1, 37, :_reduce_37,
|
190
|
+
1, 40, :_reduce_38,
|
191
|
+
0, 38, :_reduce_39,
|
186
192
|
2, 38, :_reduce_40,
|
187
193
|
2, 38, :_reduce_41,
|
188
|
-
|
189
|
-
|
194
|
+
2, 38, :_reduce_42,
|
195
|
+
0, 42, :_reduce_43,
|
196
|
+
2, 42, :_reduce_44,
|
197
|
+
2, 42, :_reduce_45,
|
198
|
+
2, 42, :_reduce_46,
|
199
|
+
1, 41, :_reduce_47,
|
200
|
+
1, 31, :_reduce_48 ]
|
190
201
|
|
191
|
-
racc_reduce_n =
|
202
|
+
racc_reduce_n = 49
|
192
203
|
|
193
|
-
racc_shift_n =
|
204
|
+
racc_shift_n = 65
|
194
205
|
|
195
206
|
racc_token_table = {
|
196
207
|
false => 0,
|
197
208
|
:error => 1,
|
198
209
|
:EOS => 2,
|
199
|
-
:
|
200
|
-
:
|
201
|
-
:
|
202
|
-
:
|
203
|
-
:
|
204
|
-
:
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
210
|
-
:
|
211
|
-
:
|
212
|
-
:
|
213
|
-
|
214
|
-
|
210
|
+
:VARIABLE => 3,
|
211
|
+
:GROUP => 4,
|
212
|
+
:END_TAG => 5,
|
213
|
+
:KEYWORD_ARG => 6,
|
214
|
+
:VARIABLE_CALL => 7,
|
215
|
+
:NUMBER => 8,
|
216
|
+
:FLOAT => 9,
|
217
|
+
:SYMBOL => 10,
|
218
|
+
:STRING => 11,
|
219
|
+
:MULTILINE_STRING => 12,
|
220
|
+
:DEF => 13,
|
221
|
+
:OPEN_PAREN => 14,
|
222
|
+
:CLOSE_PAREN => 15,
|
223
|
+
:polish_notation => 16,
|
224
|
+
:OPER => 17,
|
225
|
+
:ID => 18 }
|
226
|
+
|
227
|
+
racc_nt_base = 19
|
215
228
|
|
216
229
|
racc_use_result_var = false
|
217
230
|
|
@@ -236,9 +249,11 @@ Racc_token_to_s_table = [
|
|
236
249
|
"$end",
|
237
250
|
"error",
|
238
251
|
"EOS",
|
252
|
+
"VARIABLE",
|
239
253
|
"GROUP",
|
240
254
|
"END_TAG",
|
241
255
|
"KEYWORD_ARG",
|
256
|
+
"VARIABLE_CALL",
|
242
257
|
"NUMBER",
|
243
258
|
"FLOAT",
|
244
259
|
"SYMBOL",
|
@@ -253,14 +268,16 @@ Racc_token_to_s_table = [
|
|
253
268
|
"$start",
|
254
269
|
"program",
|
255
270
|
"group",
|
256
|
-
"function_def",
|
257
271
|
"properties",
|
272
|
+
"variable_def",
|
273
|
+
"function_def",
|
274
|
+
"var_def_name",
|
275
|
+
"super_value",
|
258
276
|
"property",
|
259
277
|
"prop_id",
|
260
278
|
"positional_args",
|
261
279
|
"keyword_args",
|
262
280
|
"identifier",
|
263
|
-
"super_value",
|
264
281
|
"keyword_arg",
|
265
282
|
"keyword_arg_id",
|
266
283
|
"value",
|
@@ -294,7 +311,7 @@ module_eval(<<'.,.,', 'mvinl.y', 13)
|
|
294
311
|
|
295
312
|
module_eval(<<'.,.,', 'mvinl.y', 14)
|
296
313
|
def _reduce_3(val, _values)
|
297
|
-
val[0]
|
314
|
+
val[0].merge(val[1])
|
298
315
|
end
|
299
316
|
.,.,
|
300
317
|
|
@@ -304,128 +321,128 @@ module_eval(<<'.,.,', 'mvinl.y', 15)
|
|
304
321
|
end
|
305
322
|
.,.,
|
306
323
|
|
307
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
324
|
+
module_eval(<<'.,.,', 'mvinl.y', 16)
|
308
325
|
def _reduce_5(val, _values)
|
309
|
-
|
326
|
+
val[0]
|
310
327
|
end
|
311
328
|
.,.,
|
312
329
|
|
313
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
330
|
+
module_eval(<<'.,.,', 'mvinl.y', 17)
|
314
331
|
def _reduce_6(val, _values)
|
315
|
-
|
332
|
+
val[0]
|
316
333
|
end
|
317
334
|
.,.,
|
318
335
|
|
319
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
336
|
+
module_eval(<<'.,.,', 'mvinl.y', 20)
|
320
337
|
def _reduce_7(val, _values)
|
321
|
-
val[0]
|
338
|
+
define_variable(val[0], val[1])
|
322
339
|
end
|
323
340
|
.,.,
|
324
341
|
|
325
342
|
module_eval(<<'.,.,', 'mvinl.y', 23)
|
326
343
|
def _reduce_8(val, _values)
|
327
|
-
val[0].
|
344
|
+
@context.state[:in_var] = true; val[0].to_sym
|
328
345
|
end
|
329
346
|
.,.,
|
330
347
|
|
331
348
|
module_eval(<<'.,.,', 'mvinl.y', 26)
|
332
349
|
def _reduce_9(val, _values)
|
333
|
-
|
350
|
+
{val[0].to_sym => create_group(val[1])}
|
334
351
|
end
|
335
352
|
.,.,
|
336
353
|
|
337
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
354
|
+
module_eval(<<'.,.,', 'mvinl.y', 29)
|
338
355
|
def _reduce_10(val, _values)
|
339
|
-
|
356
|
+
Hash.new
|
340
357
|
end
|
341
358
|
.,.,
|
342
359
|
|
343
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
360
|
+
module_eval(<<'.,.,', 'mvinl.y', 30)
|
344
361
|
def _reduce_11(val, _values)
|
345
|
-
|
362
|
+
val[0].merge(val[1])
|
346
363
|
end
|
347
364
|
.,.,
|
348
365
|
|
349
366
|
module_eval(<<'.,.,', 'mvinl.y', 31)
|
350
367
|
def _reduce_12(val, _values)
|
351
|
-
|
368
|
+
val[0].merge(val[1])
|
352
369
|
end
|
353
370
|
.,.,
|
354
371
|
|
355
372
|
module_eval(<<'.,.,', 'mvinl.y', 34)
|
356
373
|
def _reduce_13(val, _values)
|
357
|
-
|
374
|
+
create_property(val[0])
|
358
375
|
end
|
359
376
|
.,.,
|
360
377
|
|
361
378
|
module_eval(<<'.,.,', 'mvinl.y', 35)
|
362
379
|
def _reduce_14(val, _values)
|
363
|
-
val[0]
|
380
|
+
create_property(val[0], val[1])
|
364
381
|
end
|
365
382
|
.,.,
|
366
383
|
|
367
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
384
|
+
module_eval(<<'.,.,', 'mvinl.y', 36)
|
368
385
|
def _reduce_15(val, _values)
|
369
|
-
|
386
|
+
create_property(val[0], val[1], val[2])
|
370
387
|
end
|
371
388
|
.,.,
|
372
389
|
|
373
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
390
|
+
module_eval(<<'.,.,', 'mvinl.y', 39)
|
374
391
|
def _reduce_16(val, _values)
|
375
|
-
|
376
|
-
val[0].merge(val[1])
|
377
|
-
|
392
|
+
@context.state[:in_prop] = true; val[0]
|
378
393
|
end
|
379
394
|
.,.,
|
380
395
|
|
381
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
396
|
+
module_eval(<<'.,.,', 'mvinl.y', 42)
|
382
397
|
def _reduce_17(val, _values)
|
383
|
-
|
384
|
-
STATE[:keyword_arg_depth] += 1
|
385
|
-
{val[0].to_sym => val[1]}
|
386
|
-
|
398
|
+
Array.new
|
387
399
|
end
|
388
400
|
.,.,
|
389
401
|
|
390
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
402
|
+
module_eval(<<'.,.,', 'mvinl.y', 43)
|
391
403
|
def _reduce_18(val, _values)
|
392
|
-
|
404
|
+
val[0] << val[1]
|
393
405
|
end
|
394
406
|
.,.,
|
395
407
|
|
396
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
408
|
+
module_eval(<<'.,.,', 'mvinl.y', 46)
|
397
409
|
def _reduce_19(val, _values)
|
398
|
-
|
410
|
+
Hash.new
|
399
411
|
end
|
400
412
|
.,.,
|
401
413
|
|
402
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
414
|
+
module_eval(<<'.,.,', 'mvinl.y', 49)
|
403
415
|
def _reduce_20(val, _values)
|
404
|
-
|
416
|
+
@context.state[:keyword_arg_depth] = 0
|
417
|
+
val[0].merge(val[1])
|
418
|
+
|
405
419
|
end
|
406
420
|
.,.,
|
407
421
|
|
408
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
422
|
+
module_eval(<<'.,.,', 'mvinl.y', 56)
|
409
423
|
def _reduce_21(val, _values)
|
410
|
-
|
424
|
+
@context.state[:in_keyword_arg] = false
|
425
|
+
@context.state[:keyword_arg_depth] += 1
|
426
|
+
{val[0].to_sym => val[1]}
|
427
|
+
|
411
428
|
end
|
412
429
|
.,.,
|
413
430
|
|
414
431
|
module_eval(<<'.,.,', 'mvinl.y', 62)
|
415
432
|
def _reduce_22(val, _values)
|
416
|
-
val[0]
|
433
|
+
@context.state[:in_keyword_arg] = true; val[0]
|
417
434
|
end
|
418
435
|
.,.,
|
419
436
|
|
420
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
437
|
+
module_eval(<<'.,.,', 'mvinl.y', 65)
|
421
438
|
def _reduce_23(val, _values)
|
422
439
|
val[0]
|
423
440
|
end
|
424
441
|
.,.,
|
425
442
|
|
426
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
443
|
+
module_eval(<<'.,.,', 'mvinl.y', 66)
|
427
444
|
def _reduce_24(val, _values)
|
428
|
-
val[0]
|
445
|
+
val[0]
|
429
446
|
end
|
430
447
|
.,.,
|
431
448
|
|
@@ -435,98 +452,98 @@ module_eval(<<'.,.,', 'mvinl.y', 67)
|
|
435
452
|
end
|
436
453
|
.,.,
|
437
454
|
|
438
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
455
|
+
module_eval(<<'.,.,', 'mvinl.y', 70)
|
439
456
|
def _reduce_26(val, _values)
|
440
|
-
|
457
|
+
val[0].to_i
|
441
458
|
end
|
442
459
|
.,.,
|
443
460
|
|
444
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
461
|
+
module_eval(<<'.,.,', 'mvinl.y', 71)
|
445
462
|
def _reduce_27(val, _values)
|
446
|
-
|
447
|
-
|
463
|
+
val[0].to_f
|
448
464
|
end
|
449
465
|
.,.,
|
450
466
|
|
451
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
467
|
+
module_eval(<<'.,.,', 'mvinl.y', 72)
|
452
468
|
def _reduce_28(val, _values)
|
453
|
-
|
469
|
+
val[0]
|
454
470
|
end
|
455
471
|
.,.,
|
456
472
|
|
457
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
473
|
+
module_eval(<<'.,.,', 'mvinl.y', 73)
|
458
474
|
def _reduce_29(val, _values)
|
459
|
-
|
475
|
+
val[0].to_sym
|
460
476
|
end
|
461
477
|
.,.,
|
462
478
|
|
463
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
479
|
+
module_eval(<<'.,.,', 'mvinl.y', 76)
|
464
480
|
def _reduce_30(val, _values)
|
465
|
-
|
481
|
+
val[0]
|
466
482
|
end
|
467
483
|
.,.,
|
468
484
|
|
469
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
485
|
+
module_eval(<<'.,.,', 'mvinl.y', 77)
|
470
486
|
def _reduce_31(val, _values)
|
471
|
-
|
487
|
+
"#{val[0]} #{val[1]}"
|
472
488
|
end
|
473
489
|
.,.,
|
474
490
|
|
475
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
491
|
+
module_eval(<<'.,.,', 'mvinl.y', 82)
|
476
492
|
def _reduce_32(val, _values)
|
477
|
-
|
493
|
+
define_function(val[2], val[3], val[4])
|
494
|
+
|
478
495
|
end
|
479
496
|
.,.,
|
480
497
|
|
481
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
498
|
+
module_eval(<<'.,.,', 'mvinl.y', 86)
|
482
499
|
def _reduce_33(val, _values)
|
483
|
-
|
500
|
+
[val[1], *val[2]]
|
484
501
|
end
|
485
502
|
.,.,
|
486
503
|
|
487
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
504
|
+
module_eval(<<'.,.,', 'mvinl.y', 87)
|
488
505
|
def _reduce_34(val, _values)
|
489
|
-
|
506
|
+
[val[1], *val[2]]
|
490
507
|
end
|
491
508
|
.,.,
|
492
509
|
|
493
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
510
|
+
module_eval(<<'.,.,', 'mvinl.y', 90)
|
494
511
|
def _reduce_35(val, _values)
|
495
|
-
val[
|
512
|
+
evaluate_pn(val[1], val[2])
|
496
513
|
end
|
497
514
|
.,.,
|
498
515
|
|
499
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
516
|
+
module_eval(<<'.,.,', 'mvinl.y', 91)
|
500
517
|
def _reduce_36(val, _values)
|
501
|
-
val[
|
518
|
+
evaluate_pn(val[1], val[2])
|
502
519
|
end
|
503
520
|
.,.,
|
504
521
|
|
505
522
|
module_eval(<<'.,.,', 'mvinl.y', 94)
|
506
523
|
def _reduce_37(val, _values)
|
507
|
-
|
524
|
+
@context.state[:depth] += 1
|
508
525
|
end
|
509
526
|
.,.,
|
510
527
|
|
511
528
|
module_eval(<<'.,.,', 'mvinl.y', 97)
|
512
529
|
def _reduce_38(val, _values)
|
513
|
-
|
530
|
+
@context.state[:depth] -= 1
|
514
531
|
end
|
515
532
|
.,.,
|
516
533
|
|
517
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
534
|
+
module_eval(<<'.,.,', 'mvinl.y', 100)
|
518
535
|
def _reduce_39(val, _values)
|
519
|
-
|
536
|
+
Array.new
|
520
537
|
end
|
521
538
|
.,.,
|
522
539
|
|
523
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
540
|
+
module_eval(<<'.,.,', 'mvinl.y', 101)
|
524
541
|
def _reduce_40(val, _values)
|
525
542
|
val[0] << val[1]
|
526
543
|
end
|
527
544
|
.,.,
|
528
545
|
|
529
|
-
module_eval(<<'.,.,', 'mvinl.y',
|
546
|
+
module_eval(<<'.,.,', 'mvinl.y', 102)
|
530
547
|
def _reduce_41(val, _values)
|
531
548
|
val[0] << val[1]
|
532
549
|
end
|
@@ -534,12 +551,42 @@ module_eval(<<'.,.,', 'mvinl.y', 100)
|
|
534
551
|
|
535
552
|
module_eval(<<'.,.,', 'mvinl.y', 103)
|
536
553
|
def _reduce_42(val, _values)
|
537
|
-
val[0]
|
554
|
+
val[0] << val[1]
|
538
555
|
end
|
539
556
|
.,.,
|
540
557
|
|
541
558
|
module_eval(<<'.,.,', 'mvinl.y', 106)
|
542
559
|
def _reduce_43(val, _values)
|
560
|
+
Array.new
|
561
|
+
end
|
562
|
+
.,.,
|
563
|
+
|
564
|
+
module_eval(<<'.,.,', 'mvinl.y', 107)
|
565
|
+
def _reduce_44(val, _values)
|
566
|
+
val[0] << val[1]
|
567
|
+
end
|
568
|
+
.,.,
|
569
|
+
|
570
|
+
module_eval(<<'.,.,', 'mvinl.y', 108)
|
571
|
+
def _reduce_45(val, _values)
|
572
|
+
val[0] << val[1]
|
573
|
+
end
|
574
|
+
.,.,
|
575
|
+
|
576
|
+
module_eval(<<'.,.,', 'mvinl.y', 109)
|
577
|
+
def _reduce_46(val, _values)
|
578
|
+
val[0] << val[1]
|
579
|
+
end
|
580
|
+
.,.,
|
581
|
+
|
582
|
+
module_eval(<<'.,.,', 'mvinl.y', 112)
|
583
|
+
def _reduce_47(val, _values)
|
584
|
+
val[0].to_sym
|
585
|
+
end
|
586
|
+
.,.,
|
587
|
+
|
588
|
+
module_eval(<<'.,.,', 'mvinl.y', 115)
|
589
|
+
def _reduce_48(val, _values)
|
543
590
|
val[0].to_sym
|
544
591
|
end
|
545
592
|
.,.,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mvinl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- siery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pp
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- bin/imvnl
|
42
42
|
- edit/mvinl.vim
|
43
43
|
- lib/mvinl.rb
|
44
|
+
- lib/mvinl/context.rb
|
44
45
|
- lib/mvinl/info.rb
|
45
46
|
- lib/mvinl/lexer.rb
|
46
47
|
- lib/mvinl/parser.rb
|