livetext 0.9.25 → 0.9.26

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/imports/bookish.rb +1 -2
  3. data/lib/livetext/errors.rb +3 -0
  4. data/lib/livetext/formatline.rb +102 -15
  5. data/lib/livetext/funcall.rb +86 -2
  6. data/lib/livetext/global_helpers.rb +5 -0
  7. data/lib/livetext/handler/import.rb +2 -6
  8. data/lib/livetext/handler/mixin.rb +2 -6
  9. data/lib/livetext/helpers.rb +9 -11
  10. data/lib/livetext/lineparser.rb +441 -0
  11. data/lib/livetext/more.rb +158 -0
  12. data/lib/livetext/processor.rb +3 -1
  13. data/lib/livetext/skeleton.rb +5 -0
  14. data/lib/livetext/standard.rb +12 -8
  15. data/lib/livetext/userapi.rb +27 -10
  16. data/lib/livetext/version.rb +1 -1
  17. data/lib/livetext.rb +3 -152
  18. data/test/snapshots/basic_formatting/actual-error.txt +0 -0
  19. data/test/snapshots/basic_formatting/actual-output.txt +13 -0
  20. data/test/snapshots/basic_formatting/err-sdiff.txt +1 -0
  21. data/test/snapshots/basic_formatting/out-sdiff.txt +14 -0
  22. data/test/snapshots/error_invalid_name/foo +5 -0
  23. data/test/snapshots/import_bookish/expected-output.txt +4 -4
  24. data/test/snapshots/more_functions/actual-error.txt +0 -0
  25. data/test/snapshots/more_functions/actual-output.txt +37 -0
  26. data/test/snapshots/more_functions/err-sdiff.txt +1 -0
  27. data/test/snapshots/more_functions/expected-output.txt +1 -1
  28. data/test/snapshots/more_functions/out-sdiff.txt +38 -0
  29. data/test/snapshots/more_functions/source.lt3 +1 -1
  30. data/test/snapshots/simple_vars/actual-error.txt +0 -0
  31. data/test/snapshots/simple_vars/actual-output.txt +6 -0
  32. data/test/snapshots/simple_vars/err-sdiff.txt +1 -0
  33. data/test/snapshots/simple_vars/out-sdiff.txt +7 -0
  34. data/test/snapshots/subset.txt +2 -0
  35. data/test/snapshots/var_into_func/actual-error.txt +0 -0
  36. data/test/snapshots/var_into_func/actual-output.txt +16 -0
  37. data/test/snapshots/var_into_func/err-sdiff.txt +1 -0
  38. data/test/snapshots/var_into_func/expected-error.txt +0 -0
  39. data/test/snapshots/var_into_func/expected-output.txt +16 -0
  40. data/test/snapshots/var_into_func/out-sdiff.txt +17 -0
  41. data/test/snapshots/var_into_func/source.lt3 +16 -0
  42. data/test/unit/all.rb +3 -1
  43. data/test/unit/formatline.rb +143 -274
  44. data/test/unit/lineparser.rb +650 -0
  45. data/test/unit/parser/set.rb +13 -12
  46. data/test/unit/tokenizer.rb +534 -0
  47. metadata +26 -5
  48. data/test/snapshots/error_inc_line_num/OUT +0 -17
  49. data/test/snapshots/error_no_such_copy/duh +0 -26
  50. data/test/snapshots/error_no_such_copy/mystery.txt +0 -36
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.25
4
+ version: 0.9.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-03-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -38,6 +38,8 @@ files:
38
38
  - lib/livetext/handler/mixin.rb
39
39
  - lib/livetext/helpers.rb
40
40
  - lib/livetext/html.rb
41
+ - lib/livetext/lineparser.rb
42
+ - lib/livetext/more.rb
41
43
  - lib/livetext/parser.rb
42
44
  - lib/livetext/parser/general.rb
43
45
  - lib/livetext/parser/set.rb
@@ -59,8 +61,12 @@ files:
59
61
  - plugin/tutorial.rb
60
62
  - test/all.rb
61
63
  - test/snapshots.rb
64
+ - test/snapshots/basic_formatting/actual-error.txt
65
+ - test/snapshots/basic_formatting/actual-output.txt
66
+ - test/snapshots/basic_formatting/err-sdiff.txt
62
67
  - test/snapshots/basic_formatting/expected-error.txt
63
68
  - test/snapshots/basic_formatting/expected-output.txt
69
+ - test/snapshots/basic_formatting/out-sdiff.txt
64
70
  - test/snapshots/basic_formatting/source.lt3
65
71
  - test/snapshots/block_comment/expected-error.txt
66
72
  - test/snapshots/block_comment/expected-output.txt
@@ -75,13 +81,13 @@ files:
75
81
  - test/snapshots/def_method/expected-error.txt
76
82
  - test/snapshots/def_method/expected-output.txt
77
83
  - test/snapshots/def_method/source.lt3
78
- - test/snapshots/error_inc_line_num/OUT
79
84
  - test/snapshots/error_inc_line_num/README.txt
80
85
  - test/snapshots/error_inc_line_num/expected-output.txt
81
86
  - test/snapshots/error_inc_line_num/file2.lt3
82
87
  - test/snapshots/error_inc_line_num/match-error.txt
83
88
  - test/snapshots/error_inc_line_num/source.lt3
84
89
  - test/snapshots/error_invalid_name/expected-output.txt
90
+ - test/snapshots/error_invalid_name/foo
85
91
  - test/snapshots/error_invalid_name/match-error.txt
86
92
  - test/snapshots/error_invalid_name/source.lt3
87
93
  - test/snapshots/error_line_num/expected-output.txt
@@ -96,10 +102,8 @@ files:
96
102
  - test/snapshots/error_name_not_permitted/expected-output.txt
97
103
  - test/snapshots/error_name_not_permitted/match-error.txt
98
104
  - test/snapshots/error_name_not_permitted/source.lt3
99
- - test/snapshots/error_no_such_copy/duh
100
105
  - test/snapshots/error_no_such_copy/expected-output.txt
101
106
  - test/snapshots/error_no_such_copy/match-error.txt
102
- - test/snapshots/error_no_such_copy/mystery.txt
103
107
  - test/snapshots/error_no_such_copy/source.lt3
104
108
  - test/snapshots/error_no_such_inc/expected-output.txt
105
109
  - test/snapshots/error_no_such_inc/match-error.txt
@@ -138,8 +142,12 @@ files:
138
142
  - test/snapshots/more_complex_vars/expected-error.txt
139
143
  - test/snapshots/more_complex_vars/expected-output.txt
140
144
  - test/snapshots/more_complex_vars/source.lt3
145
+ - test/snapshots/more_functions/actual-error.txt
146
+ - test/snapshots/more_functions/actual-output.txt
147
+ - test/snapshots/more_functions/err-sdiff.txt
141
148
  - test/snapshots/more_functions/expected-error.txt
142
149
  - test/snapshots/more_functions/expected-output.txt
150
+ - test/snapshots/more_functions/out-sdiff.txt
143
151
  - test/snapshots/more_functions/source.lt3
144
152
  - test/snapshots/predef_vars/expected-error.txt
145
153
  - test/snapshots/predef_vars/match-output.txt
@@ -167,8 +175,12 @@ files:
167
175
  - test/snapshots/simple_mixin/expected-output.txt
168
176
  - test/snapshots/simple_mixin/simple_mixin.rb
169
177
  - test/snapshots/simple_mixin/source.lt3
178
+ - test/snapshots/simple_vars/actual-error.txt
179
+ - test/snapshots/simple_vars/actual-output.txt
180
+ - test/snapshots/simple_vars/err-sdiff.txt
170
181
  - test/snapshots/simple_vars/expected-error.txt
171
182
  - test/snapshots/simple_vars/expected-output.txt
183
+ - test/snapshots/simple_vars/out-sdiff.txt
172
184
  - test/snapshots/simple_vars/source.lt3
173
185
  - test/snapshots/single_raw_line/expected-error.txt
174
186
  - test/snapshots/single_raw_line/expected-output.txt
@@ -177,10 +189,18 @@ files:
177
189
  - test/snapshots/table_with_heredocs/expected-error.txt
178
190
  - test/snapshots/table_with_heredocs/expected-output.txt
179
191
  - test/snapshots/table_with_heredocs/source.lt3
192
+ - test/snapshots/var_into_func/actual-error.txt
193
+ - test/snapshots/var_into_func/actual-output.txt
194
+ - test/snapshots/var_into_func/err-sdiff.txt
195
+ - test/snapshots/var_into_func/expected-error.txt
196
+ - test/snapshots/var_into_func/expected-output.txt
197
+ - test/snapshots/var_into_func/out-sdiff.txt
198
+ - test/snapshots/var_into_func/source.lt3
180
199
  - test/testlines.rb
181
200
  - test/unit/all.rb
182
201
  - test/unit/formatline.rb
183
202
  - test/unit/html.rb
203
+ - test/unit/lineparser.rb
184
204
  - test/unit/parser.rb
185
205
  - test/unit/parser/all.rb
186
206
  - test/unit/parser/general.rb
@@ -189,6 +209,7 @@ files:
189
209
  - test/unit/parser/string.rb
190
210
  - test/unit/standard.rb
191
211
  - test/unit/stringparser.rb
212
+ - test/unit/tokenizer.rb
192
213
  homepage: https://github.com/Hal9000/livetext
193
214
  licenses:
194
215
  - Ruby
@@ -1,17 +0,0 @@
1
- This is my
2
- source file
3
- which includes file2 here:
4
- This is file2
5
- which has an error
6
- about an unknown command
7
- in line 5
8
- This is my
9
- source file
10
- which includes file2 here:
11
- This is file2
12
- which has an error
13
- about an unknown command
14
- in line 5
15
- <p>
16
-
17
- And this is file2 line 7.
@@ -1,26 +0,0 @@
1
- ####
2
- self =
3
- #<Processor:0x00007fd5ec14d290
4
- @parent=#<Livetext:0x00007fd5ec14d358
5
- @source=nil,
6
- @_mixins=[],
7
- @_imports=[],
8
- @_outdir=".",
9
- @no_puts=false,
10
- @body="Make sure a\nnonexistent file with .copy\ngives an error.\n<p>\n\n",
11
- @main=#<Processor:0x00007fd5ec14d290 ...>,
12
- @indentation=[0],
13
- @_vars={"User"=>"Hal", :User=>"Hal", "Version"=>"0.9.24", :Version=>"0.9.24",
14
- "File"=>"source.lt3", :File=>"source.lt3",
15
- "FileDir"=>"/Users/Hal/Dropbox/topx/git/livetext/test/snapshots/error_no_such_copy",
16
- :FileDir=>"/Users/Hal/Dropbox/topx/git/livetext/test/snapshots/error_no_such_copy"},
17
- @backtrace=true>,
18
- @_nopass=false,
19
- @_nopara=false,
20
- @output=#<IO:<STDOUT>>,
21
- @sources=[[#<Enumerator: ["Make sure a", "nonexistent file with .copy", "gives an error.", "\n", ".copy nosuchfile.txt\n", "\n", "Nothing to\n", "see here.\n"]:each>, "source.lt3", 5]],
22
- @indentation=nil,
23
- @_mixins=[],
24
- @_imports=[],
25
- @_data="nosuchfile.txt",
26
- @_args=["nosuchfile.txt"]>
@@ -1,36 +0,0 @@
1
- livetext:78:in `parse_command_line'
2
- livetext:78:in `loop'
3
- livetext:92:in `block in parse_command_line'
4
- helpers.rb:72:in `process_file'
5
- helpers.rb:72:in `loop'
6
- helpers.rb:75:in `block in process_file'
7
- helpers.rb:95:in `process_line'
8
- helpers.rb:124:in `handle_dotcmd'
9
- standard.rb:273:in `copy': Error: file 'nosuchfile.txt' not found (FileNotFound)
10
-
11
-
12
- parse_command_line
13
- process_file
14
- process_line
15
- handle_dotcmd
16
- copy
17
-
18
-
19
-
20
-
21
- livetext "main" rescue unexpected
22
- process_file ret Bool, print warning, rescue unex, no raise
23
- process_line ret Bool, no rescue, no raise
24
- handle_dotcmd ret Bool, no rescue, 2 custom exceptions
25
- copy ret Bool, rescue only unexpected
26
- check_file_exists returns Boolean, no rescue, no raise
27
-
28
-
29
- METHOD RETURNS RESCUE RAISES OTHER
30
- ------------------- ----------------- ----------------- ----------------- -----------------
31
- parse_command_line nothing only unexpected
32
- process_file
33
- process_line
34
- handle_dotcmd
35
- copy
36
-