walrus 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/walrus +19 -12
- data/lib/walrus.rb +27 -70
- data/lib/walrus/additions/string.rb +21 -35
- data/lib/walrus/compile_error.rb +19 -16
- data/lib/walrus/compiler.rb +66 -55
- data/lib/walrus/contrib/spec/walruscloth_spec.rb +21 -17
- data/lib/walrus/contrib/walruscloth.rb +19 -11
- data/lib/walrus/document.rb +41 -33
- data/lib/walrus/grammar.rb +474 -162
- data/lib/walrus/grammar/assignment_expression.rb +33 -0
- data/lib/walrus/grammar/block_directive.rb +37 -0
- data/lib/walrus/grammar/comment.rb +33 -0
- data/lib/walrus/grammar/def_directive.rb +80 -0
- data/lib/walrus/grammar/echo_directive.rb +56 -0
- data/lib/walrus/grammar/escape_sequence.rb +33 -0
- data/lib/walrus/grammar/import_directive.rb +54 -0
- data/lib/walrus/grammar/include_directive.rb +36 -0
- data/lib/walrus/grammar/instance_variable.rb +33 -0
- data/lib/walrus/grammar/literal.rb +33 -0
- data/lib/walrus/grammar/message_expression.rb +34 -0
- data/lib/walrus/grammar/multiline_comment.rb +70 -0
- data/lib/walrus/grammar/placeholder.rb +47 -0
- data/lib/walrus/grammar/raw_directive.rb +50 -0
- data/lib/walrus/grammar/raw_text.rb +56 -0
- data/lib/walrus/grammar/ruby_directive.rb +41 -0
- data/lib/walrus/grammar/ruby_expression.rb +42 -0
- data/lib/walrus/grammar/set_directive.rb +34 -0
- data/lib/walrus/grammar/silent_directive.rb +51 -0
- data/lib/walrus/grammar/slurp_directive.rb +36 -0
- data/lib/walrus/grammar/super_directive.rb +34 -0
- data/lib/walrus/parser.rb +26 -408
- data/lib/walrus/runner.rb +37 -20
- data/lib/walrus/template.rb +34 -25
- data/lib/walrus/version.rb +24 -1
- metadata +57 -71
- data/ext/extconf.rb +0 -16
- data/ext/jindex.c +0 -92
- data/lib/walrus/diff.rb +0 -95
- data/lib/walrus/grammar/additions/proc.rb +0 -26
- data/lib/walrus/grammar/additions/regexp.rb +0 -27
- data/lib/walrus/grammar/additions/string.rb +0 -58
- data/lib/walrus/grammar/additions/symbol.rb +0 -49
- data/lib/walrus/grammar/and_predicate.rb +0 -46
- data/lib/walrus/grammar/array_result.rb +0 -25
- data/lib/walrus/grammar/continuation_wrapper_exception.rb +0 -34
- data/lib/walrus/grammar/left_recursion_exception.rb +0 -33
- data/lib/walrus/grammar/location_tracking.rb +0 -115
- data/lib/walrus/grammar/match_data_wrapper.rb +0 -71
- data/lib/walrus/grammar/memoizing.rb +0 -47
- data/lib/walrus/grammar/memoizing_cache.rb +0 -103
- data/lib/walrus/grammar/node.rb +0 -66
- data/lib/walrus/grammar/not_predicate.rb +0 -46
- data/lib/walrus/grammar/parse_error.rb +0 -45
- data/lib/walrus/grammar/parser_state.rb +0 -187
- data/lib/walrus/grammar/parslet.rb +0 -34
- data/lib/walrus/grammar/parslet_choice.rb +0 -128
- data/lib/walrus/grammar/parslet_combination.rb +0 -32
- data/lib/walrus/grammar/parslet_combining.rb +0 -160
- data/lib/walrus/grammar/parslet_merge.rb +0 -94
- data/lib/walrus/grammar/parslet_omission.rb +0 -63
- data/lib/walrus/grammar/parslet_repetition.rb +0 -106
- data/lib/walrus/grammar/parslet_repetition_default.rb +0 -64
- data/lib/walrus/grammar/parslet_sequence.rb +0 -214
- data/lib/walrus/grammar/predicate.rb +0 -63
- data/lib/walrus/grammar/proc_parslet.rb +0 -58
- data/lib/walrus/grammar/regexp_parslet.rb +0 -79
- data/lib/walrus/grammar/skipped_substring_exception.rb +0 -42
- data/lib/walrus/grammar/string_enumerator.rb +0 -53
- data/lib/walrus/grammar/string_parslet.rb +0 -81
- data/lib/walrus/grammar/string_result.rb +0 -30
- data/lib/walrus/grammar/symbol_parslet.rb +0 -69
- data/lib/walrus/no_parameter_marker.rb +0 -25
- data/lib/walrus/walrus_grammar/assignment_expression.rb +0 -30
- data/lib/walrus/walrus_grammar/block_directive.rb +0 -34
- data/lib/walrus/walrus_grammar/comment.rb +0 -30
- data/lib/walrus/walrus_grammar/def_directive.rb +0 -72
- data/lib/walrus/walrus_grammar/echo_directive.rb +0 -50
- data/lib/walrus/walrus_grammar/escape_sequence.rb +0 -30
- data/lib/walrus/walrus_grammar/import_directive.rb +0 -50
- data/lib/walrus/walrus_grammar/include_directive.rb +0 -33
- data/lib/walrus/walrus_grammar/instance_variable.rb +0 -30
- data/lib/walrus/walrus_grammar/literal.rb +0 -30
- data/lib/walrus/walrus_grammar/message_expression.rb +0 -31
- data/lib/walrus/walrus_grammar/multiline_comment.rb +0 -60
- data/lib/walrus/walrus_grammar/placeholder.rb +0 -46
- data/lib/walrus/walrus_grammar/raw_directive.rb +0 -48
- data/lib/walrus/walrus_grammar/raw_text.rb +0 -51
- data/lib/walrus/walrus_grammar/ruby_directive.rb +0 -35
- data/lib/walrus/walrus_grammar/ruby_expression.rb +0 -37
- data/lib/walrus/walrus_grammar/set_directive.rb +0 -30
- data/lib/walrus/walrus_grammar/silent_directive.rb +0 -50
- data/lib/walrus/walrus_grammar/slurp_directive.rb +0 -31
- data/lib/walrus/walrus_grammar/super_directive.rb +0 -33
@@ -1,60 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class MultilineComment
|
21
|
-
|
22
|
-
# Multiline comments may containing nested Comments/Multiline comments or normal text, so must compile recursively.
|
23
|
-
# TODO: anchor comments that appear immediately before #def and #block directives to their corresponding methods (for the timebeing should note in the documentation that if you want your comments to appear adjacent to the blocks which follow them then you must put your comments inside the blocks)
|
24
|
-
def compile(options = {})
|
25
|
-
compiled = ''
|
26
|
-
if @content.respond_to? :each
|
27
|
-
@content.each do |item|
|
28
|
-
if item.kind_of? Comment
|
29
|
-
compiled << '# (nested) ' + item.compile
|
30
|
-
else
|
31
|
-
first = true
|
32
|
-
item.to_s.each do |line|
|
33
|
-
if first
|
34
|
-
first = false
|
35
|
-
compiled << '# MultilineComment:' + line.to_s.chomp + "\n"
|
36
|
-
else
|
37
|
-
compiled << '# MultilineComment (continued):' + line.to_s.chomp + "\n"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
else # no nesting, just raw text, but still must check for multiple lines
|
43
|
-
first = true
|
44
|
-
@content.to_s.each do |line|
|
45
|
-
if first
|
46
|
-
first = false
|
47
|
-
compiled << '# MultilineComment:' + line.to_s.chomp + "\n"
|
48
|
-
else
|
49
|
-
compiled << '# MultilineComment (continued):' + line.to_s.chomp + "\n"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
compiled
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end # class WalrusGrammar
|
59
|
-
end # Walrus
|
60
|
-
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class Placeholder
|
21
|
-
|
22
|
-
def compile(options = {})
|
23
|
-
|
24
|
-
if options[:nest_placeholders] == true
|
25
|
-
method_name = "lookup_and_return_placeholder" # placeholder nested inside another placeholder
|
26
|
-
else
|
27
|
-
method_name = "lookup_and_accumulate_placeholder" # placeholder used in a literal text stream
|
28
|
-
end
|
29
|
-
|
30
|
-
if @params == []
|
31
|
-
"#{method_name}(#{@name.to_s.to_sym.inspect})\n"
|
32
|
-
else
|
33
|
-
options = options.clone
|
34
|
-
options[:nest_placeholders] = true
|
35
|
-
params = (@params.kind_of? Array) ? @params : [@params]
|
36
|
-
param_list = params.collect { |param| param.compile(options) }.join(', ').chomp
|
37
|
-
"#{method_name}(#{@name.to_s.to_sym.inspect}, #{param_list})\n"
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
end # class Placeholder
|
43
|
-
|
44
|
-
end # class WalrusGrammar
|
45
|
-
end # Walrus
|
46
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class RawDirective
|
21
|
-
|
22
|
-
# Returns a string containing the compiled (Ruby) version of receiver.
|
23
|
-
def compile(options = {})
|
24
|
-
compiled = []
|
25
|
-
first = true
|
26
|
-
@content.to_s.to_source_string.each do |line|
|
27
|
-
newline = ''
|
28
|
-
if line =~ /(\r\n|\r|\n)\z/ # check for literal newline at end of line
|
29
|
-
line.chomp! # get rid of it
|
30
|
-
newline = ' + ' + $~[0].dump # include non-literal newline instead
|
31
|
-
end
|
32
|
-
|
33
|
-
if first
|
34
|
-
compiled << "accumulate('%s'%s) # RawDirective\n" % [ line, newline ]
|
35
|
-
first = false
|
36
|
-
else
|
37
|
-
compiled << "accumulate('%s'%s) # RawDirective (continued)\n" % [ line, newline ]
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
compiled.join
|
42
|
-
end
|
43
|
-
|
44
|
-
end # class RawDirective
|
45
|
-
|
46
|
-
end # class WalrusGrammar
|
47
|
-
end # Walrus
|
48
|
-
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class RawText
|
21
|
-
|
22
|
-
# Returns a string containing the compiled (Ruby) version of receiver.
|
23
|
-
# If options[:slurping] is true, instructs the receiver to strip the leading carriage return/line feed from the @lexeme prior to emitting the compiled output.
|
24
|
-
def compile(options = {})
|
25
|
-
lexeme = options[:slurping] ? @lexeme.to_s.sub(/\A(\r\n|\r|\n)/, '') : @lexeme.to_s
|
26
|
-
|
27
|
-
compiled = ''
|
28
|
-
first = true
|
29
|
-
lexeme.to_source_string.each do |line|
|
30
|
-
newline = ''
|
31
|
-
if line =~ /(\r\n|\r|\n)\z/ # check for literal newline at end of line
|
32
|
-
line.chomp! # get rid of it
|
33
|
-
newline = ' + ' + $~[0].dump # include non-literal newline instead
|
34
|
-
end
|
35
|
-
|
36
|
-
if first
|
37
|
-
compiled << "accumulate('%s'%s) # RawText\n" % [ line, newline ]
|
38
|
-
first = false
|
39
|
-
else
|
40
|
-
compiled << "accumulate('%s'%s) # RawText (continued)\n" % [ line, newline ]
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
compiled
|
45
|
-
end
|
46
|
-
|
47
|
-
end # class RawText
|
48
|
-
|
49
|
-
end # class WalrusGrammar
|
50
|
-
end # Walrus
|
51
|
-
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class RubyDirective
|
21
|
-
|
22
|
-
# TODO: could make a #rubyecho method that did an "accumulate do" instead of instance_eval
|
23
|
-
def compile(options = {})
|
24
|
-
# possible problem here is that the compiler will indent each line for us, possibly breaking here docs etc
|
25
|
-
# seeing as it is going to be indented anyway, I add some additional indenting here for pretty printing purposes
|
26
|
-
compiled = "instance_eval do # Ruby directive\n"
|
27
|
-
@content.to_s.each { |line| compiled << ' ' + line }
|
28
|
-
compiled << "end\n"
|
29
|
-
end
|
30
|
-
|
31
|
-
end # class RawDirective
|
32
|
-
|
33
|
-
end # class WalrusGrammar
|
34
|
-
end # Walrus
|
35
|
-
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class RubyExpression
|
21
|
-
|
22
|
-
# Rather than just compiling Ruby expressions back to text in a generic fashion it is desirable
|
23
|
-
# to compile the pieces separately (for an example, see the AssignmentExpression class) because
|
24
|
-
# this allows us to handle placeholders embedded inside Ruby expressions.
|
25
|
-
#
|
26
|
-
# Nevertheless, at an abstract level we here supply a default compilation method which just
|
27
|
-
# returns the source text, suitable for evaluation. Subclasses can then override this as new
|
28
|
-
# cases are discovered which require piece-by-piece compilation.
|
29
|
-
def compile(options = {})
|
30
|
-
source_text
|
31
|
-
end
|
32
|
-
|
33
|
-
end # class AssignmentExpression
|
34
|
-
|
35
|
-
end # class WalrusGrammar
|
36
|
-
end # Walrus
|
37
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class SetDirective
|
21
|
-
|
22
|
-
def compile(options = {})
|
23
|
-
"set_value(%s, instance_eval { %s }) # Set directive \n" % [ @placeholder.to_s.dump, @expression.compile ]
|
24
|
-
end
|
25
|
-
|
26
|
-
end # class SetDirective
|
27
|
-
|
28
|
-
end # class WalrusGrammar
|
29
|
-
end # Walrus
|
30
|
-
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that RawText class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class SilentDirective
|
21
|
-
|
22
|
-
def compile(options = {})
|
23
|
-
|
24
|
-
if @expression.respond_to? :each
|
25
|
-
expression = @expression
|
26
|
-
else
|
27
|
-
expression = [@expression]
|
28
|
-
end
|
29
|
-
|
30
|
-
# TODO: potentially include line, col and file name info in the comments generated by the compiler
|
31
|
-
|
32
|
-
compiled = ''
|
33
|
-
first = true
|
34
|
-
expression.each do |expr|
|
35
|
-
if first
|
36
|
-
compiled << "instance_eval { %s } # Silent directive\n" % expr.compile
|
37
|
-
first = false
|
38
|
-
else
|
39
|
-
compiled << "instance_eval { %s } # Silent directive (continued)\n" % expr.compile
|
40
|
-
end
|
41
|
-
end
|
42
|
-
compiled
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end # class SilentDirective
|
47
|
-
|
48
|
-
end # class WalrusGrammar
|
49
|
-
end # Walrus
|
50
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that the class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class SlurpDirective
|
21
|
-
|
22
|
-
# The slurp directive produces no meaningful output; but we leave a comment in the compiled template so that the location of the directive is visible in the source.
|
23
|
-
def compile(options = {})
|
24
|
-
"# Slurp directive\n"
|
25
|
-
end
|
26
|
-
|
27
|
-
end # class SlurpDirective
|
28
|
-
|
29
|
-
end # class WalrusGrammar
|
30
|
-
end # Walrus
|
31
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# Copyright 2007 Wincent Colaiuta
|
2
|
-
# This program is free software: you can redistribute it and/or modify
|
3
|
-
# it under the terms of the GNU General Public License as published by
|
4
|
-
# the Free Software Foundation, either version 3 of the License, or
|
5
|
-
# (at your option) any later version.
|
6
|
-
#
|
7
|
-
# This program is distributed in the hope that it will be useful,
|
8
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
-
# GNU General Public License for more details.
|
11
|
-
#
|
12
|
-
# You should have received a copy of the GNU General Public License
|
13
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
14
|
-
|
15
|
-
require 'walrus/parser.rb' # make sure that the class has been defined prior to extending it
|
16
|
-
|
17
|
-
module Walrus
|
18
|
-
class WalrusGrammar
|
19
|
-
|
20
|
-
class SuperDirective
|
21
|
-
|
22
|
-
def compile(options = {})
|
23
|
-
|
24
|
-
# basic case, no explicit parameters
|
25
|
-
"super # Super directive\n"
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end # class SuperDirective
|
30
|
-
|
31
|
-
end # class WalrusGrammar
|
32
|
-
end # Walrus
|
33
|
-
|