bato 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fdef7b16053a9a7406ace655f09a5f4f6fa4108d
4
- data.tar.gz: 9d8c5613e1af7dc187a71d72ad3cd56802db8243
2
+ SHA256:
3
+ metadata.gz: 59fba35aba486e82a7ebb3ce3c59346378e4a334cd99400e5724870ee1f7b474
4
+ data.tar.gz: f1df3b43c32b4a2dc948a3acf7c7788210ee7b0e80490eb7fd1a7a06207740d0
5
5
  SHA512:
6
- metadata.gz: 5a6d76320fef80eded1c8286c291e6b071ca3c6664cda0a7c5f4f1f4dd0249c15e13cce906c5054d03e0c34f2257d21307646d14eea58e3cb2509298a3518f93
7
- data.tar.gz: 9a98f1db501b6ce59f4b21fb4f887c3aa84936ddfdd13dc125d9325a04266ea7d59ca643f43ae8dbf79933a2eefc88e093040b84266091f6896a67a36d89d6c6
6
+ metadata.gz: a2bc93400a00a977746147eed3d862a3df284f180e329b3a7ded32d057220d481b99986dba9ac291010b588172326ff434b296d9f1dd4cb0f4649ac7b1446f1c
7
+ data.tar.gz: 53860efda9706683be779313ee84ad1e05539992e53fc34097af42403d2e85af4c0b54246a4e26607a1ebdf3921c090b9a92322caf92a015836a063240434a84
data/.gitignore CHANGED
@@ -4,7 +4,6 @@
4
4
  .config
5
5
  .yardoc
6
6
  .rvmrc
7
- Gemfile.lock
8
7
  InstalledFiles
9
8
  _yardoc
10
9
  coverage
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in bato.gemspec
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Ang 'Bato Programming Language' ay isang scripting language sa wikang Filipino.
4
4
 
5
- Subukan ang [Bato](https://trybato.herokuapp.com/)
5
+ Subukan ang [Bato](https://trybato.herokuapp.com/) gamit ang *interactive online console* .
6
6
 
7
7
  ## Pagtatalaga
8
8
 
@@ -623,10 +623,40 @@ Halimbawa
623
623
  totoo o mali
624
624
  => totoo
625
625
 
626
+ ### katangian
627
+
628
+ Ang 'katangian' ay ginagamit upang makapag takda at makapag basa ng *value* sa katangian na ipinahayag sa loob ng grupo.
629
+
630
+ katangian
631
+ panguri
632
+
633
+ Halimbawa
634
+
635
+ bilang Robot
636
+ katangian :pangalan, :kakayahan
637
+
638
+ ang magpakilala
639
+ mag_print <<-INTRO
640
+ Ako ay isang Robot!
641
+ Ang pangalan ko ay "#{sariling.pangalan}"
642
+ Ako ay may kakayahang mag "#{sariling.kakayahan}"
643
+ INTRO
644
+ wakas
645
+ wakas
646
+
647
+ robot = Robot.gumawa
648
+ robot.pangalan = "bot-chukoy"
649
+ robot.kakayahan = "tambling"
650
+ robot.magpakilala
651
+
626
652
  ## Pagtulong sa pagdedevelop ng Bato
627
653
 
628
654
  Magpadala ng mga kahilingan sa paggawa ng ticket.
629
655
 
656
+ ## Media
657
+
658
+ * Na *feature* ang Bato programming language sa isang international news website na [The Register](https://www.theregister.co.uk/2018/03/21/philippines_ruby_bato). Mababasa ang artikel sa [https://www.theregister.co.uk/2018/03/21/philippines_ruby_bato](https://www.theregister.co.uk/2018/03/21/philippines_ruby_bato).
659
+
630
660
  ## Lisensya
631
661
 
632
662
  Instituto Ng Tekonolohiya sa Massachusetts License (makikita sa LICENSE.txt na file).
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
 
@@ -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
 
data/bin/bato CHANGED
@@ -1,21 +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
7
  if ARGV[0].nil?
6
- puts <<-EOS
7
- Hindi tinukoy ang file. Ang tamang sintaks ay:
8
+ puts <<~EOS
9
+ Hindi tinukoy ang file. Ang tamang sintaks ay:
8
10
 
9
- bato file.bt
11
+ bato file.bt
10
12
  EOS
11
13
  else
12
14
  ARGV.each do |file|
13
15
  next unless file
16
+
14
17
  tagatala = Bato::Tagatala.new
15
18
  kodigo = File.read file, encoding: 'utf-8'
16
19
  ruby_kodigo = tagatala.sa_ruby kodigo
17
20
  raise 'Ang pinakamababang kinakailangan bersiyon ng Ruby ay 2.4' if
18
21
  Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
22
+
19
23
  eval ruby_kodigo
20
24
  end
21
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bato/bersiyon'
2
4
 
3
5
  module Bato; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bato
2
- BERSIYON = '0.0.11'.freeze
4
+ BERSIYON = '0.0.12'
3
5
  end
@@ -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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Array
2
4
  alias baliktad reverse
3
5
  alias umikot cycle
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Class
2
4
  alias gumawa new
3
5
  alias kumatawan new
@@ -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,8 +1,14 @@
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
5
7
  alias mag_print puts
8
+ alias ilimbag puts
9
+ alias mag_limbag puts
10
+ alias itatak puts
11
+ alias mag_tatak puts
6
12
  alias iangat raise
7
13
  alias itaas raise
8
14
  alias matulog sleep
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Module
4
+ alias katangian attr_accessor
2
5
  alias panguri attr_accessor
3
6
  alias palawigin extend
4
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
@@ -1,191 +1,164 @@
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],
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],
37
+ ['magtanggal', %i[kUNDEF kUNDEF], :expr_fname],
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],
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
+ ]
81
+
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
+ ]
123
+
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],
156
130
  ['__ENCODING__', %i[k__ENCODING__ k__ENCODING__], :expr_end]
157
- ].map { |args| KWtable.new(*args) }
131
+ ]
158
132
 
159
- # :startdoc:
133
+ pang_argumentong_mga_salita = [
134
+ ['hindi', %i[kNOT kNOT], :expr_beg]
135
+ ]
160
136
 
161
137
  original_verbosity = $VERBOSE
162
138
  $VERBOSE = nil
163
139
 
164
- WORDLIST18 = Hash[*wordlist.map { |o| [o.name, o] }.flatten]
165
- WORDLIST19 = Hash[*wordlist.map { |o| [o.name, o] }.flatten]
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) }
146
+
147
+ WORDLIST18 = Hash[*mga_salita.map { |o| [o.name, o] }.flatten]
148
+ WORDLIST19 = Hash[*mga_salita.map { |o| [o.name, o] }.flatten]
166
149
 
167
150
  $VERBOSE = original_verbosity
168
151
 
169
152
  WORDLIST18.delete '__ENCODING__'
170
153
 
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
154
+ pang_ekspresyon_na_mga_salita.each do |k|
155
+ WORDLIST19[k[0]] = WORDLIST19[k[0]].dup
156
+ WORDLIST19[k[0]].state = :expr_value
185
157
  end
186
- %w[hindi].each do |k|
187
- WORDLIST19[k] = WORDLIST19[k].dup
188
- WORDLIST19[k].state = :expr_arg
158
+
159
+ pang_argumentong_mga_salita.each do |k|
160
+ WORDLIST19[k[0]] = WORDLIST19[k[0]].dup
161
+ WORDLIST19[k[0]].state = :expr_arg
189
162
  end
190
163
  end
191
164
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ruby2ruby'
2
4
  require 'ruby_parser'
3
5
  require 'bato/ruby_parser_patches'
@@ -6,7 +8,7 @@ module Bato
6
8
  class Tagatala
7
9
  def initialize; end
8
10
 
9
- PASIMULANG_KODIGO = "# encoding: utf-8\nrequire \"bato/core_ext\"\n".freeze
11
+ PASIMULANG_KODIGO = "# encoding: utf-8\nrequire \"bato/core_ext\"\n"
10
12
 
11
13
  def sa_ruby(kodigo)
12
14
  ruby2ruby = Ruby2Ruby.new
@@ -107,7 +107,7 @@ grupo Batotris
107
107
  PADER_LETRA = "🀫 "
108
108
  BLOCK_LETRA = "⚀ "
109
109
  WALA_LETRA = " "
110
- panguri :dako
110
+ katangian :dako
111
111
 
112
112
  ang initialize
113
113
  @sakop = gagalawan
@@ -1,13 +1,16 @@
1
- bilang Pangalan
2
- panguri :pangalan
1
+ bilang Robot
2
+ katangian :pangalan, :kakayahan
3
3
 
4
- ang initialize(pangalan)
5
- @pangalan = pangalan
6
- wakas
7
-
8
- ang ipakitaAngPangalan
9
- mag_print sariling.pangalan
4
+ ang magpakilala
5
+ mag_print <<-INTRO
6
+ Ako ay isang Robot!
7
+ Ang pangalan ko ay "#{sariling.pangalan}"
8
+ Ako ay may kakayahang mag "#{sariling.kakayahan}"
9
+ INTRO
10
10
  wakas
11
11
  wakas
12
12
 
13
- Pangalan.gumawa('Joel').ipakitaAngPangalan
13
+ robot = Robot.gumawa
14
+ robot.pangalan = "bot-chukoy"
15
+ robot.kakayahan = "tambling"
16
+ robot.magpakilala
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  isalaysay_ang 'Tagatala' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by the `rspec --init` command. Conventionally, all
2
4
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
5
  # Require this file using `require "spec_helper"` to ensure that it is only
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Bryan Juliano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-20 00:00:00.000000000 Z
11
+ date: 2018-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby2ruby
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.5.2
147
+ rubygems_version: 2.7.8
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Ang Bato ay isang programming language sa wikang Filipino