mucgly 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.rdoc +8 -0
  3. data/LICENSE +1 -1
  4. data/README.rdoc +160 -130
  5. data/bin/mucgly +4 -217
  6. data/doc/Mucgly.html +24 -82
  7. data/doc/_index.html +5 -153
  8. data/doc/class_list.html +7 -2
  9. data/doc/css/style.css +2 -1
  10. data/doc/file.CHANGELOG.html +16 -8
  11. data/doc/file.README.html +210 -187
  12. data/doc/file_list.html +6 -1
  13. data/doc/frames.html +5 -7
  14. data/doc/index.html +210 -187
  15. data/doc/js/app.js +7 -2
  16. data/doc/js/full_list.js +9 -6
  17. data/doc/method_list.html +7 -686
  18. data/doc/top-level-namespace.html +5 -5
  19. data/ext/mucgly/extconf.rb +11 -0
  20. data/ext/mucgly/mucgly.c +2095 -0
  21. data/lib/version.rb +6 -0
  22. data/test/golden/test_basic.txt +18 -0
  23. data/test/golden/test_specials_cli.txt +11 -0
  24. data/test/golden/test_specials_cmd.txt +36 -0
  25. data/test/result/test_basic.txt +18 -0
  26. data/test/result/test_specials_cli.txt +11 -0
  27. data/test/result/test_specials_cmd.txt +36 -0
  28. data/test/result/test_specials_cmd2.txt +1 -0
  29. data/test/test_basic.rx.txt +10 -6
  30. data/test/test_mucgly.rb +4 -6
  31. data/test/test_specials_cli.rx.txt +4 -4
  32. data/test/test_specials_cmd.rx.txt +5 -5
  33. metadata +45 -63
  34. data/Rakefile +0 -29
  35. data/doc/EasyFile/InOut.html +0 -2097
  36. data/doc/EasyFile/Read.html +0 -1334
  37. data/doc/EasyFile/ReadStack.html +0 -461
  38. data/doc/EasyFile/Stacked.html +0 -411
  39. data/doc/EasyFile/String.html +0 -570
  40. data/doc/EasyFile/Write.html +0 -1084
  41. data/doc/EasyFile/WriteStack.html +0 -305
  42. data/doc/EasyFile.html +0 -155
  43. data/doc/Mucgly/Env.html +0 -1675
  44. data/doc/Mucgly/MucglyFile/ParseState.html +0 -1662
  45. data/doc/Mucgly/MucglyFile/Token.html +0 -529
  46. data/doc/Mucgly/MucglyFile.html +0 -545
  47. data/doc/Mucgly/Separators.html +0 -521
  48. data/lib/easyfile.rb +0 -720
  49. data/lib/mucgly.rb +0 -627
  50. data/test/test_multi.rx.txt +0 -4
data/lib/version.rb ADDED
@@ -0,0 +1,6 @@
1
+ module Mucgly
2
+ VERSION = "0.1.0"
3
+ def Mucgly.version
4
+ Mucgly::VERSION
5
+ end
6
+ end
@@ -0,0 +1,18 @@
1
+ Line 1 from file "test_basic.rx.txt".
2
+ Test escapes (backslash, empty): "\" "" ... and the rest of the line.
3
+ Next the test file "test_include.txt" is included.
4
+ Line 1 in test file test_included.txt.
5
+ Line 2 in test file test_included.txt.
6
+ ...which is not terminated with a NL. This is again in file "test_basic.rx.txt".
7
+ Next line should be three times "bar" in a row.
8
+ barbarbar
9
+ A line of text.
10
+ Just some text from Mucgly.
11
+ Source "test_include.rb" and instantiate the class defined in there.
12
+ Print out a sum using the previously instantiated class.
13
+ Sum of 1+2 is: 3...
14
+ The last line in "test_basic.rx.txt"
15
+ The name of this file is: "test_basic.rx.txt".
16
+ We are outputting to file result/test_basic.txt and 16
17
+ Multipass macros are output with one "#" removed each round.
18
+ -<puts "This will be a macro execution in the next round.">-This comment will be consumed "".
@@ -0,0 +1,11 @@
1
+ Line 1 from file "test_specials_cli.rx.txt".
2
+ Test escapes (backslash, empty): "/" "" ... and the rest of the line.
3
+ Next the test file "test_include.txt" is included.
4
+ Line 1 in test file test_included.txt.
5
+ Line 2 in test file test_included.txt.
6
+ ...which is not terminated with a NL. This is again in file "test_specials_cli.rx.txt ".
7
+ Next line should be three times "bar" in a row.
8
+ barbarbar
9
+ A line of text.
10
+ Just some text from Mucgly.
11
+ The last line in "test_specials_cli.rx.txt"
@@ -0,0 +1,36 @@
1
+ Escaped chars (escape, hook hook): "\", "\" "\"
2
+
3
+ 1: Changing hook from "\" to "@"...
4
+ Escaped chars (escape, hook hook): "\", "@" "@"
5
+
6
+ 2: Changing hook from "@" to "#"...
7
+ Escaped chars (escape, hook hook): "\", "#" "#"
8
+
9
+ 3: Changing hook from "#" to "\"...
10
+ Escaped chars (escape, hook hook): "\", "\" "\"
11
+
12
+ 4: Changing escape from "\" to "#"...
13
+ Escaped chars (escape, hook hook): "#", "\" "\"
14
+
15
+ 5: Changing escape from "#" to "\"...
16
+ Escaped chars (escape, hook hook): "\", "\" "\"
17
+
18
+ 6: Changing hooks from "\" and "\" to "{" and "}"...
19
+ Escaped chars (escape, hook hook): "\", "{" "}"
20
+
21
+ 7: Changing hooks from "{" and "}" to "#{" and "}#"...
22
+ Escaped chars (escape, hook hook): "\", "#{" "}#"
23
+
24
+ 8: Changing hookbeg from "#{" to "{"...
25
+ Escaped chars (escape, hook hook): "\", "{" "}#"
26
+
27
+ 9: Changing hookend from "}#" to "}"...
28
+ Escaped chars (escape, hook hook): "\", "{" "}"
29
+
30
+ 11: Next line is comment and will disappear from output.
31
+
32
+ 12: Output is diverted to another output file.
33
+
34
+ 14: Skipped item 13: and now back in original file.
35
+
36
+ 15: Exiting at this point so following lines are not output.
@@ -0,0 +1,18 @@
1
+ Line 1 from file "test_basic.rx.txt".
2
+ Test escapes (backslash, empty): "\" "" ... and the rest of the line.
3
+ Next the test file "test_include.txt" is included.
4
+ Line 1 in test file test_included.txt.
5
+ Line 2 in test file test_included.txt.
6
+ ...which is not terminated with a NL. This is again in file "test_basic.rx.txt".
7
+ Next line should be three times "bar" in a row.
8
+ barbarbar
9
+ A line of text.
10
+ Just some text from Mucgly.
11
+ Source "test_include.rb" and instantiate the class defined in there.
12
+ Print out a sum using the previously instantiated class.
13
+ Sum of 1+2 is: 3...
14
+ The last line in "test_basic.rx.txt"
15
+ The name of this file is: "test_basic.rx.txt".
16
+ We are outputting to file result/test_basic.txt and 16
17
+ Multipass macros are output with one "#" removed each round.
18
+ -<puts "This will be a macro execution in the next round.">-This comment will be consumed "".
@@ -0,0 +1,11 @@
1
+ Line 1 from file "test_specials_cli.rx.txt".
2
+ Test escapes (backslash, empty): "/" "" ... and the rest of the line.
3
+ Next the test file "test_include.txt" is included.
4
+ Line 1 in test file test_included.txt.
5
+ Line 2 in test file test_included.txt.
6
+ ...which is not terminated with a NL. This is again in file "test_specials_cli.rx.txt ".
7
+ Next line should be three times "bar" in a row.
8
+ barbarbar
9
+ A line of text.
10
+ Just some text from Mucgly.
11
+ The last line in "test_specials_cli.rx.txt"
@@ -0,0 +1,36 @@
1
+ Escaped chars (escape, hook hook): "\", "\" "\"
2
+
3
+ 1: Changing hook from "\" to "@"...
4
+ Escaped chars (escape, hook hook): "\", "@" "@"
5
+
6
+ 2: Changing hook from "@" to "#"...
7
+ Escaped chars (escape, hook hook): "\", "#" "#"
8
+
9
+ 3: Changing hook from "#" to "\"...
10
+ Escaped chars (escape, hook hook): "\", "\" "\"
11
+
12
+ 4: Changing escape from "\" to "#"...
13
+ Escaped chars (escape, hook hook): "#", "\" "\"
14
+
15
+ 5: Changing escape from "#" to "\"...
16
+ Escaped chars (escape, hook hook): "\", "\" "\"
17
+
18
+ 6: Changing hooks from "\" and "\" to "{" and "}"...
19
+ Escaped chars (escape, hook hook): "\", "{" "}"
20
+
21
+ 7: Changing hooks from "{" and "}" to "#{" and "}#"...
22
+ Escaped chars (escape, hook hook): "\", "#{" "}#"
23
+
24
+ 8: Changing hookbeg from "#{" to "{"...
25
+ Escaped chars (escape, hook hook): "\", "{" "}#"
26
+
27
+ 9: Changing hookend from "}#" to "}"...
28
+ Escaped chars (escape, hook hook): "\", "{" "}"
29
+
30
+ 11: Next line is comment and will disappear from output.
31
+
32
+ 12: Output is diverted to another output file.
33
+
34
+ 14: Skipped item 13: and now back in original file.
35
+
36
+ 15: Exiting at this point so following lines are not output.
@@ -0,0 +1 @@
1
+ 13: This is the only line to this file.
@@ -1,19 +1,23 @@
1
- Line 1 from file "-<write _ifilename>-".
1
+ Line 1 from file "-<write ifilename>-".
2
2
  -<:hook \\>-\
3
3
  Test escapes (backslash, empty): "\\" "\ \ " \
4
4
  ... and the rest of the line.
5
5
  Next the test file "test_include.txt" is included.
6
6
  \:comment :include test_include.txt\ \
7
7
  \:include test_include.txt\ \
8
- This is again in file "\write _ifilename\ ".
8
+ This is again in file "\write ifilename\ ".
9
9
  Next line should be three times "bar" in a row.
10
- \@foo="bar";\ \.foo\ \write @foo\ \.foo\
10
+ \@foo="bar";\ \.@foo\ \write @foo\ \.@foo\
11
11
  A line of text.
12
12
  \puts "Just some text from Mucgly."\ \
13
13
  Source "test_include.rb" and instantiate the class defined in there.
14
14
  \:source test_include.rb\ \@obj = MyClass.new\ \
15
15
  Print out a sum using the previously instantiated class.
16
16
  \puts "Sum of 1+2 is: #{@obj.sum(1,2)}..."\ \
17
- The last line in "\write _ifilename\ "
18
- The name of this file is: "\write _ifilename\ ".
19
- We are outputting to file \write _ofilename\ and \write _olinenumber.to_s\
17
+ The last line in "\write ifilename\ "
18
+ The name of this file is: "\write ifilename\ ".
19
+ We are outputting to file \write ofilename\ and \write olinenumber.to_s\
20
+ Multipass macros are output with one "#" removed each round.
21
+ \:hook -< >-\ \
22
+ -<#puts "This will be a macro execution in the next round.">-\
23
+ This comment will be consumed "-</A comment>-".
data/test/test_mucgly.rb CHANGED
@@ -8,7 +8,7 @@ def runTest( cmdopts, test, sep = "" )
8
8
  rf = "result/#{test}#{sep}.txt"
9
9
  gf = "golden/#{test}#{sep}.txt"
10
10
 
11
- system( "export RUBYLIB=#{ENV['RUBYLIB']}:../lib; ../bin/mucgly #{cmdopts} -i #{test}.rx.txt -o #{rf}" )
11
+ system( "export RUBYLIB=#{ENV['RUBYLIB']}:../lib; ../bin/mucgly -i -m #{cmdopts} -f #{test}.rx.txt -o #{rf}" )
12
12
 
13
13
  if false
14
14
  # Populate golden files after inspection.
@@ -23,10 +23,8 @@ end
23
23
 
24
24
  class MucglyTest < Test::Unit::TestCase
25
25
 
26
- def test_basic() runTest( "", "test_basic" ); end
27
- def test_specials_cli1() runTest( "-s @ -e /", "test_specials_cli", "_1" ); end
28
- def test_specials_cli2() runTest( "-sb @ -se @ -e /", "test_specials_cli", "_2" ); end
29
- def test_specials_cmd() runTest( "", "test_specials_cmd" ); end
30
- def test_multi() runTest( "-m", "test_multi" ); end
26
+ def test_basic() runTest( "", "test_basic" ); end
27
+ def test_specials_cli() runTest( "-b @ -e @ -s /", "test_specials_cli" ); end
28
+ def test_specials_cmd() runTest( "", "test_specials_cmd" ); end
31
29
 
32
30
  end
@@ -1,11 +1,11 @@
1
- Line @write (_ilinenumber+1).to_s@ from file "@write _ifilename@".
1
+ Line @write (ilinenumber).to_s@ from file "@write ifilename@".
2
2
  Test escapes (backslash, empty): "//" "@ @" /
3
3
  ... and the rest of the line.
4
4
  Next the test file "test_include.txt" is included.
5
5
  @:include test_include.txt@/
6
- This is again in file "@write _ifilename@ ".
6
+ This is again in file "@write ifilename@ ".
7
7
  Next line should be three times "bar" in a row.
8
- @/@foo="bar"@@.foo@@.foo@@puts /@foo@/
8
+ @/@foo="bar"@@./@foo@@./@foo@@puts /@foo@/
9
9
  A line of text.
10
10
  @puts "Just some text from Mucgly."@/
11
- The last line in "@write _ifilename@"
11
+ The last line in "@write ifilename@"
@@ -14,11 +14,11 @@ Escaped chars (escape, hook hook): "\\", "\#" "\#"
14
14
  Escaped chars (escape, hook hook): "\\", "\\" "\\"
15
15
 
16
16
  4: Changing escape from "\\" to "#"...
17
- \:escape #\ #
17
+ \:hookesc #\ #
18
18
  Escaped chars (escape, hook hook): "##", "#\" "#\"
19
19
 
20
20
  5: Changing escape from "##" to "#\"...
21
- \:escape #\\\
21
+ \:hookesc #\\\
22
22
  Escaped chars (escape, hook hook): "\\", "\\" "\\"
23
23
 
24
24
  6: Changing hooks from "\\" and "\\" to "{" and "}"...
@@ -26,7 +26,7 @@ Escaped chars (escape, hook hook): "\\", "\\" "\\"
26
26
  Escaped chars (escape, hook hook): "\\", "\{" "\}"
27
27
 
28
28
  7: Changing hooks from "\{" and "\}" to "#\{" and "\}#"...
29
- {:hook #{ \}#}\
29
+ {:hook #\{ \}#}\
30
30
  Escaped chars (escape, hook hook): "\\", "\#{" "\}#"
31
31
 
32
32
  8: Changing hookbeg from "\#{" to "{"...
@@ -41,9 +41,9 @@ Escaped chars (escape, hook hook): "\\", "\{" "\}"
41
41
  {:comment This is a comment and will not appear in the output}\
42
42
 
43
43
  12: Output is diverted to another output file.
44
- {_pushOutput( _ofilename.gsub( /cmd/, "cmd2" ) )}\
44
+ {pushoutput( ofilename.gsub( /cmd/, "cmd2" ) )}\
45
45
  13: This is the only line to this file.
46
- {_closeOutput}\
46
+ {closeoutput}\
47
47
 
48
48
  14: Skipped item 13: and now back in original file.
49
49
 
metadata CHANGED
@@ -1,116 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mucgly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tero Isannainen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-15 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: como
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 0.1.0
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 0.1.0
11
+ date: 2015-02-27 00:00:00.000000000 Z
12
+ dependencies: []
30
13
  description: Mucgly is a macro expander for inline macros that exist in the middle
31
- of body text. The macros are mostly regular Ruby code, but a few special commands
32
- is also provided.
14
+ of body text. The macros are expected to be mostly regular Ruby code, but a few
15
+ special commands is also available.
33
16
  email: tero.isannainen@gmail.com
34
17
  executables:
35
18
  - mucgly
36
- extensions: []
19
+ extensions:
20
+ - ext/mucgly/extconf.rb
37
21
  extra_rdoc_files:
38
22
  - README.rdoc
39
23
  files:
40
- - README.rdoc
41
24
  - CHANGELOG.rdoc
42
25
  - LICENSE
43
- - Rakefile
44
- - lib/mucgly.rb
45
- - lib/easyfile.rb
46
- - doc/top-level-namespace.html
47
- - doc/js/full_list.js
48
- - doc/js/app.js
49
- - doc/js/jquery.js
50
- - doc/index.html
26
+ - README.rdoc
27
+ - bin/mucgly
28
+ - doc/Mucgly.html
29
+ - doc/_index.html
30
+ - doc/class_list.html
51
31
  - doc/css/common.css
52
32
  - doc/css/full_list.css
53
33
  - doc/css/style.css
54
- - doc/EasyFile.html
34
+ - doc/file.CHANGELOG.html
55
35
  - doc/file.README.html
56
- - doc/method_list.html
57
36
  - doc/file_list.html
58
- - doc/Mucgly/MucglyFile.html
59
- - doc/Mucgly/Env.html
60
- - doc/Mucgly/MucglyFile/Token.html
61
- - doc/Mucgly/MucglyFile/ParseState.html
62
- - doc/Mucgly/Separators.html
63
- - doc/Mucgly.html
64
- - doc/EasyFile/String.html
65
- - doc/EasyFile/Read.html
66
- - doc/EasyFile/ReadStack.html
67
- - doc/EasyFile/InOut.html
68
- - doc/EasyFile/Write.html
69
- - doc/EasyFile/WriteStack.html
70
- - doc/EasyFile/Stacked.html
71
- - doc/class_list.html
72
- - doc/_index.html
73
- - doc/file.CHANGELOG.html
74
37
  - doc/frames.html
75
- - test/test_specials_cmd.rx.txt
38
+ - doc/index.html
39
+ - doc/js/app.js
40
+ - doc/js/full_list.js
41
+ - doc/js/jquery.js
42
+ - doc/method_list.html
43
+ - doc/top-level-namespace.html
44
+ - ext/mucgly/extconf.rb
45
+ - ext/mucgly/mucgly.c
46
+ - lib/version.rb
47
+ - test/golden/test_basic.txt
48
+ - test/golden/test_specials_cli.txt
49
+ - test/golden/test_specials_cmd.txt
50
+ - test/result/test_basic.txt
51
+ - test/result/test_specials_cli.txt
52
+ - test/result/test_specials_cmd.txt
53
+ - test/result/test_specials_cmd2.txt
54
+ - test/test_basic.rx.txt
76
55
  - test/test_include.rb
77
56
  - test/test_include.txt
78
- - test/test_basic.rx.txt
79
- - test/test_multi.rx.txt
80
- - test/test_specials_cli.rx.txt
81
57
  - test/test_mucgly.rb
82
- - bin/mucgly
58
+ - test/test_specials_cli.rx.txt
59
+ - test/test_specials_cmd.rx.txt
83
60
  homepage:
84
61
  licenses:
85
62
  - Ruby
63
+ metadata: {}
86
64
  post_install_message: Check README...
87
65
  rdoc_options: []
88
66
  require_paths:
89
67
  - lib
90
68
  required_ruby_version: !ruby/object:Gem::Requirement
91
- none: false
92
69
  requirements:
93
- - - ! '>='
70
+ - - ">="
94
71
  - !ruby/object:Gem::Version
95
- version: 1.9.3
72
+ version: 2.0.0
96
73
  required_rubygems_version: !ruby/object:Gem::Requirement
97
- none: false
98
74
  requirements:
99
- - - ! '>='
75
+ - - ">="
100
76
  - !ruby/object:Gem::Version
101
77
  version: '0'
102
78
  requirements: []
103
79
  rubyforge_project:
104
- rubygems_version: 1.8.23
80
+ rubygems_version: 2.2.2
105
81
  signing_key:
106
- specification_version: 3
82
+ specification_version: 4
107
83
  summary: Mucgly processes inline macros.
108
84
  test_files:
85
+ - test/golden/test_basic.txt
86
+ - test/golden/test_specials_cli.txt
87
+ - test/golden/test_specials_cmd.txt
109
88
  - test/test_specials_cmd.rx.txt
110
89
  - test/test_include.rb
111
90
  - test/test_include.txt
112
91
  - test/test_basic.rx.txt
113
- - test/test_multi.rx.txt
114
92
  - test/test_specials_cli.rx.txt
115
93
  - test/test_mucgly.rb
94
+ - test/result/test_basic.txt
95
+ - test/result/test_specials_cli.txt
96
+ - test/result/test_specials_cmd2.txt
97
+ - test/result/test_specials_cmd.txt
116
98
  has_rdoc:
data/Rakefile DELETED
@@ -1,29 +0,0 @@
1
- require 'rake/testtask'
2
-
3
- Rake::TestTask.new do |t|
4
- t.libs << 'test'
5
- t.libs << 'lib'
6
- end
7
-
8
- desc "Run tests"
9
- task :default => :test
10
-
11
- task :cleanup_test do
12
- sh "rm -rf test/test"
13
- end
14
-
15
- task :build => :doc do
16
- sh "gem build mucgly.gemspec"
17
- end
18
-
19
- task :doc do
20
- sh "yardoc lib/* - README.rdoc CHANGELOG.rdoc"
21
- end
22
-
23
- task :publish do
24
- if Dir.glob('mucgly-*gem').length == 1
25
- sh "gem push mucgly*.gem"
26
- else
27
- raise "Multiple gems in the directory..."
28
- end
29
- end