bato 0.0.9 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +42 -0
- data/README.md +106 -74
- data/Rakefile +2 -0
- data/_config.yml +1 -0
- data/bato.gemspec +6 -5
- data/bin/bato +17 -11
- data/lib/bato/bersiyon.rb +3 -1
- data/lib/bato/core_ext/array.rb +5 -0
- data/lib/bato/core_ext/class.rb +3 -1
- data/lib/bato/core_ext/enumerator.rb +2 -0
- data/lib/bato/core_ext/integer.rb +2 -0
- data/lib/bato/core_ext/kernel.rb +8 -0
- data/lib/bato/core_ext/module.rb +4 -0
- data/lib/bato/core_ext/range.rb +2 -0
- data/lib/bato/core_ext/string.rb +2 -0
- data/lib/bato/core_ext.rb +2 -0
- data/lib/bato/ruby_parser_patches.rb +140 -180
- data/lib/bato/tagatala.rb +3 -1
- data/lib/bato.rb +2 -0
- data/mga_halimbawa/agapan.bt +5 -0
- data/mga_halimbawa/{alyas.bato → alyas.bt} +1 -1
- data/mga_halimbawa/batotris.bt +286 -0
- data/mga_halimbawa/{bilang.bato → bilang.bt} +1 -1
- data/mga_halimbawa/{dapat.bato → dapat.bt} +1 -1
- data/mga_halimbawa/{habang.bato → habang.bt} +1 -1
- data/mga_halimbawa/ihinto.bt +8 -0
- data/mga_halimbawa/{kontrol-sa-pagiikot.bato → kontrol-sa-pagiikot.bt} +7 -7
- data/mga_halimbawa/kumusta_mundo.bt +5 -0
- data/mga_halimbawa/{magbibigay.bato → magbibigay.bt} +3 -3
- data/mga_halimbawa/{maliban_na.bato → maliban_na.bt} +2 -2
- data/mga_halimbawa/{modyul.bato → modyul.bt} +3 -3
- data/mga_halimbawa/{nakatukoy.bato → nakatukoy.bt} +2 -2
- data/mga_halimbawa/{ngunit_kapag.bato → ngunit_kapag.bt} +3 -3
- data/mga_halimbawa/o_ang.bt +3 -0
- data/mga_halimbawa/{pamamaraan-sa-pagkakamali.bato → pamamaraan-sa-pagkakamali.bt} +1 -1
- data/mga_halimbawa/{pangalan.bato → pangalan.bt} +2 -2
- data/mga_halimbawa/panguri.bt +16 -0
- data/mga_halimbawa/{panuntunan.bato → panuntunan.bt} +1 -1
- data/mga_halimbawa/{para_sa.bato → para_sa.bt} +1 -1
- data/mga_halimbawa/{pibonasyi.bato → pibonasyi.bt} +6 -6
- data/mga_halimbawa/siguraduhin.bt +8 -0
- data/mga_halimbawa/{tanggalin.bato → tanggalin.bt} +3 -3
- data/mga_halimbawa/{timebomb.bato → timebomb.bt} +5 -5
- data/spec/bato/tagatala_spec.rb +6 -5
- data/spec/spec_helper.rb +1 -0
- metadata +48 -46
- data/mga_halimbawa/agapan.bato +0 -5
- data/mga_halimbawa/ihinto.bato +0 -8
- data/mga_halimbawa/kumusta_mundo.bato +0 -5
- data/mga_halimbawa/o_ang.bato +0 -3
- data/mga_halimbawa/panguri.bato +0 -13
- data/mga_halimbawa/siguraduhin.bato +0 -8
data/Rakefile
CHANGED
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-cayman
|
data/bato.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
lib = File.expand_path('
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'bato/bersiyon'
|
5
6
|
|
@@ -18,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
spec.require_paths = ['lib']
|
20
21
|
|
21
|
-
spec.add_dependency 'ruby2ruby'
|
22
|
+
spec.add_dependency 'ruby2ruby', '~> 2.4.4'
|
22
23
|
|
23
|
-
spec.add_development_dependency 'bundler'
|
24
|
-
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency 'rspec'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.2.19'
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0.6'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.10.0'
|
26
27
|
end
|
data/bin/bato
CHANGED
@@ -1,19 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
require 'bato/tagatala'
|
3
5
|
require 'rubygems'
|
4
6
|
|
5
|
-
if
|
6
|
-
|
7
|
-
|
8
|
-
ruby_kodigo = tagatala.sa_ruby kodigo
|
9
|
-
raise 'Ang pinakamababang kinakailangan bersiyon ng Ruby ay 2.4' if
|
10
|
-
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4')
|
11
|
-
eval ruby_kodigo
|
12
|
-
else
|
13
|
-
puts <<-EOS
|
14
|
-
Hindi tinukoy ang file. Ang tamang sintaks ay:
|
7
|
+
if ARGV[0].nil?
|
8
|
+
puts <<~EOS
|
9
|
+
Hindi tinukoy ang file. Ang tamang sintaks ay:
|
15
10
|
|
16
|
-
bato file.
|
11
|
+
bato file.bt
|
17
12
|
EOS
|
13
|
+
else
|
14
|
+
ARGV.each do |file|
|
15
|
+
next unless file
|
16
|
+
|
17
|
+
tagatala = Bato::Tagatala.new
|
18
|
+
kodigo = File.read file, encoding: 'utf-8'
|
19
|
+
ruby_kodigo = tagatala.sa_ruby kodigo
|
20
|
+
raise 'Ang pinakamababang kinakailangan bersiyon ng Ruby ay 2.4' if
|
21
|
+
Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
|
18
22
|
|
23
|
+
eval ruby_kodigo
|
24
|
+
end
|
19
25
|
end
|
data/lib/bato/bersiyon.rb
CHANGED
data/lib/bato/core_ext/array.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Array
|
4
|
+
alias baliktad reverse
|
2
5
|
alias umikot cycle
|
3
6
|
alias isuksok inject
|
4
7
|
alias magbagsak drop
|
@@ -13,4 +16,6 @@ class Array
|
|
13
16
|
alias bawat each
|
14
17
|
alias kada_isa each
|
15
18
|
alias sa_bawat_isa each
|
19
|
+
alias bilang_bawat_isa each_with_index
|
20
|
+
alias haba length
|
16
21
|
end
|
data/lib/bato/core_ext/class.rb
CHANGED
data/lib/bato/core_ext/kernel.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Kernel
|
2
4
|
alias isulat puts
|
3
5
|
alias sabihin puts
|
4
6
|
alias iprint puts
|
7
|
+
alias mag_print puts
|
8
|
+
alias ilimbag puts
|
9
|
+
alias mag_limbag puts
|
10
|
+
alias itatak puts
|
11
|
+
alias mag_tatak puts
|
5
12
|
alias iangat raise
|
6
13
|
alias itaas raise
|
14
|
+
alias matulog sleep
|
7
15
|
end
|
data/lib/bato/core_ext/module.rb
CHANGED
data/lib/bato/core_ext/range.rb
CHANGED
data/lib/bato/core_ext/string.rb
CHANGED
data/lib/bato/core_ext.rb
CHANGED
@@ -1,191 +1,151 @@
|
|
1
|
-
|
2
|
-
def parse_number
|
3
|
-
self.lex_state = :expr_end
|
4
|
-
|
5
|
-
if src.scan(/[+-]?0[xXbBdD]\b/)
|
6
|
-
rb_compile_error 'Invalid numeric format'
|
7
|
-
# elsif src.scan(/[+-]?(?:(?:[1-9][\d_]*|0)(?!\.\d)\b|0[Dd][0-9_]+)/)
|
8
|
-
elsif src.scan(/[+-]?(?:(?:[1-9][\d_]*|0)(?!\,\d)\b|0[Dd][0-9_]+)/)
|
9
|
-
int_with_base(10)
|
10
|
-
elsif src.scan(/[+-]?0x[a-f0-9_]+/i)
|
11
|
-
int_with_base(16)
|
12
|
-
elsif src.scan(/[+-]?0[Bb][01_]+/)
|
13
|
-
int_with_base(2)
|
14
|
-
elsif src.scan(/[+-]?0[Oo]?[0-7_]*[89]/)
|
15
|
-
rb_compile_error 'Illegal octal digit.'
|
16
|
-
elsif src.scan(/[+-]?0[Oo]?[0-7_]+|0[Oo]/)
|
17
|
-
int_with_base(8)
|
18
|
-
elsif src.scan(/[+-]?[\d_]+_(e|\.)/)
|
19
|
-
rb_compile_error "Trailing '_' in number."
|
20
|
-
# elsif src.scan(/[+-]?[\d_]+\.[\d_]+(e[+-]?[\d_]+)?\b|[+-]?[\d_]+e[+-]?[\d_]+\b/i)
|
21
|
-
elsif src.scan(/[+-]?[\d_]+\,[\d_]+(e[+-]?[\d_]+)?\b|[+-]?[\d_]+e[+-]?[\d_]+\b/i)
|
22
|
-
number = src.matched.sub(',', '.')
|
23
|
-
rb_compile_error 'Invalid numeric format' if number =~ /__/
|
24
|
-
self.yacc_value = number.to_f
|
25
|
-
:tFLOAT
|
26
|
-
elsif src.scan(/[+-]?[0-9_]+(?![e])/)
|
27
|
-
int_with_base(10)
|
28
|
-
else
|
29
|
-
rb_compile_error 'Bad number format'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
1
|
+
# frozen_string_literal: true
|
33
2
|
|
34
3
|
module RubyParserStuff
|
35
4
|
class Keyword
|
36
|
-
|
37
|
-
['katapusan', %i[kEND kEND],
|
38
|
-
['dulo', %i[kEND kEND],
|
39
|
-
['wakas', %i[kEND kEND],
|
40
|
-
['
|
41
|
-
['
|
42
|
-
['
|
43
|
-
['
|
44
|
-
['
|
45
|
-
['
|
46
|
-
['
|
47
|
-
['
|
48
|
-
['
|
49
|
-
['
|
50
|
-
['
|
51
|
-
['
|
52
|
-
['
|
53
|
-
['
|
54
|
-
['
|
55
|
-
['
|
56
|
-
['
|
57
|
-
['
|
58
|
-
['
|
59
|
-
['
|
60
|
-
['
|
61
|
-
['
|
62
|
-
['
|
63
|
-
['
|
64
|
-
['
|
65
|
-
['
|
66
|
-
['
|
67
|
-
['
|
68
|
-
['
|
69
|
-
['
|
70
|
-
['
|
71
|
-
['
|
72
|
-
['
|
73
|
-
['
|
74
|
-
['
|
75
|
-
['
|
76
|
-
['
|
77
|
-
['
|
78
|
-
['
|
79
|
-
['
|
80
|
-
['
|
81
|
-
['
|
82
|
-
['
|
83
|
-
['
|
84
|
-
['
|
85
|
-
['
|
86
|
-
['
|
87
|
-
['
|
88
|
-
['
|
89
|
-
['
|
90
|
-
['
|
91
|
-
['
|
92
|
-
['
|
93
|
-
['
|
94
|
-
['
|
95
|
-
['
|
96
|
-
['
|
97
|
-
['
|
98
|
-
['
|
99
|
-
['
|
100
|
-
['
|
101
|
-
['
|
102
|
-
['
|
103
|
-
['
|
104
|
-
['
|
105
|
-
['
|
106
|
-
['
|
107
|
-
['
|
108
|
-
['
|
109
|
-
['
|
110
|
-
['
|
111
|
-
|
112
|
-
['tanggalin', %i[kUNDEF kUNDEF], :expr_fname],
|
113
|
-
['magtanggal', %i[kUNDEF kUNDEF], :expr_fname],
|
114
|
-
['ihinto', %i[kBREAK kBREAK], :expr_mid],
|
115
|
-
['hinto', %i[kBREAK kBREAK], :expr_mid],
|
116
|
-
['sa', %i[kIN kIN], :expr_beg],
|
117
|
-
['sa_loob_ng', %i[kIN kIN], :expr_beg],
|
118
|
-
['nasa', %i[kIN kIN], :expr_beg],
|
119
|
-
['na_nasa', %i[kIN kIN], :expr_beg],
|
120
|
-
['na_ganito', %i[kDO kDO], :expr_beg],
|
121
|
-
['nang_ganito', %i[kDO kDO], :expr_beg],
|
122
|
-
['ng_ganito', %i[kDO kDO], :expr_beg],
|
123
|
-
['ganito', %i[kDO kDO], :expr_beg],
|
124
|
-
['ganito_gawin', %i[kDO kDO], :expr_beg],
|
125
|
-
['ganito_ang_gagawin', %i[kDO kDO], :expr_beg],
|
126
|
-
['wala', %i[kNIL kNIL], :expr_end],
|
127
|
-
['hanggang', %i[kUNTIL kUNTIL_MOD], :expr_beg],
|
128
|
-
['hanggang_ang', %i[kUNTIL kUNTIL_MOD], :expr_beg],
|
129
|
-
['mapa_hanggang', %i[kUNTIL kUNTIL_MOD], :expr_beg],
|
130
|
-
['malibang', %i[kUNLESS kUNLESS_MOD], :expr_beg],
|
131
|
-
['maliban_na', %i[kUNLESS kUNLESS_MOD], :expr_beg],
|
132
|
-
['maliban_ang', %i[kUNLESS kUNLESS_MOD], :expr_beg],
|
133
|
-
['o', %i[kOR kOR], :expr_beg],
|
134
|
-
['o_ang', %i[kOR kOR], :expr_beg],
|
135
|
-
['sumunod', %i[kNEXT kNEXT], :expr_mid],
|
136
|
-
['kasunod', %i[kNEXT kNEXT], :expr_mid],
|
137
|
-
['pagka', %i[kWHEN kWHEN], :expr_beg],
|
138
|
-
['pagka_ang', %i[kWHEN kWHEN], :expr_beg],
|
139
|
-
['ay', %i[kWHEN kWHEN], :expr_beg],
|
140
|
-
['ulitin', %i[kREDO kREDO], :expr_end],
|
141
|
-
['at_ulitin', %i[kREDO kREDO], :expr_end],
|
142
|
-
['uliting_muli', %i[kREDO kREDO], :expr_end],
|
143
|
-
['at', %i[kAND kAND], :expr_beg],
|
144
|
-
['at_ang', %i[kAND kAND], :expr_beg],
|
145
|
-
['simula', %i[kBEGIN kBEGIN], :expr_beg],
|
146
|
-
['simulan', %i[kBEGIN kBEGIN], :expr_beg],
|
147
|
-
['__LINE__', %i[k__LINE__ k__LINE__], :expr_end],
|
148
|
-
['bilang', %i[kCLASS kCLASS], :expr_class],
|
149
|
-
['klase', %i[kCLASS kCLASS], :expr_class],
|
150
|
-
['__FILE__', %i[k__FILE__ k__FILE__], :expr_end],
|
151
|
-
['END', %i[klEND klEND], :expr_end],
|
152
|
-
['BEGIN', %i[klBEGIN klBEGIN], :expr_end],
|
153
|
-
['habang', %i[kWHILE kWHILE_MOD], :expr_beg],
|
154
|
-
['habang_ang', %i[kWHILE kWHILE_MOD], :expr_beg],
|
155
|
-
['alyas', %i[kALIAS kALIAS], :expr_fname],
|
156
|
-
['__ENCODING__', %i[k__ENCODING__ k__ENCODING__], :expr_end]
|
157
|
-
].map { |args| KWtable.new(*args) }
|
5
|
+
pang_kapahayagang_mga_salita = [
|
6
|
+
['katapusan', %i[kEND kEND], EXPR_END],
|
7
|
+
['dulo', %i[kEND kEND], EXPR_END],
|
8
|
+
['wakas', %i[kEND kEND], EXPR_END],
|
9
|
+
['ang', %i[kDEF kDEF], EXPR_FNAME],
|
10
|
+
['panuntunang', %i[kDEF kDEF], EXPR_FNAME],
|
11
|
+
['panuntunan', %i[kDEF kDEF], EXPR_FNAME],
|
12
|
+
['iligtas', %i[kRESCUE kRESCUE_MOD], EXPR_MID],
|
13
|
+
['agapan', %i[kRESCUE kRESCUE_MOD], EXPR_MID],
|
14
|
+
['bigyang_daan', %i[kYIELD kYIELD], EXPR_ARG],
|
15
|
+
['magbigay_daan', %i[kYIELD kYIELD], EXPR_ARG],
|
16
|
+
['sariling', %i[kSELF kSELF], EXPR_END],
|
17
|
+
['sarili', %i[kSELF kSELF], EXPR_END],
|
18
|
+
['mali', %i[kFALSE kFALSE], EXPR_END],
|
19
|
+
['subukang_muli', %i[kRETRY kRETRY], EXPR_END],
|
20
|
+
['ibalik', %i[kRETURN kRETURN], EXPR_MID],
|
21
|
+
['ibalik_ang', %i[kRETURN kRETURN], EXPR_MID],
|
22
|
+
['magbalik', %i[kRETURN kRETURN], EXPR_MID],
|
23
|
+
['magbalik_nang', %i[kRETURN kRETURN], EXPR_MID],
|
24
|
+
['isauli', %i[kRETURN kRETURN], EXPR_MID],
|
25
|
+
['isauli_ang', %i[kRETURN kRETURN], EXPR_MID],
|
26
|
+
['ibigay', %i[kRETURN kRETURN], EXPR_MID],
|
27
|
+
['ibigay_ang', %i[kRETURN kRETURN], EXPR_MID],
|
28
|
+
['magbigay', %i[kRETURN kRETURN], EXPR_MID],
|
29
|
+
['magbigay_nang', %i[kRETURN kRETURN], EXPR_MID],
|
30
|
+
['tama', %i[kTRUE kTRUE], EXPR_END],
|
31
|
+
['totoo', %i[kTRUE kTRUE], EXPR_END],
|
32
|
+
['tunay', %i[kTRUE kTRUE], EXPR_END],
|
33
|
+
['katotohanan', %i[kTRUE kTRUE], EXPR_END],
|
34
|
+
['nakatukoy?', %i[kDEFINED kDEFINED], EXPR_ARG],
|
35
|
+
['nakasaad?', %i[kDEFINED kDEFINED], EXPR_ARG],
|
36
|
+
['tanggalin', %i[kUNDEF kUNDEF], EXPR_FNAME|EXPR_FITEM],
|
37
|
+
['magtanggal', %i[kUNDEF kUNDEF], EXPR_FNAME|EXPR_FITEM],
|
38
|
+
['ihinto', %i[kBREAK kBREAK], EXPR_MID],
|
39
|
+
['hinto', %i[kBREAK kBREAK], EXPR_MID],
|
40
|
+
['wala', %i[kNIL kNIL], EXPR_END],
|
41
|
+
['sumunod', %i[kNEXT kNEXT], EXPR_MID],
|
42
|
+
['kasunod', %i[kNEXT kNEXT], EXPR_MID],
|
43
|
+
['ulitin', %i[kREDO kREDO], EXPR_END],
|
44
|
+
['at_ulitin', %i[kREDO kREDO], EXPR_END],
|
45
|
+
['uliting_muli', %i[kREDO kREDO], EXPR_END],
|
46
|
+
['bilang', %i[kCLASS kCLASS], EXPR_CLASS],
|
47
|
+
['klase', %i[kCLASS kCLASS], EXPR_CLASS],
|
48
|
+
['alyas', %i[kALIAS kALIAS], EXPR_FNAME|EXPR_FITEM],
|
49
|
+
['iba', %i[kELSE kELSE], EXPR_BEG],
|
50
|
+
['kung_iba', %i[kELSE kELSE], EXPR_BEG],
|
51
|
+
['kung_hindi_naman', %i[kELSE kELSE], EXPR_BEG],
|
52
|
+
['kapag_hindi', %i[kELSE kELSE], EXPR_BEG],
|
53
|
+
['kapag_hindi_naman', %i[kELSE kELSE], EXPR_BEG],
|
54
|
+
['kung_hindi_pa', %i[kELSE kELSE], EXPR_BEG],
|
55
|
+
['kapag_hindi_pa', %i[kELSE kELSE], EXPR_BEG],
|
56
|
+
['at_kung_hindi', %i[kELSE kELSE], EXPR_BEG],
|
57
|
+
['at_kapag_hindi', %i[kELSE kELSE], EXPR_BEG],
|
58
|
+
['at_kung_hindi_naman', %i[kELSE kELSE], EXPR_BEG],
|
59
|
+
['at_kapag_hindi_naman', %i[kELSE kELSE], EXPR_BEG],
|
60
|
+
['at_kung_hindi_pa', %i[kELSE kELSE], EXPR_BEG],
|
61
|
+
['at_kapag_hindi_pa', %i[kELSE kELSE], EXPR_BEG],
|
62
|
+
['maliban_dito', %i[kELSE kELSE], EXPR_BEG],
|
63
|
+
['maliban_sa_mga_ito', %i[kELSE kELSE], EXPR_BEG],
|
64
|
+
['matiyak', %i[kENSURE kENSURE], EXPR_BEG],
|
65
|
+
['tiyakin', %i[kENSURE kENSURE], EXPR_BEG],
|
66
|
+
['tiyaking', %i[kENSURE kENSURE], EXPR_BEG],
|
67
|
+
['siguraduhing', %i[kENSURE kENSURE], EXPR_BEG],
|
68
|
+
['siguraduhin', %i[kENSURE kENSURE], EXPR_BEG],
|
69
|
+
['panigurado', %i[kENSURE kENSURE], EXPR_BEG],
|
70
|
+
['kung_hindi', %i[kELSE kELSE], EXPR_BEG],
|
71
|
+
['dapat', %i[kTHEN kTHEN], EXPR_BEG],
|
72
|
+
['na_ganito', %i[kDO kDO], EXPR_BEG],
|
73
|
+
['nang_ganito', %i[kDO kDO], EXPR_BEG],
|
74
|
+
['ng_ganito', %i[kDO kDO], EXPR_BEG],
|
75
|
+
['ganito', %i[kDO kDO], EXPR_BEG],
|
76
|
+
['ganito_gawin', %i[kDO kDO], EXPR_BEG],
|
77
|
+
['ganito_ang_gagawin', %i[kDO kDO], EXPR_BEG],
|
78
|
+
['simula', %i[kBEGIN kBEGIN], EXPR_BEG],
|
79
|
+
['simulan', %i[kBEGIN kBEGIN], EXPR_BEG]
|
80
|
+
]
|
158
81
|
|
159
|
-
|
82
|
+
pang_ekspresyon_na_mga_salita = [
|
83
|
+
['at', %i[kAND kAND], EXPR_BEG],
|
84
|
+
['at_ang', %i[kAND kAND], EXPR_BEG],
|
85
|
+
['kalagayan', %i[kCASE kCASE], EXPR_BEG],
|
86
|
+
['kaukulan', %i[kCASE kCASE], EXPR_BEG],
|
87
|
+
['sakaling', %i[kCASE kCASE], EXPR_BEG],
|
88
|
+
['sakali', %i[kCASE kCASE], EXPR_BEG],
|
89
|
+
['kung_sakaling', %i[kCASE kCASE], EXPR_BEG],
|
90
|
+
['sakali_na', %i[kCASE kCASE], EXPR_BEG],
|
91
|
+
['kung_sakali_na', %i[kCASE kCASE], EXPR_BEG],
|
92
|
+
['ngunit_kapag', %i[kELSIF kELSIF], EXPR_BEG],
|
93
|
+
['kung_kapag', %i[kELSIF kELSIF], EXPR_BEG],
|
94
|
+
['ngunit_kapag_ang', %i[kELSIF kELSIF], EXPR_BEG],
|
95
|
+
['kung_kapag_ang', %i[kELSIF kELSIF], EXPR_BEG],
|
96
|
+
['para_sa', %i[kFOR kFOR], EXPR_BEG],
|
97
|
+
['para_ang', %i[kFOR kFOR], EXPR_BEG],
|
98
|
+
['kapag', %i[kIF kIF_MOD], EXPR_BEG],
|
99
|
+
['kapag_ang', %i[kIF kIF_MOD], EXPR_BEG],
|
100
|
+
['kapag_na_ang', %i[kIF kIF_MOD], EXPR_BEG],
|
101
|
+
['kung', %i[kIF kIF_MOD], EXPR_BEG],
|
102
|
+
['kung_ang', %i[kIF kIF_MOD], EXPR_BEG],
|
103
|
+
['sa', %i[kIN kIN], EXPR_BEG],
|
104
|
+
['sa_loob_ng', %i[kIN kIN], EXPR_BEG],
|
105
|
+
['nasa', %i[kIN kIN], EXPR_BEG],
|
106
|
+
['na_nasa', %i[kIN kIN], EXPR_BEG],
|
107
|
+
['modyul', %i[kMODULE kMODULE], EXPR_BEG],
|
108
|
+
['grupo', %i[kMODULE kMODULE], EXPR_BEG],
|
109
|
+
['o', %i[kOR kOR], EXPR_BEG],
|
110
|
+
['o_ang', %i[kOR kOR], EXPR_BEG],
|
111
|
+
['malibang', %i[kUNLESS kUNLESS_MOD], EXPR_BEG],
|
112
|
+
['maliban_na', %i[kUNLESS kUNLESS_MOD], EXPR_BEG],
|
113
|
+
['maliban_ang', %i[kUNLESS kUNLESS_MOD], EXPR_BEG],
|
114
|
+
['hanggang', %i[kUNTIL kUNTIL_MOD], EXPR_BEG],
|
115
|
+
['hanggang_ang', %i[kUNTIL kUNTIL_MOD], EXPR_BEG],
|
116
|
+
['mapa_hanggang', %i[kUNTIL kUNTIL_MOD], EXPR_BEG],
|
117
|
+
['pagka', %i[kWHEN kWHEN], EXPR_BEG],
|
118
|
+
['pagka_ang', %i[kWHEN kWHEN], EXPR_BEG],
|
119
|
+
['ay', %i[kWHEN kWHEN], EXPR_BEG],
|
120
|
+
['habang', %i[kWHILE kWHILE_MOD], EXPR_BEG],
|
121
|
+
['habang_ang', %i[kWHILE kWHILE_MOD], EXPR_BEG]
|
122
|
+
]
|
160
123
|
|
161
|
-
|
162
|
-
|
124
|
+
pang_internal_na_mekanismo_na_mga_salita = [
|
125
|
+
['END', %i[klEND klEND], EXPR_END],
|
126
|
+
['BEGIN', %i[klBEGIN klBEGIN], EXPR_END],
|
127
|
+
['super', %i[kSUPER kSUPER], EXPR_ARG],
|
128
|
+
['__FILE__', %i[k__FILE__ k__FILE__], EXPR_END],
|
129
|
+
['__LINE__', %i[k__LINE__ k__LINE__], EXPR_END],
|
130
|
+
['__ENCODING__', %i[k__ENCODING__ k__ENCODING__], EXPR_END]
|
131
|
+
]
|
132
|
+
|
133
|
+
pang_argumentong_mga_salita = [
|
134
|
+
['hindi', %i[kNOT kNOT], EXPR_BEG]
|
135
|
+
]
|
163
136
|
|
164
|
-
|
165
|
-
|
137
|
+
orihinal_na_pagkakasabi = $VERBOSE
|
138
|
+
$VERBOSE = nil
|
166
139
|
|
167
|
-
|
140
|
+
mga_salita = [
|
141
|
+
pang_kapahayagang_mga_salita,
|
142
|
+
pang_ekspresyon_na_mga_salita,
|
143
|
+
pang_internal_na_mekanismo_na_mga_salita,
|
144
|
+
pang_argumentong_mga_salita
|
145
|
+
].flatten(1).map { |args| KWtable.new(*args) }
|
168
146
|
|
169
|
-
|
147
|
+
WORDLIST = Hash[*mga_salita.map { |o| [o.name, o] }.flatten]
|
170
148
|
|
171
|
-
|
172
|
-
kalagayan kaukulan sakaling sakali kung_sakaling sakali_na kung_sakali_na
|
173
|
-
ngunit_kapag kung_kapag ngunit_kapag_ang kung_kapag_ang
|
174
|
-
para_sa para_ang
|
175
|
-
kapag kapag_ang kapag_na_ang kung kung_ang
|
176
|
-
sa sa_loob_ng nasa na_nasa
|
177
|
-
modyul grupo
|
178
|
-
o o_ang
|
179
|
-
malibang maliban_na maliban_ang
|
180
|
-
hanggang hanggang_ang mapa_hanggang
|
181
|
-
pagka pagka_ang ay
|
182
|
-
habang habang_ang].each do |k|
|
183
|
-
WORDLIST19[k] = WORDLIST19[k].dup
|
184
|
-
WORDLIST19[k].state = :expr_value
|
185
|
-
end
|
186
|
-
%w[hindi].each do |k|
|
187
|
-
WORDLIST19[k] = WORDLIST19[k].dup
|
188
|
-
WORDLIST19[k].state = :expr_arg
|
189
|
-
end
|
149
|
+
$VERBOSE = orihinal_na_pagkakasabi
|
190
150
|
end
|
191
151
|
end
|