bato 0.0.9 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +42 -0
  5. data/README.md +106 -74
  6. data/Rakefile +2 -0
  7. data/_config.yml +1 -0
  8. data/bato.gemspec +6 -5
  9. data/bin/bato +17 -11
  10. data/lib/bato/bersiyon.rb +3 -1
  11. data/lib/bato/core_ext/array.rb +5 -0
  12. data/lib/bato/core_ext/class.rb +3 -1
  13. data/lib/bato/core_ext/enumerator.rb +2 -0
  14. data/lib/bato/core_ext/integer.rb +2 -0
  15. data/lib/bato/core_ext/kernel.rb +8 -0
  16. data/lib/bato/core_ext/module.rb +4 -0
  17. data/lib/bato/core_ext/range.rb +2 -0
  18. data/lib/bato/core_ext/string.rb +2 -0
  19. data/lib/bato/core_ext.rb +2 -0
  20. data/lib/bato/ruby_parser_patches.rb +140 -180
  21. data/lib/bato/tagatala.rb +3 -1
  22. data/lib/bato.rb +2 -0
  23. data/mga_halimbawa/agapan.bt +5 -0
  24. data/mga_halimbawa/{alyas.bato → alyas.bt} +1 -1
  25. data/mga_halimbawa/batotris.bt +286 -0
  26. data/mga_halimbawa/{bilang.bato → bilang.bt} +1 -1
  27. data/mga_halimbawa/{dapat.bato → dapat.bt} +1 -1
  28. data/mga_halimbawa/{habang.bato → habang.bt} +1 -1
  29. data/mga_halimbawa/ihinto.bt +8 -0
  30. data/mga_halimbawa/{kontrol-sa-pagiikot.bato → kontrol-sa-pagiikot.bt} +7 -7
  31. data/mga_halimbawa/kumusta_mundo.bt +5 -0
  32. data/mga_halimbawa/{magbibigay.bato → magbibigay.bt} +3 -3
  33. data/mga_halimbawa/{maliban_na.bato → maliban_na.bt} +2 -2
  34. data/mga_halimbawa/{modyul.bato → modyul.bt} +3 -3
  35. data/mga_halimbawa/{nakatukoy.bato → nakatukoy.bt} +2 -2
  36. data/mga_halimbawa/{ngunit_kapag.bato → ngunit_kapag.bt} +3 -3
  37. data/mga_halimbawa/o_ang.bt +3 -0
  38. data/mga_halimbawa/{pamamaraan-sa-pagkakamali.bato → pamamaraan-sa-pagkakamali.bt} +1 -1
  39. data/mga_halimbawa/{pangalan.bato → pangalan.bt} +2 -2
  40. data/mga_halimbawa/panguri.bt +16 -0
  41. data/mga_halimbawa/{panuntunan.bato → panuntunan.bt} +1 -1
  42. data/mga_halimbawa/{para_sa.bato → para_sa.bt} +1 -1
  43. data/mga_halimbawa/{pibonasyi.bato → pibonasyi.bt} +6 -6
  44. data/mga_halimbawa/siguraduhin.bt +8 -0
  45. data/mga_halimbawa/{tanggalin.bato → tanggalin.bt} +3 -3
  46. data/mga_halimbawa/{timebomb.bato → timebomb.bt} +5 -5
  47. data/spec/bato/tagatala_spec.rb +6 -5
  48. data/spec/spec_helper.rb +1 -0
  49. metadata +48 -46
  50. data/mga_halimbawa/agapan.bato +0 -5
  51. data/mga_halimbawa/ihinto.bato +0 -8
  52. data/mga_halimbawa/kumusta_mundo.bato +0 -5
  53. data/mga_halimbawa/o_ang.bato +0 -3
  54. data/mga_halimbawa/panguri.bato +0 -13
  55. data/mga_halimbawa/siguraduhin.bato +0 -8
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
 
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('../lib', __FILE__)
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 pangalan_ng_file = ARGV[0]
6
- tagatala = Bato::Tagatala.new
7
- kodigo = File.read pangalan_ng_file, encoding: 'utf-8'
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.bato
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bato
2
- BERSIYON = '0.0.9'.freeze
4
+ BERSIYON = '0.0.13'
3
5
  end
@@ -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
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Class
2
4
  alias gumawa new
3
5
  alias kumatawan new
4
- end
6
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Enumerator
2
4
  alias kumuha take
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Integer
2
4
  alias ulit times
3
5
  alias beses times
@@ -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
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Module
4
+ alias katangian attr_accessor
2
5
  alias panguri attr_accessor
6
+ alias palawigin extend
3
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Range
2
4
  alias isaisahin each
3
5
  alias bawat each
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class String
2
4
  alias baliktad reverse
3
5
  alias haba length
data/lib/bato/core_ext.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bato/core_ext/kernel'
2
4
  require 'bato/core_ext/string'
3
5
  require 'bato/core_ext/array'
@@ -1,191 +1,151 @@
1
- class RubyLexer
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
- wordlist = [
37
- ['katapusan', %i[kEND kEND], :expr_end],
38
- ['dulo', %i[kEND kEND], :expr_end],
39
- ['wakas', %i[kEND kEND], :expr_end],
40
- ['iba', %i[kELSE kELSE], :expr_beg],
41
- ['kung_iba', %i[kELSE kELSE], :expr_beg],
42
- ['kung_hindi', %i[kELSE kELSE], :expr_beg],
43
- ['kung_hindi_naman', %i[kELSE kELSE], :expr_beg],
44
- ['kapag_hindi', %i[kELSE kELSE], :expr_beg],
45
- ['kapag_hindi_naman', %i[kELSE kELSE], :expr_beg],
46
- ['kung_hindi_pa', %i[kELSE kELSE], :expr_beg],
47
- ['kapag_hindi_pa', %i[kELSE kELSE], :expr_beg],
48
- ['at_kung_hindi', %i[kELSE kELSE], :expr_beg],
49
- ['at_kapag_hindi', %i[kELSE kELSE], :expr_beg],
50
- ['at_kung_hindi_naman', %i[kELSE kELSE], :expr_beg],
51
- ['at_kapag_hindi_naman', %i[kELSE kELSE], :expr_beg],
52
- ['at_kung_hindi_pa', %i[kELSE kELSE], :expr_beg],
53
- ['at_kapag_hindi_pa', %i[kELSE kELSE], :expr_beg],
54
- ['maliban_dito', %i[kELSE kELSE], :expr_beg],
55
- ['maliban_sa_mga_ito', %i[kELSE kELSE], :expr_beg],
56
- ['kalagayan', %i[kCASE kCASE], :expr_beg],
57
- ['kaukulan', %i[kCASE kCASE], :expr_beg],
58
- ['sakaling', %i[kCASE kCASE], :expr_beg],
59
- ['sakali', %i[kCASE kCASE], :expr_beg],
60
- ['kung_sakaling', %i[kCASE kCASE], :expr_beg],
61
- ['sakali_na', %i[kCASE kCASE], :expr_beg],
62
- ['kung_sakali_na', %i[kCASE kCASE], :expr_beg],
63
- ['matiyak', %i[kENSURE kENSURE], :expr_beg],
64
- ['tiyakin', %i[kENSURE kENSURE], :expr_beg],
65
- ['tiyaking', %i[kENSURE kENSURE], :expr_beg],
66
- ['siguraduhing', %i[kENSURE kENSURE], :expr_beg],
67
- ['siguraduhin', %i[kENSURE kENSURE], :expr_beg],
68
- ['panigurado', %i[kENSURE kENSURE], :expr_beg],
69
- ['modyul', %i[kMODULE kMODULE], :expr_beg],
70
- ['grupo', %i[kMODULE kMODULE], :expr_beg],
71
- ['ngunit_kapag', %i[kELSIF kELSIF], :expr_beg],
72
- ['kung_kapag', %i[kELSIF kELSIF], :expr_beg],
73
- ['ngunit_kapag_ang', %i[kELSIF kELSIF], :expr_beg],
74
- ['kung_kapag_ang', %i[kELSIF kELSIF], :expr_beg],
75
- ['ang', %i[kDEF kDEF], :expr_fname],
76
- ['panuntunang', %i[kDEF kDEF], :expr_fname],
77
- ['panuntunan', %i[kDEF kDEF], :expr_fname],
78
- ['iligtas', %i[kRESCUE kRESCUE_MOD], :expr_mid],
79
- ['agapan', %i[kRESCUE kRESCUE_MOD], :expr_mid],
80
- ['hindi', %i[kNOT kNOT], :expr_beg],
81
- ['dapat', %i[kTHEN kTHEN], :expr_beg],
82
- ['bigyang_daan', %i[kYIELD kYIELD], :expr_arg],
83
- ['magbigay_daan', %i[kYIELD kYIELD], :expr_arg],
84
- ['para_sa', %i[kFOR kFOR], :expr_beg],
85
- ['para_ang', %i[kFOR kFOR], :expr_beg],
86
- ['sariling', %i[kSELF kSELF], :expr_end],
87
- ['sarili', %i[kSELF kSELF], :expr_end],
88
- ['mali', %i[kFALSE kFALSE], :expr_end],
89
- ['subukang_muli', %i[kRETRY kRETRY], :expr_end],
90
- ['ibalik', %i[kRETURN kRETURN], :expr_mid],
91
- ['ibalik_ang', %i[kRETURN kRETURN], :expr_mid],
92
- ['magbalik', %i[kRETURN kRETURN], :expr_mid],
93
- ['magbalik_nang', %i[kRETURN kRETURN], :expr_mid],
94
- ['isauli', %i[kRETURN kRETURN], :expr_mid],
95
- ['isauli_ang', %i[kRETURN kRETURN], :expr_mid],
96
- ['ibigay', %i[kRETURN kRETURN], :expr_mid],
97
- ['ibigay_ang', %i[kRETURN kRETURN], :expr_mid],
98
- ['magbigay', %i[kRETURN kRETURN], :expr_mid],
99
- ['magbigay_nang', %i[kRETURN kRETURN], :expr_mid],
100
- ['tama', %i[kTRUE kTRUE], :expr_end],
101
- ['totoo', %i[kTRUE kTRUE], :expr_end],
102
- ['tunay', %i[kTRUE kTRUE], :expr_end],
103
- ['katotohanan', %i[kTRUE kTRUE], :expr_end],
104
- ['kapag', %i[kIF kIF_MOD], :expr_beg],
105
- ['kapag_ang', %i[kIF kIF_MOD], :expr_beg],
106
- ['kapag_na_ang', %i[kIF kIF_MOD], :expr_beg],
107
- ['kung', %i[kIF kIF_MOD], :expr_beg],
108
- ['kung_ang', %i[kIF kIF_MOD], :expr_beg],
109
- ['nakatukoy?', %i[kDEFINED kDEFINED], :expr_arg],
110
- ['nakasaad?', %i[kDEFINED kDEFINED], :expr_arg],
111
- ['super', %i[kSUPER kSUPER], :expr_arg],
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
- # :startdoc:
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
- original_verbosity = $VERBOSE
162
- $VERBOSE = nil
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
- WORDLIST18 = Hash[*wordlist.map { |o| [o.name, o] }.flatten]
165
- WORDLIST19 = Hash[*wordlist.map { |o| [o.name, o] }.flatten]
137
+ orihinal_na_pagkakasabi = $VERBOSE
138
+ $VERBOSE = nil
166
139
 
167
- $VERBOSE = original_verbosity
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
- WORDLIST18.delete '__ENCODING__'
147
+ WORDLIST = Hash[*mga_salita.map { |o| [o.name, o] }.flatten]
170
148
 
171
- %w[at at_ang
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