livetext 0.9.27 → 0.9.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.lt3 +3 -2
  3. data/imports/bookish.rb +1 -1
  4. data/lib/livetext/expansion.rb +108 -0
  5. data/lib/livetext/formatter.rb +223 -0
  6. data/lib/livetext/functions.rb +9 -0
  7. data/lib/livetext/helpers.rb +41 -29
  8. data/lib/livetext/html.rb +73 -0
  9. data/lib/livetext/more.rb +33 -13
  10. data/lib/livetext/parser/general.rb +1 -1
  11. data/lib/livetext/parser/set.rb +10 -3
  12. data/lib/livetext/processor.rb +5 -0
  13. data/lib/livetext/standard.rb +67 -67
  14. data/lib/livetext/userapi.rb +41 -19
  15. data/lib/livetext/version.rb +1 -1
  16. data/lib/livetext.rb +1 -1
  17. data/plugin/bookish.rb +1 -1
  18. data/plugin/bootstrap_menu.rb +140 -0
  19. data/plugin/misc/navbar.rb +162 -0
  20. data/test/extra/README.txt +149 -0
  21. data/test/extra/bracketed.rb +121 -0
  22. data/test/extra/bracketed.txt +44 -0
  23. data/test/extra/double.rb +121 -0
  24. data/test/extra/double.txt +44 -0
  25. data/test/extra/functions.rb +148 -0
  26. data/test/extra/functions.txt +58 -0
  27. data/test/extra/single.rb +139 -0
  28. data/test/extra/single.txt +52 -0
  29. data/test/extra/testgen.rb +104 -0
  30. data/test/extra/variables.rb +94 -0
  31. data/test/extra/variables.txt +35 -0
  32. data/test/snapshots/basic_formatting/expected-output.txt +2 -2
  33. data/test/snapshots/simple_vars/source.lt3 +1 -1
  34. data/test/snapshots/subset.txt +49 -49
  35. data/test/unit/all.rb +1 -2
  36. data/test/unit/parser/general.rb +2 -2
  37. data/test/unit/parser/set.rb +0 -9
  38. metadata +18 -34
  39. data/lib/livetext/funcall.rb +0 -87
  40. data/lib/livetext/lineparser.rb +0 -575
  41. data/test/snapshots/basic_formatting/actual-error.txt +0 -0
  42. data/test/snapshots/basic_formatting/actual-output.txt +0 -13
  43. data/test/snapshots/basic_formatting/err-sdiff.txt +0 -1
  44. data/test/snapshots/basic_formatting/out-sdiff.txt +0 -14
  45. data/test/snapshots/error_inc_line_num/README.txt +0 -20
  46. data/test/snapshots/error_invalid_name/foo +0 -5
  47. data/test/snapshots/functions/actual-error.txt +0 -19
  48. data/test/snapshots/functions/actual-output.txt +0 -0
  49. data/test/snapshots/functions/err-sdiff.txt +0 -20
  50. data/test/snapshots/more_complex_vars/actual-error.txt +0 -0
  51. data/test/snapshots/more_complex_vars/actual-output.txt +0 -4
  52. data/test/snapshots/more_complex_vars/err-sdiff.txt +0 -1
  53. data/test/snapshots/more_complex_vars/out-sdiff.txt +0 -5
  54. data/test/snapshots/more_functions/actual-error.txt +0 -19
  55. data/test/snapshots/more_functions/actual-output.txt +0 -0
  56. data/test/snapshots/more_functions/err-sdiff.txt +0 -20
  57. data/test/snapshots/raw_lines/actual-error.txt +0 -22
  58. data/test/snapshots/raw_lines/actual-output.txt +0 -0
  59. data/test/snapshots/raw_lines/err-sdiff.txt +0 -23
  60. data/test/snapshots/simple_vars/actual-error.txt +0 -0
  61. data/test/snapshots/simple_vars/actual-output.txt +0 -6
  62. data/test/snapshots/simple_vars/err-sdiff.txt +0 -1
  63. data/test/snapshots/simple_vars/out-sdiff.txt +0 -7
  64. data/test/snapshots/var_into_func/actual-error.txt +0 -19
  65. data/test/snapshots/var_into_func/actual-output.txt +0 -0
  66. data/test/snapshots/var_into_func/err-sdiff.txt +0 -20
  67. data/test/snapshots/var_into_func/out-sdiff.txt +0 -17
  68. data/test/unit/lineparser.rb +0 -359
  69. data/test/unit/new_lineparser.rb +0 -359
  70. data/test/unit/tokenizer.rb +0 -535
@@ -0,0 +1,94 @@
1
+ require 'minitest/autorun'
2
+
3
+ require 'livetext'
4
+
5
+ # Just another testing class. Chill.
6
+
7
+ class TestingLivetextVariables < MiniTest::Test
8
+
9
+ def setup
10
+ @live = Livetext.new
11
+ end
12
+
13
+ def check_match(exp, actual)
14
+ if exp.is_a? Regexp
15
+ assert_match(exp, actual, "actual does not match expected")
16
+ else
17
+ assert_equal(exp, actual, "actual != expected")
18
+ end
19
+ end
20
+
21
+ def test_variables_001_simple_variable
22
+ # Simple variable
23
+ # No special initialization
24
+ src = "User name is $User, and all is well"
25
+ exp = /is [[:alnum:]]+, and/
26
+ actual = @live.api.format(src)
27
+ check_match(exp, actual)
28
+ end
29
+
30
+ def test_variables_002_simple_user_variable
31
+ # Simple user variable
32
+ @live.api.setvar(:whatever, "some var value")
33
+ src = "This is $whatever"
34
+ exp = "This is some var value"
35
+ actual = @live.api.format(src)
36
+ check_match(exp, actual)
37
+ end
38
+
39
+ def test_variables_003_test_undefined_variable
40
+ # Test undefined variable
41
+ # No special initialization
42
+ src = "foo.bar is $foo.bar, apparently."
43
+ exp = /undefined/
44
+ actual = @live.api.format(src)
45
+ check_match(exp, actual)
46
+ end
47
+
48
+ def test_variables_004_variables_user_and_version
49
+ # Variables $User and $Version
50
+ # No special initialization
51
+ src = "I am user $User using Livetext v. $Version"
52
+ exp = /user [[:alnum:]]+ using Livetext v. [[:digit:]]+.[[:digit:]]+.[[:digit:]]+$/
53
+ actual = @live.api.format(src)
54
+ check_match(exp, actual)
55
+ end
56
+
57
+ def test_variables_005_undefined_variable
58
+ # Undefined variable
59
+ # No special initialization
60
+ src = "Here is $no.such.var's value"
61
+ exp = "Here is [no.such.var is undefined]'s value"
62
+ actual = @live.api.format(src)
63
+ check_match(exp, actual)
64
+ end
65
+
66
+ def test_variables_006_escaped_variable_name
67
+ # Escaped variable name
68
+ # No special initialization
69
+ src = "The backslash means that \\$gamma is not a variable"
70
+ exp = "The backslash means that $gamma is not a variable"
71
+ actual = @live.api.format(src)
72
+ check_match(exp, actual)
73
+ end
74
+
75
+ def test_variables_007_backslash_dollar_dollar
76
+ # Backslash dollar dollar
77
+ @live.api.setvar(:amount, 2.37)
78
+ src = "Observe: \\$$amount is not a function"
79
+ exp = "Observe: $2.37 is not a function"
80
+ actual = @live.api.format(src)
81
+ check_match(exp, actual)
82
+ end
83
+
84
+ def test_variables_008_period_after_variable_name
85
+ # Period after variable name
86
+ @live.api.setvar(:pi, 3.14159)
87
+ src = "Pi is roughly $pi."
88
+ exp = "Pi is roughly 3.14159."
89
+ actual = @live.api.format(src)
90
+ check_match(exp, actual)
91
+ end
92
+
93
+
94
+ end
@@ -0,0 +1,35 @@
1
+ Simple variable
2
+ "User name is $User, and all is well"
3
+ /is RX_USER, and/
4
+ -------------------------------------------------
5
+ Simple user variable
6
+ init: @live.api.setvar(:whatever, "some var value")
7
+ "This is $whatever"
8
+ "This is some var value"
9
+ -------------------------------------------------
10
+ Test undefined variable
11
+ "foo.bar is $foo.bar, apparently."
12
+ /undefined/
13
+ -------------------------------------------------
14
+ Variables $User and $Version
15
+ "I am user $User using Livetext v. $Version"
16
+ /user RX_USER using Livetext v. RX_VERS/
17
+ -------------------------------------------------
18
+ Undefined variable
19
+ "Here is $no.such.var's value"
20
+ "Here is [no.such.var is undefined]'s value"
21
+ -------------------------------------------------
22
+ Escaped variable name
23
+ "The backslash means that \$gamma is not a variable"
24
+ "The backslash means that $gamma is not a variable"
25
+ -------------------------------------------------
26
+ Backslash dollar dollar
27
+ init: @live.api.setvar(:amount, 2.37)
28
+ "Observe: \$$amount is not a function"
29
+ "Observe: $2.37 is not a function"
30
+ -------------------------------------------------
31
+ Period after variable name
32
+ init: @live.api.setvar(:pi, 3.14159)
33
+ "Pi is roughly $pi."
34
+ "Pi is roughly 3.14159."
35
+ -------------------------------------------------
@@ -1,9 +1,9 @@
1
1
  Here are examples of <b>boldface</b>
2
2
  and <i>italics</i>
3
- and <font size=+1><tt>code</tt></font>
3
+ and <tt>code</tt>
4
4
  as well as <b>more complex</b> examples
5
5
  of <i>italicized text</i>
6
- and <font size=+1><tt>code font</tt></font>.
6
+ and <tt>code font</tt>.
7
7
  <p>
8
8
 
9
9
  Here are some random punctuation marks:
@@ -3,5 +3,5 @@ some text.
3
3
  .set name=GulliverFoyle, nation=Terra
4
4
  Hi, there.
5
5
  $name is my name, and $nation is my nation.
6
- I'm $name, from $nation\.
6
+ I'm $name, from $nation.
7
7
  That's all.
@@ -19,68 +19,68 @@ h This file specifies which snapshots will/won't be run.
19
19
 
20
20
  # Note that QUIT (on a line by itself) will stop processing the file
21
21
 
22
-
23
22
  # Others (usually passing):
24
23
 
25
24
  # import/include/mixin, others...
26
25
 
27
- error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
28
- error_no_such_copy # ^ Same behavior as error_no_such_inc
29
- error_no_such_mixin # ^ Same behavior as error_missing_end
30
- simple_copy #
31
- simple_import #
32
- simple_include #
33
- simple_mixin #
34
- import # "Leading" output doesn't get generated (same as error_no_such_inc)
35
- import2 #
36
- mixin_bookish #
37
- import_bookish #
38
-
39
- # raw input
40
-
41
- single_raw_line #
42
- raw_lines #
43
- raw_text_block #
44
- copy_is_raw #
45
-
46
- # comments
47
-
48
- block_comment #
49
- comments_ignored_1 #
50
-
51
- # variables and heredocs
52
-
53
- predef_vars #
54
- simple_vars #
55
- more_complex_vars #
56
- table_with_heredocs #
26
+ error_no_such_inc # Output BEFORE error doesn't get passed through ("leading" output)
27
+ error_no_such_copy # ^ Same behavior as error_no_such_inc
28
+ error_no_such_mixin # ^ Same behavior as error_missing_end
29
+ simple_copy #
30
+ simple_import #
31
+ simple_include #
32
+ simple_mixin #
33
+ import # "Leading" output doesn't get generated (same as error_no_such_inc)
34
+ import2 #
35
+ mixin_bookish #
36
+ import_bookish #
37
+ test_wtf_bookish #
38
+
39
+ # raw input
40
+
41
+ single_raw_line #
42
+ raw_lines #
43
+ raw_text_block #
44
+ copy_is_raw #
45
+
46
+ # comments
47
+
48
+ block_comment #
49
+ comments_ignored_1 #
50
+
51
+ # variables and heredocs
52
+
53
+ predef_vars #
54
+ simple_vars #
55
+ more_complex_vars #
56
+ table_with_heredocs #
57
57
 
58
58
  # testing def
59
59
 
60
- def_method #
61
-
60
+ def_method #
61
+
62
62
  # intraline formatting
63
63
 
64
- basic_formatting #
65
- test_formatting_34 #
66
- test_formatting_35 #
64
+ basic_formatting #
65
+ test_formatting_34 #
66
+ test_formatting_35 #
67
67
 
68
68
  # Errors
69
69
 
70
- error_line_num #
71
- error_mismatched_end #
72
- error_name_not_permitted #
73
- error_invalid_name # ^ Same behavior as error_no_such_inc
74
- error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
75
- error_inc_line_num # Forgot what's wrong here
70
+ error_line_num #
71
+ error_mismatched_end #
72
+ error_name_not_permitted #
73
+ error_invalid_name # ^ Same behavior as error_no_such_inc
74
+ error_missing_end # Output is duplicated somehow. Look for: puts @body or puts @main.body
75
+ error_inc_line_num # Forgot what's wrong here
76
76
 
77
77
  # functions
78
78
 
79
- functions #
80
- more_functions #
79
+ functions #
80
+ more_functions #
81
+
82
+ # More/misc...
81
83
 
82
- # More/misc...
83
-
84
- example_alpha #
85
- example_alpha2 #
86
- hello_world #
84
+ example_alpha #
85
+ example_alpha2 #
86
+ hello_world #
data/test/unit/all.rb CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
2
  require_relative 'standard'
3
3
  require_relative 'parser' # nested
4
- require_relative 'lineparser'
5
- require_relative 'tokenizer'
4
+ require_relative 'html'
@@ -33,11 +33,11 @@ class TestParseGeneral < MiniTest::Test
33
33
  def test_variables
34
34
  vars = ["foo 234\n", "bar 456\n"]
35
35
  expect = [%w[foo 234], %w[bar 456]]
36
- assert_equal ParseGeneral.parse_vars(vars), expect
36
+ assert_equal ParseGeneral.parse_vars(vars), expect, "case 1 failed"
37
37
 
38
38
  vars = ["foo2 234", "bar2 456"] # newline irrelevant
39
39
  expect = [%w[foo2 234], %w[bar2 456]]
40
- assert_equal ParseGeneral.parse_vars(vars), expect
40
+ assert_equal ParseGeneral.parse_vars(vars), expect, "case 2 failed"
41
41
 
42
42
  # quotes are not stripped... hmm
43
43
  vars = ["alpha 'simple string'", 'beta "another string"']
@@ -145,15 +145,6 @@ class TestParseSet < MiniTest::Test
145
145
  # ^ ParseSet isn't smart enough to know about variables/functions
146
146
  end
147
147
 
148
- def test_var_eq_func
149
- set = ParseSet.new("date = $$date").parse
150
- set = set.first # [["var", "value"]]
151
- assert_equal set.first, "date"
152
- p set.last
153
- assert set.last =~ /undefined/, "Found 'undefined' for variable value"
154
- # ^ ParseSet isn't smart enough to know about variables/functions
155
- end
156
-
157
148
  def xtest_two_strings
158
149
  line = %[bday="May 31", date='5/31']
159
150
  set = ParseSet.new(line).parse
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.27
4
+ version: 0.9.32
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-04-29 00:00:00.000000000 Z
11
+ date: 2022-08-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -29,7 +29,8 @@ files:
29
29
  - lib/cmdargs.rb
30
30
  - lib/livetext.rb
31
31
  - lib/livetext/errors.rb
32
- - lib/livetext/funcall.rb
32
+ - lib/livetext/expansion.rb
33
+ - lib/livetext/formatter.rb
33
34
  - lib/livetext/functions.rb
34
35
  - lib/livetext/global_helpers.rb
35
36
  - lib/livetext/handler.rb
@@ -37,7 +38,6 @@ files:
37
38
  - lib/livetext/handler/mixin.rb
38
39
  - lib/livetext/helpers.rb
39
40
  - lib/livetext/html.rb
40
- - lib/livetext/lineparser.rb
41
41
  - lib/livetext/more.rb
42
42
  - lib/livetext/parser.rb
43
43
  - lib/livetext/parser/general.rb
@@ -53,19 +53,29 @@ files:
53
53
  - lib/livetext/version.rb
54
54
  - livetext.gemspec
55
55
  - plugin/bookish.rb
56
+ - plugin/bootstrap_menu.rb
56
57
  - plugin/calibre.rb
57
58
  - plugin/livemagick.rb
58
59
  - plugin/markdown.rb
60
+ - plugin/misc/navbar.rb
59
61
  - plugin/pyggish.rb
60
62
  - plugin/tutorial.rb
61
63
  - test/all.rb
64
+ - test/extra/README.txt
65
+ - test/extra/bracketed.rb
66
+ - test/extra/bracketed.txt
67
+ - test/extra/double.rb
68
+ - test/extra/double.txt
69
+ - test/extra/functions.rb
70
+ - test/extra/functions.txt
71
+ - test/extra/single.rb
72
+ - test/extra/single.txt
73
+ - test/extra/testgen.rb
74
+ - test/extra/variables.rb
75
+ - test/extra/variables.txt
62
76
  - test/snapshots.rb
63
- - test/snapshots/basic_formatting/actual-error.txt
64
- - test/snapshots/basic_formatting/actual-output.txt
65
- - test/snapshots/basic_formatting/err-sdiff.txt
66
77
  - test/snapshots/basic_formatting/expected-error.txt
67
78
  - test/snapshots/basic_formatting/expected-output.txt
68
- - test/snapshots/basic_formatting/out-sdiff.txt
69
79
  - test/snapshots/basic_formatting/source.lt3
70
80
  - test/snapshots/block_comment/expected-error.txt
71
81
  - test/snapshots/block_comment/expected-output.txt
@@ -80,13 +90,11 @@ files:
80
90
  - test/snapshots/def_method/expected-error.txt
81
91
  - test/snapshots/def_method/expected-output.txt
82
92
  - test/snapshots/def_method/source.lt3
83
- - test/snapshots/error_inc_line_num/README.txt
84
93
  - test/snapshots/error_inc_line_num/expected-output.txt
85
94
  - test/snapshots/error_inc_line_num/file2.lt3
86
95
  - test/snapshots/error_inc_line_num/match-error.txt
87
96
  - test/snapshots/error_inc_line_num/source.lt3
88
97
  - test/snapshots/error_invalid_name/expected-output.txt
89
- - test/snapshots/error_invalid_name/foo
90
98
  - test/snapshots/error_invalid_name/match-error.txt
91
99
  - test/snapshots/error_invalid_name/source.lt3
92
100
  - test/snapshots/error_line_num/expected-output.txt
@@ -116,9 +124,6 @@ files:
116
124
  - test/snapshots/example_alpha2/expected-error.txt
117
125
  - test/snapshots/example_alpha2/expected-output.txt
118
126
  - test/snapshots/example_alpha2/source.lt3
119
- - test/snapshots/functions/actual-error.txt
120
- - test/snapshots/functions/actual-output.txt
121
- - test/snapshots/functions/err-sdiff.txt
122
127
  - test/snapshots/functions/expected-error.txt
123
128
  - test/snapshots/functions/expected-output.txt
124
129
  - test/snapshots/functions/source.lt3
@@ -141,25 +146,15 @@ files:
141
146
  - test/snapshots/mixin_bookish/expected-output.txt
142
147
  - test/snapshots/mixin_bookish/source.lt3
143
148
  - test/snapshots/mixin_bookish/toc.tmp
144
- - test/snapshots/more_complex_vars/actual-error.txt
145
- - test/snapshots/more_complex_vars/actual-output.txt
146
- - test/snapshots/more_complex_vars/err-sdiff.txt
147
149
  - test/snapshots/more_complex_vars/expected-error.txt
148
150
  - test/snapshots/more_complex_vars/expected-output.txt
149
- - test/snapshots/more_complex_vars/out-sdiff.txt
150
151
  - test/snapshots/more_complex_vars/source.lt3
151
- - test/snapshots/more_functions/actual-error.txt
152
- - test/snapshots/more_functions/actual-output.txt
153
- - test/snapshots/more_functions/err-sdiff.txt
154
152
  - test/snapshots/more_functions/expected-error.txt
155
153
  - test/snapshots/more_functions/expected-output.txt
156
154
  - test/snapshots/more_functions/source.lt3
157
155
  - test/snapshots/predef_vars/expected-error.txt
158
156
  - test/snapshots/predef_vars/match-output.txt
159
157
  - test/snapshots/predef_vars/source.lt3
160
- - test/snapshots/raw_lines/actual-error.txt
161
- - test/snapshots/raw_lines/actual-output.txt
162
- - test/snapshots/raw_lines/err-sdiff.txt
163
158
  - test/snapshots/raw_lines/expected-error.txt
164
159
  - test/snapshots/raw_lines/expected-output.txt
165
160
  - test/snapshots/raw_lines/source.lt3
@@ -183,12 +178,8 @@ files:
183
178
  - test/snapshots/simple_mixin/expected-output.txt
184
179
  - test/snapshots/simple_mixin/simple_mixin.rb
185
180
  - test/snapshots/simple_mixin/source.lt3
186
- - test/snapshots/simple_vars/actual-error.txt
187
- - test/snapshots/simple_vars/actual-output.txt
188
- - test/snapshots/simple_vars/err-sdiff.txt
189
181
  - test/snapshots/simple_vars/expected-error.txt
190
182
  - test/snapshots/simple_vars/expected-output.txt
191
- - test/snapshots/simple_vars/out-sdiff.txt
192
183
  - test/snapshots/simple_vars/source.lt3
193
184
  - test/snapshots/single_raw_line/expected-error.txt
194
185
  - test/snapshots/single_raw_line/expected-output.txt
@@ -197,17 +188,11 @@ files:
197
188
  - test/snapshots/table_with_heredocs/expected-error.txt
198
189
  - test/snapshots/table_with_heredocs/expected-output.txt
199
190
  - test/snapshots/table_with_heredocs/source.lt3
200
- - test/snapshots/var_into_func/actual-error.txt
201
- - test/snapshots/var_into_func/actual-output.txt
202
- - test/snapshots/var_into_func/err-sdiff.txt
203
191
  - test/snapshots/var_into_func/expected-error.txt
204
192
  - test/snapshots/var_into_func/expected-output.txt
205
- - test/snapshots/var_into_func/out-sdiff.txt
206
193
  - test/snapshots/var_into_func/source.lt3
207
194
  - test/unit/all.rb
208
195
  - test/unit/html.rb
209
- - test/unit/lineparser.rb
210
- - test/unit/new_lineparser.rb
211
196
  - test/unit/parser.rb
212
197
  - test/unit/parser/all.rb
213
198
  - test/unit/parser/general.rb
@@ -216,7 +201,6 @@ files:
216
201
  - test/unit/parser/string.rb
217
202
  - test/unit/standard.rb
218
203
  - test/unit/stringparser.rb
219
- - test/unit/tokenizer.rb
220
204
  homepage: https://github.com/Hal9000/livetext
221
205
  licenses:
222
206
  - Ruby
@@ -1,87 +0,0 @@
1
-
2
- require_relative '../livetext'
3
-
4
- # Parse function calls
5
-
6
- module Livetext::LineParser::FunCall
7
-
8
- include Livetext::ParsingConstants
9
-
10
- def param_loop(char)
11
- param = ""
12
- loop do
13
- case peek
14
- when Escape
15
- param << escaped
16
- when char, LF, nil
17
- break
18
- else
19
- param << grab
20
- end
21
- end
22
- param = nil if param.empty?
23
- param
24
- end
25
-
26
- def grab_colon_param
27
- grab # grab :
28
- param = param_loop(Space)
29
- end
30
-
31
- def grab_bracket_param
32
- grab # [
33
- param = param_loop("]")
34
- grab # "]"
35
- param
36
- end
37
-
38
- def funcall(name, param)
39
- err = "[Error evaluating $$#{name}(#{param})]"
40
- name = name.gsub(/\./, "__")
41
- result =
42
- if self.send?(name, param)
43
- # do nothing
44
- else
45
- fobj = ::Livetext::Functions.new
46
- fobj.send(name, param) rescue err
47
- end
48
- result.to_s
49
- end
50
-
51
- def grab_func_with_param
52
- add_token(:str, @token)
53
- func = grab_alpha
54
- add_token(:func, func)
55
- param = grab_func_param(grab) # may be null/missing
56
- param
57
- end
58
-
59
- def double_dollar
60
- case peek
61
- when Space; add_token :string, "$$ "; grab
62
- when LF, nil; add "$$ "; add_token :str
63
- when Alpha; param = grab_func_with_param
64
- else grab; add_token :str, "$$" + peek
65
- end
66
- end
67
-
68
- # def grab_func_param
69
- # case peek
70
- # when "["
71
- # param = grab_bracket_param
72
- # add_token(:brackets, param)
73
- # when ":"
74
- # param = grab_colon_param
75
- # add_token(:colon, param)
76
- # else # do nothing
77
- # end
78
- # end
79
-
80
- def escaped
81
- grab # Eat the backslash
82
- ch = grab # Take next char
83
- ch
84
- end
85
-
86
- end
87
-