radius 0.6.1 → 0.7.0.prerelease
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -12
- data/LICENSE +19 -0
- data/QUICKSTART.rdoc +7 -7
- data/README.rdoc +10 -28
- data/Rakefile +8 -31
- data/VERSION +1 -0
- data/lib/radius.rb +3 -2
- data/lib/radius/context.rb +21 -13
- data/lib/radius/delegating_open_struct.rb +6 -0
- data/lib/radius/ord_string.rb +13 -0
- data/lib/radius/parse_tag.rb +1 -1
- data/lib/radius/parser.rb +25 -11
- data/lib/radius/parser/JavaScanner$Flavor.class +0 -0
- data/lib/radius/parser/JavaScanner$Tag.class +0 -0
- data/lib/radius/parser/JavaScanner.class +0 -0
- data/lib/radius/parser/JavaScanner.java +634 -0
- data/lib/radius/parser/JavaScanner.rl +179 -0
- data/lib/radius/parser/java_scanner.jar +0 -0
- data/lib/radius/parser/scanner.rb +1255 -0
- data/lib/radius/parser/{scan.rl → scanner.rl} +6 -4
- data/lib/radius/parser/squiggle_scanner.rb +1238 -0
- data/lib/radius/parser/squiggle_scanner.rl +126 -0
- data/lib/radius/utility.rb +10 -0
- data/lib/radius/version.rb +6 -12
- data/tasks/jeweler.rake +22 -0
- data/tasks/rdoc.rake +13 -0
- data/tasks/rubinius.rake +4 -0
- data/tasks/scan.rake +64 -12
- data/tasks/test.rake +7 -0
- data/test/benchmarks.rb +35 -0
- data/test/context_test.rb +2 -2
- data/test/multithreaded_test.rb +63 -0
- data/test/ord_string_test.rb +18 -0
- data/test/parser_test.rb +21 -4
- data/test/quickstart_test.rb +9 -11
- data/test/squiggle_test.rb +281 -0
- data/test/test_helper.rb +10 -2
- data/test/utility_test.rb +30 -0
- metadata +67 -64
- data.tar.gz.sig +0 -0
- data/Manifest.txt +0 -21
- data/lib/radius/parser/scan.rb +0 -700
- metadata.gz.sig +0 -0
data/CHANGELOG
CHANGED
@@ -1,20 +1,29 @@
|
|
1
1
|
= Change Log
|
2
|
-
=== 0.6.1
|
3
|
-
* Fixed a problem with non-tags that have no prefix or tagname (see test_parse_chirpy_bird)
|
4
2
|
|
5
|
-
|
3
|
+
== edge
|
4
|
+
* Support for Rubinius [jlong]
|
5
|
+
* Support for Ruby 1.9 [aemadrid]
|
6
|
+
* More tests [aemadrid]
|
7
|
+
* Fixed issue #5 - problem with other namespace tags [jemmyw]
|
8
|
+
* Switched to Jeweler for better gem management [jlong]
|
9
|
+
* Allow operation in a threaded environment (parser per-thread, shared context)
|
10
|
+
* Allow switching scanners that tokenize templates.
|
11
|
+
* Include SquiggleScanner to parse tags that look like "{ hello /}"
|
12
|
+
|
13
|
+
== 0.6.1
|
14
|
+
* Fixed a problem with non-tags that have no prefix or tag name (see test_parse_chirpy_bird)
|
15
|
+
|
16
|
+
== 0.6.0 (private release)
|
6
17
|
* Split radius.rb into multiple files.
|
7
|
-
*
|
18
|
+
* Ported the really hairy regexes from Radius::Parser to a single Ragel machine.
|
8
19
|
* Added and refactored tests.
|
9
20
|
* Refactored Rakefile and other administrativia.
|
10
21
|
|
11
|
-
|
12
|
-
* Fixed a problem with parsing quotes where a single tag preceding a double tag would consume the start
|
13
|
-
tag of the double tag if both contained attributes.
|
22
|
+
== 0.5.1
|
23
|
+
* Fixed a problem with parsing quotes where a single tag preceding a double tag would consume the start tag of the double tag if both contained attributes.
|
14
24
|
|
15
|
-
|
16
|
-
* Created a DSL for tag definitions (introducing a DSL makes this version of Radiant incompatible with
|
17
|
-
the last). The DSL has the following features:
|
25
|
+
== 0.5.0
|
26
|
+
* Created a DSL for tag definitions (introducing a DSL makes this version of Radiant incompatible with the last). The DSL has the following features:
|
18
27
|
- full support for nested tags
|
19
28
|
- global and local tag variables
|
20
29
|
- Contexts can now be defined dynamically (instead of being subclassed)
|
@@ -24,10 +33,10 @@
|
|
24
33
|
* Updated documentation to reflect the changes.
|
25
34
|
* Updated the version number to reflect the maturity of the code base.
|
26
35
|
|
27
|
-
|
36
|
+
== 0.0.2
|
28
37
|
* Refactored Parser to use Context#render_tag instead of #send when rendering tags defined on a Context.
|
29
38
|
* UndefinedTagError is now thrown when Parser tries to render a tag which doesn't exist on a Context.
|
30
39
|
* Added Context#tag_missing which works like method_method missing on Object, but is tag specific.
|
31
40
|
|
32
|
-
|
41
|
+
== 0.0.1
|
33
42
|
* First release.
|
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2006-2010, John W. Long
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/QUICKSTART.rdoc
CHANGED
@@ -256,8 +256,8 @@ tags to redefine variables. This is valuable when defining context sensitive tag
|
|
256
256
|
parser.parse('<r:name />') # raises a Radius::UndefinedTagError exception
|
257
257
|
|
258
258
|
Notice how TagBinding#locals enables intelligent nesting. "<r:jill:name />" evaluates to
|
259
|
-
"Jill", but "<r:jill:friend:name />" evaluates to "Jack". Locals
|
260
|
-
the tag they were defined in closes. Globals on the other hand, never
|
259
|
+
"Jill", but "<r:jill:friend:name />" evaluates to "Jack". Locals lose scope as soon as
|
260
|
+
the tag they were defined in closes. Globals on the other hand, never lose scope.
|
261
261
|
|
262
262
|
The final line in the example above demonstrates that calling "<r:name />" raises a
|
263
263
|
TagMissing error. This is because of the way the name tag was defined:
|
@@ -315,8 +315,8 @@ specificity a tag could be assigned would be:
|
|
315
315
|
|
316
316
|
One point for each of the levels.
|
317
317
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
318
|
+
In practice, you don't need to understand this topic to be effective with Radius.
|
319
|
+
For the most part you will find that Radius resolves tags precisely the way that
|
320
|
+
you would expect. If you find this section confusing forget about it and refer
|
321
|
+
back to it if you find that tags are resolving differently from the way that you
|
322
|
+
expected.
|
data/README.rdoc
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
= Radius -- Powerful Tag-Based Templates
|
2
2
|
|
3
|
-
Radius is a powerful tag-based template language for Ruby inspired by the
|
4
|
-
used in MovableType[http://www.movabletype.org] and
|
5
|
-
It uses tags similar to XML, but can
|
6
|
-
etc...).
|
3
|
+
Radius is a powerful tag-based template language for Ruby inspired by the
|
4
|
+
template languages used in MovableType[http://www.movabletype.org] and
|
5
|
+
TextPattern[http://www.textpattern.com]. It uses tags similar to XML, but can
|
6
|
+
be used to generate any form of plain text (HTML, e-mail, etc...).
|
7
|
+
|
7
8
|
|
8
9
|
== Usage
|
9
10
|
|
@@ -44,7 +45,7 @@ Output:
|
|
44
45
|
Read the QUICKSTART file to get up and running with Radius.
|
45
46
|
|
46
47
|
|
47
|
-
|
48
|
+
== Requirements
|
48
49
|
|
49
50
|
Radius does not have any external requirements for using the library in your
|
50
51
|
own programs.
|
@@ -60,30 +61,11 @@ It is recommended that you install Radius using the RubyGems packaging system:
|
|
60
61
|
|
61
62
|
% gem install --remote radius
|
62
63
|
|
63
|
-
You can also install Radius by copying lib/radius.rb into the Ruby load path.
|
64
|
-
|
65
64
|
|
66
65
|
== License
|
67
66
|
|
68
|
-
Radius is
|
69
|
-
|
70
|
-
Copyright (c) 2006-2009, John W. Long
|
71
|
-
|
72
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
73
|
-
software and associated documentation files (the "Software"), to deal in the Software
|
74
|
-
without restriction, including without limitation the rights to use, copy, modify, merge,
|
75
|
-
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
76
|
-
to whom the Software is furnished to do so, subject to the following conditions:
|
77
|
-
|
78
|
-
The above copyright notice and this permission notice shall be included in all copies or
|
79
|
-
substantial portions of the Software.
|
80
|
-
|
81
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
82
|
-
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
83
|
-
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
84
|
-
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
85
|
-
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
86
|
-
DEALINGS IN THE SOFTWARE.
|
67
|
+
Radius is released under the MIT license and is copyright (c) 2006-2010
|
68
|
+
John W. Long. A copy of the MIT license can be found in the LICENSE file.
|
87
69
|
|
88
70
|
|
89
71
|
== Roadmap
|
@@ -110,9 +92,9 @@ Experimental and development versions of Radius can be found on Github:
|
|
110
92
|
|
111
93
|
http://github.com/jlong/radius
|
112
94
|
|
113
|
-
If you are interested in helping with the development of
|
95
|
+
If you are interested in helping with the development of Radius, feel free to
|
114
96
|
fork the project on GitHub and send me a pull request.
|
115
97
|
|
116
98
|
|
117
99
|
John Long ::
|
118
|
-
http://wiseheartdesign.com
|
100
|
+
http://wiseheartdesign.com
|
data/Rakefile
CHANGED
@@ -1,31 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
p.url = "http://radius.rubyforge.org"
|
10
|
-
p.developer('John W. Long', 'me@johnwlong.com')
|
11
|
-
p.author = [
|
12
|
-
"John W. Long (me@johnwlong.com)",
|
13
|
-
"David Chelimsky (dchelimsky@gmail.com)",
|
14
|
-
"Bryce Kerley (bkerley@brycekerley.net)"
|
15
|
-
]
|
16
|
-
p.changes = p.paragraphs_of("CHANGELOG", 1..2).join("\n\n")
|
17
|
-
p.rubyforge_name = p.name
|
18
|
-
p.extra_dev_deps = [
|
19
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
20
|
-
]
|
21
|
-
p.readme_file = 'README.rdoc'
|
22
|
-
p.extra_rdoc_files |= %w(README.rdoc QUICKSTART.rdoc)
|
23
|
-
p.clean_globs |= %w(**/.DS_Store tmp *.log) # Remove these files on "rake clean"
|
24
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
25
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
26
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
27
|
-
p.test_globs = "test/**/*_test.rb"
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'newgem/tasks' # load /tasks/*.rake
|
31
|
-
Dir['tasks/**/*.rake'].each { |t| load t }
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
require File.dirname(__FILE__) + '/lib/radius/version'
|
5
|
+
|
6
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
7
|
+
|
8
|
+
task :default => :test
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.7.0.prerelease
|
data/lib/radius.rb
CHANGED
@@ -5,6 +5,7 @@ require 'radius/delegating_open_struct'
|
|
5
5
|
require 'radius/tag_binding'
|
6
6
|
require 'radius/context'
|
7
7
|
require 'radius/parse_tag'
|
8
|
-
require 'radius/
|
8
|
+
require 'radius/ord_string'
|
9
|
+
require 'radius/parser/scanner'
|
9
10
|
require 'radius/parser'
|
10
|
-
require 'radius/utility'
|
11
|
+
require 'radius/utility'
|
data/lib/radius/context.rb
CHANGED
@@ -7,8 +7,8 @@ module Radius
|
|
7
7
|
class Context
|
8
8
|
# A hash of tag definition blocks that define tags accessible on a Context.
|
9
9
|
attr_accessor :definitions # :nodoc:
|
10
|
-
attr_accessor :globals
|
11
|
-
|
10
|
+
attr_accessor :globals # :nodoc:
|
11
|
+
|
12
12
|
# Creates a new Context object.
|
13
13
|
def initialize(&block)
|
14
14
|
@definitions = {}
|
@@ -16,8 +16,8 @@ module Radius
|
|
16
16
|
@globals = DelegatingOpenStruct.new
|
17
17
|
with(&block) if block_given?
|
18
18
|
end
|
19
|
-
|
20
|
-
#
|
19
|
+
|
20
|
+
# Yield an instance of self for tag definitions:
|
21
21
|
#
|
22
22
|
# context.with do |c|
|
23
23
|
# c.define_tag 'test' do
|
@@ -29,10 +29,10 @@ module Radius
|
|
29
29
|
yield self
|
30
30
|
self
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# Creates a tag definition on a context. Several options are available to you
|
34
34
|
# when creating a tag:
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# +for+:: Specifies an object that the tag is in reference to. This is
|
37
37
|
# applicable when a block is not passed to the tag, or when the
|
38
38
|
# +expose+ option is also used.
|
@@ -66,27 +66,35 @@ module Radius
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
# Like method_missing for objects, but fired when a tag is undefined.
|
71
71
|
# Override in your own Context to change what happens when a tag is
|
72
72
|
# undefined. By default this method raises an UndefinedTagError.
|
73
73
|
def tag_missing(name, attributes, &block)
|
74
74
|
raise UndefinedTagError.new(name)
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
# Returns the state of the current render stack. Useful from inside
|
78
78
|
# a tag definition. Normally just use TagBinding#nesting.
|
79
79
|
def current_nesting
|
80
80
|
@tag_binding_stack.collect { |tag| tag.name }.join(':')
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
|
+
# make a usable copy of this context
|
84
|
+
def dup # :nodoc:
|
85
|
+
rv = self.class.new
|
86
|
+
rv.globals = globals.dup
|
87
|
+
rv.definitions = definitions.dup
|
88
|
+
rv
|
89
|
+
end
|
90
|
+
|
83
91
|
private
|
84
|
-
|
92
|
+
|
85
93
|
# A convienence method for managing the various parts of the
|
86
94
|
# tag binding stack.
|
87
95
|
def stack(name, attributes, block)
|
88
96
|
previous = @tag_binding_stack.last
|
89
|
-
previous_locals = previous.nil? ?
|
97
|
+
previous_locals = previous.nil? ? globals : previous.locals
|
90
98
|
locals = DelegatingOpenStruct.new(previous_locals)
|
91
99
|
binding = TagBinding.new(self, locals, name, attributes, block)
|
92
100
|
@tag_binding_stack.push(binding)
|
@@ -94,7 +102,7 @@ module Radius
|
|
94
102
|
@tag_binding_stack.pop
|
95
103
|
result
|
96
104
|
end
|
97
|
-
|
105
|
+
|
98
106
|
# Returns a fully qualified tag name based on state of the
|
99
107
|
# tag binding stack.
|
100
108
|
def qualified_tag_name(name)
|
@@ -114,7 +122,7 @@ module Radius
|
|
114
122
|
specific_name
|
115
123
|
end
|
116
124
|
end
|
117
|
-
|
125
|
+
|
118
126
|
# Returns the specificity for +tag_name+ at nesting defined
|
119
127
|
# by +nesting_parts+ as a number.
|
120
128
|
def numeric_specificity(tag_name, nesting_parts)
|
data/lib/radius/parse_tag.rb
CHANGED
data/lib/radius/parser.rb
CHANGED
@@ -7,34 +7,37 @@ module Radius
|
|
7
7
|
class Parser
|
8
8
|
# The Context object used to expand template tags.
|
9
9
|
attr_accessor :context
|
10
|
-
|
10
|
+
|
11
11
|
# The string that prefixes all tags that are expanded by a parser
|
12
12
|
# (the part in the tag name before the first colon).
|
13
13
|
attr_accessor :tag_prefix
|
14
|
+
|
15
|
+
# The class that performs tokenization of the input string
|
16
|
+
attr_accessor :scanner
|
14
17
|
|
15
18
|
# Creates a new parser object initialized with a Context.
|
16
19
|
def initialize(context = Context.new, options = {})
|
17
20
|
if context.kind_of?(Hash) and options.empty?
|
18
|
-
options = context
|
19
|
-
context = options[:context] || options['context'] || Context.new
|
21
|
+
options, context = context, (context[:context] || context['context'])
|
20
22
|
end
|
21
23
|
options = Utility.symbolize_keys(options)
|
22
|
-
|
23
|
-
|
24
|
+
self.context = context ? context.dup : Context.new
|
25
|
+
self.tag_prefix = options[:tag_prefix] || 'radius'
|
26
|
+
self.scanner = options[:scanner] || default_scanner
|
24
27
|
end
|
25
|
-
|
28
|
+
|
26
29
|
# Parses string for tags, expands them, and returns the result.
|
27
30
|
def parse(string)
|
28
|
-
@stack = [ParseContainerTag.new { |t| t.contents
|
31
|
+
@stack = [ ParseContainerTag.new { |t| Utility.array_to_s(t.contents) } ]
|
29
32
|
tokenize(string)
|
30
33
|
stack_up
|
31
34
|
@stack.last.to_s
|
32
35
|
end
|
33
|
-
|
36
|
+
|
34
37
|
protected
|
35
38
|
# Convert the string into a list of text blocks and scanners (tokens)
|
36
39
|
def tokenize(string)
|
37
|
-
@tokens =
|
40
|
+
@tokens = scanner.operate(tag_prefix, string)
|
38
41
|
end
|
39
42
|
|
40
43
|
def stack_up
|
@@ -51,7 +54,7 @@ module Radius
|
|
51
54
|
when :close
|
52
55
|
popped = @stack.pop
|
53
56
|
raise WrongEndTagError.new(popped.name, t[:name], @stack) if popped.name != t[:name]
|
54
|
-
popped.on_parse { |b| @context.render_tag(popped.name, popped.attributes) { b.contents
|
57
|
+
popped.on_parse { |b| @context.render_tag(popped.name, popped.attributes) { Utility.array_to_s(b.contents) } }
|
55
58
|
@stack.last.contents << popped
|
56
59
|
when :tasteless
|
57
60
|
raise TastelessTagError.new(t, @stack)
|
@@ -61,5 +64,16 @@ module Radius
|
|
61
64
|
end
|
62
65
|
raise MissingEndTagError.new(@stack.last.name, @stack) if @stack.length != 1
|
63
66
|
end
|
67
|
+
|
68
|
+
def default_scanner
|
69
|
+
if RUBY_PLATFORM == 'java'
|
70
|
+
require 'java'
|
71
|
+
require 'radius/parser/java_scanner.jar'
|
72
|
+
::Radius.send(:include_package, 'radius.parser')
|
73
|
+
Radius::JavaScanner.new(JRuby.runtime)
|
74
|
+
else
|
75
|
+
Radius::Scanner.new
|
76
|
+
end
|
77
|
+
end
|
64
78
|
end
|
65
|
-
end
|
79
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,634 @@
|
|
1
|
+
|
2
|
+
// line 1 "JavaScanner.rl"
|
3
|
+
|
4
|
+
// line 84 "JavaScanner.rl"
|
5
|
+
|
6
|
+
|
7
|
+
package radius.parser;
|
8
|
+
|
9
|
+
import java.util.HashMap;
|
10
|
+
import java.util.LinkedList;
|
11
|
+
import org.jruby.Ruby; // runtime
|
12
|
+
import org.jruby.RubyObject;
|
13
|
+
import org.jruby.runtime.builtin.IRubyObject;
|
14
|
+
import org.jruby.RubyArray;
|
15
|
+
import org.jruby.RubyString;
|
16
|
+
import org.jruby.RubyHash;
|
17
|
+
import org.jruby.RubySymbol;
|
18
|
+
|
19
|
+
public class JavaScanner {
|
20
|
+
|
21
|
+
Ruby runtime = null;
|
22
|
+
RubyArray rv = null;
|
23
|
+
|
24
|
+
void pass_through(String str) {
|
25
|
+
RubyObject last = ((RubyObject)rv.last());
|
26
|
+
if ( rv.size() > 0 && last != null && (last instanceof RubyString) ){
|
27
|
+
// XXX concat changes for ruby 1.9
|
28
|
+
((RubyString) last).concat(RubyString.newString(runtime, str));
|
29
|
+
} else {
|
30
|
+
rv.append(RubyString.newString(runtime, str));
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
void tag(String prefix, String name, RubyHash attr, RubySymbol flavor) {
|
35
|
+
RubyHash tag = RubyHash.newHash(runtime);
|
36
|
+
tag.op_aset(
|
37
|
+
runtime.getCurrentContext(),
|
38
|
+
RubySymbol.newSymbol(runtime, "prefix"),
|
39
|
+
RubyString.newString(runtime, prefix)
|
40
|
+
);
|
41
|
+
tag.op_aset(
|
42
|
+
runtime.getCurrentContext(),
|
43
|
+
RubySymbol.newSymbol(runtime, "name"),
|
44
|
+
RubyString.newString(runtime, name)
|
45
|
+
);
|
46
|
+
tag.op_aset(
|
47
|
+
runtime.getCurrentContext(),
|
48
|
+
RubySymbol.newSymbol(runtime, "attrs"),
|
49
|
+
attr
|
50
|
+
);
|
51
|
+
tag.op_aset(
|
52
|
+
runtime.getCurrentContext(),
|
53
|
+
RubySymbol.newSymbol(runtime, "flavor"),
|
54
|
+
flavor
|
55
|
+
);
|
56
|
+
rv.append(tag);
|
57
|
+
}
|
58
|
+
|
59
|
+
public JavaScanner(Ruby runtime) {
|
60
|
+
this.runtime = runtime;
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
// line 65 "JavaScanner.java"
|
65
|
+
private static byte[] init__parser_actions_0()
|
66
|
+
{
|
67
|
+
return new byte [] {
|
68
|
+
0, 1, 0, 1, 3, 1, 4, 1, 5, 1, 6, 1,
|
69
|
+
7, 1, 8, 1, 9, 1, 10, 1, 14, 1, 15, 1,
|
70
|
+
19, 1, 21, 1, 22, 1, 23, 2, 1, 2, 2, 5,
|
71
|
+
6, 2, 6, 7, 2, 9, 5, 2, 9, 10, 2, 10,
|
72
|
+
9, 2, 11, 20, 2, 12, 20, 2, 13, 20, 2, 16,
|
73
|
+
17, 2, 16, 18, 3, 5, 6, 7, 3, 9, 5, 6,
|
74
|
+
3, 16, 6, 17, 4, 9, 5, 6, 7, 4, 16, 5,
|
75
|
+
6, 17, 5, 16, 9, 5, 6, 17
|
76
|
+
};
|
77
|
+
}
|
78
|
+
|
79
|
+
private static final byte _parser_actions[] = init__parser_actions_0();
|
80
|
+
|
81
|
+
|
82
|
+
private static short[] init__parser_key_offsets_0()
|
83
|
+
{
|
84
|
+
return new short [] {
|
85
|
+
0, 0, 11, 21, 34, 47, 61, 65, 70, 72, 74, 87,
|
86
|
+
100, 101, 103, 118, 133, 149, 155, 161, 176, 179, 182, 185,
|
87
|
+
200, 202, 204, 219, 235, 241, 247, 250, 253, 269, 285, 302,
|
88
|
+
309, 315, 331, 335, 351, 366, 369, 371, 381, 392, 402, 416,
|
89
|
+
420, 420, 421, 430, 430, 430, 432, 434, 437, 440, 442, 444
|
90
|
+
};
|
91
|
+
}
|
92
|
+
|
93
|
+
private static final short _parser_key_offsets[] = init__parser_key_offsets_0();
|
94
|
+
|
95
|
+
|
96
|
+
private static char[] init__parser_trans_keys_0()
|
97
|
+
{
|
98
|
+
return new char [] {
|
99
|
+
58, 63, 95, 45, 46, 48, 57, 65, 90, 97, 122, 63,
|
100
|
+
95, 45, 46, 48, 58, 65, 90, 97, 122, 32, 47, 62,
|
101
|
+
63, 95, 9, 13, 45, 58, 65, 90, 97, 122, 32, 47,
|
102
|
+
62, 63, 95, 9, 13, 45, 58, 65, 90, 97, 122, 32,
|
103
|
+
61, 63, 95, 9, 13, 45, 46, 48, 58, 65, 90, 97,
|
104
|
+
122, 32, 61, 9, 13, 32, 34, 39, 9, 13, 34, 92,
|
105
|
+
34, 92, 32, 47, 62, 63, 95, 9, 13, 45, 58, 65,
|
106
|
+
90, 97, 122, 32, 47, 62, 63, 95, 9, 13, 45, 58,
|
107
|
+
65, 90, 97, 122, 62, 34, 92, 32, 34, 47, 62, 63,
|
108
|
+
92, 95, 9, 13, 45, 58, 65, 90, 97, 122, 32, 34,
|
109
|
+
47, 62, 63, 92, 95, 9, 13, 45, 58, 65, 90, 97,
|
110
|
+
122, 32, 34, 61, 63, 92, 95, 9, 13, 45, 46, 48,
|
111
|
+
58, 65, 90, 97, 122, 32, 34, 61, 92, 9, 13, 32,
|
112
|
+
34, 39, 92, 9, 13, 32, 34, 47, 62, 63, 92, 95,
|
113
|
+
9, 13, 45, 58, 65, 90, 97, 122, 34, 62, 92, 34,
|
114
|
+
39, 92, 34, 39, 92, 32, 39, 47, 62, 63, 92, 95,
|
115
|
+
9, 13, 45, 58, 65, 90, 97, 122, 39, 92, 39, 92,
|
116
|
+
32, 39, 47, 62, 63, 92, 95, 9, 13, 45, 58, 65,
|
117
|
+
90, 97, 122, 32, 39, 61, 63, 92, 95, 9, 13, 45,
|
118
|
+
46, 48, 58, 65, 90, 97, 122, 32, 39, 61, 92, 9,
|
119
|
+
13, 32, 34, 39, 92, 9, 13, 34, 39, 92, 34, 39,
|
120
|
+
92, 32, 34, 39, 47, 62, 63, 92, 95, 9, 13, 45,
|
121
|
+
58, 65, 90, 97, 122, 32, 34, 39, 47, 62, 63, 92,
|
122
|
+
95, 9, 13, 45, 58, 65, 90, 97, 122, 32, 34, 39,
|
123
|
+
61, 63, 92, 95, 9, 13, 45, 46, 48, 58, 65, 90,
|
124
|
+
97, 122, 32, 34, 39, 61, 92, 9, 13, 32, 34, 39,
|
125
|
+
92, 9, 13, 32, 34, 39, 47, 62, 63, 92, 95, 9,
|
126
|
+
13, 45, 58, 65, 90, 97, 122, 34, 39, 62, 92, 32,
|
127
|
+
34, 39, 47, 62, 63, 92, 95, 9, 13, 45, 58, 65,
|
128
|
+
90, 97, 122, 32, 39, 47, 62, 63, 92, 95, 9, 13,
|
129
|
+
45, 58, 65, 90, 97, 122, 39, 62, 92, 39, 92, 63,
|
130
|
+
95, 45, 46, 48, 57, 65, 90, 97, 122, 58, 63, 95,
|
131
|
+
45, 46, 48, 57, 65, 90, 97, 122, 63, 95, 45, 46,
|
132
|
+
48, 58, 65, 90, 97, 122, 32, 62, 63, 95, 9, 13,
|
133
|
+
45, 46, 48, 58, 65, 90, 97, 122, 32, 62, 9, 13,
|
134
|
+
60, 47, 63, 95, 45, 57, 65, 90, 97, 122, 34, 92,
|
135
|
+
34, 92, 34, 39, 92, 34, 39, 92, 39, 92, 39, 92,
|
136
|
+
0
|
137
|
+
};
|
138
|
+
}
|
139
|
+
|
140
|
+
private static final char _parser_trans_keys[] = init__parser_trans_keys_0();
|
141
|
+
|
142
|
+
|
143
|
+
private static byte[] init__parser_single_lengths_0()
|
144
|
+
{
|
145
|
+
return new byte [] {
|
146
|
+
0, 3, 2, 5, 5, 4, 2, 3, 2, 2, 5, 5,
|
147
|
+
1, 2, 7, 7, 6, 4, 4, 7, 3, 3, 3, 7,
|
148
|
+
2, 2, 7, 6, 4, 4, 3, 3, 8, 8, 7, 5,
|
149
|
+
4, 8, 4, 8, 7, 3, 2, 2, 3, 2, 4, 2,
|
150
|
+
0, 1, 3, 0, 0, 2, 2, 3, 3, 2, 2, 0
|
151
|
+
};
|
152
|
+
}
|
153
|
+
|
154
|
+
private static final byte _parser_single_lengths[] = init__parser_single_lengths_0();
|
155
|
+
|
156
|
+
|
157
|
+
private static byte[] init__parser_range_lengths_0()
|
158
|
+
{
|
159
|
+
return new byte [] {
|
160
|
+
0, 4, 4, 4, 4, 5, 1, 1, 0, 0, 4, 4,
|
161
|
+
0, 0, 4, 4, 5, 1, 1, 4, 0, 0, 0, 4,
|
162
|
+
0, 0, 4, 5, 1, 1, 0, 0, 4, 4, 5, 1,
|
163
|
+
1, 4, 0, 4, 4, 0, 0, 4, 4, 4, 5, 1,
|
164
|
+
0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
165
|
+
};
|
166
|
+
}
|
167
|
+
|
168
|
+
private static final byte _parser_range_lengths[] = init__parser_range_lengths_0();
|
169
|
+
|
170
|
+
|
171
|
+
private static short[] init__parser_index_offsets_0()
|
172
|
+
{
|
173
|
+
return new short [] {
|
174
|
+
0, 0, 8, 15, 25, 35, 45, 49, 54, 57, 60, 70,
|
175
|
+
80, 82, 85, 97, 109, 121, 127, 133, 145, 149, 153, 157,
|
176
|
+
169, 172, 175, 187, 199, 205, 211, 215, 219, 232, 245, 258,
|
177
|
+
265, 271, 284, 289, 302, 314, 318, 321, 328, 336, 343, 353,
|
178
|
+
357, 358, 360, 367, 368, 369, 372, 375, 379, 383, 386, 389
|
179
|
+
};
|
180
|
+
}
|
181
|
+
|
182
|
+
private static final short _parser_index_offsets[] = init__parser_index_offsets_0();
|
183
|
+
|
184
|
+
|
185
|
+
private static byte[] init__parser_indicies_0()
|
186
|
+
{
|
187
|
+
return new byte [] {
|
188
|
+
2, 1, 1, 1, 1, 1, 1, 0, 3, 3, 3, 3,
|
189
|
+
3, 3, 0, 4, 6, 7, 5, 5, 4, 5, 5, 5,
|
190
|
+
0, 8, 10, 11, 9, 9, 8, 9, 9, 9, 0, 13,
|
191
|
+
15, 14, 14, 13, 14, 14, 14, 14, 12, 16, 17, 16,
|
192
|
+
12, 17, 18, 19, 17, 12, 21, 22, 20, 24, 25, 23,
|
193
|
+
26, 28, 29, 27, 27, 26, 27, 27, 27, 12, 30, 32,
|
194
|
+
33, 31, 31, 30, 31, 31, 31, 12, 34, 12, 35, 25,
|
195
|
+
23, 36, 24, 38, 39, 37, 25, 37, 36, 37, 37, 37,
|
196
|
+
23, 40, 24, 42, 43, 41, 25, 41, 40, 41, 41, 41,
|
197
|
+
23, 44, 24, 46, 45, 25, 45, 44, 45, 45, 45, 45,
|
198
|
+
23, 47, 24, 48, 25, 47, 23, 48, 49, 50, 25, 48,
|
199
|
+
23, 51, 21, 53, 54, 52, 22, 52, 51, 52, 52, 52,
|
200
|
+
20, 24, 55, 25, 23, 57, 58, 59, 56, 61, 35, 62,
|
201
|
+
60, 64, 24, 66, 67, 65, 68, 65, 64, 65, 65, 65,
|
202
|
+
63, 24, 68, 63, 61, 68, 63, 69, 24, 71, 72, 70,
|
203
|
+
68, 70, 69, 70, 70, 70, 63, 73, 24, 75, 74, 68,
|
204
|
+
74, 73, 74, 74, 74, 74, 63, 76, 24, 77, 68, 76,
|
205
|
+
63, 77, 78, 79, 68, 77, 63, 80, 58, 59, 56, 81,
|
206
|
+
81, 62, 60, 82, 61, 35, 84, 85, 83, 62, 83, 82,
|
207
|
+
83, 83, 83, 60, 86, 61, 35, 88, 89, 87, 62, 87,
|
208
|
+
86, 87, 87, 87, 60, 90, 61, 35, 92, 91, 62, 91,
|
209
|
+
90, 91, 91, 91, 91, 60, 93, 61, 35, 94, 62, 93,
|
210
|
+
60, 94, 95, 96, 62, 94, 60, 97, 80, 58, 99, 100,
|
211
|
+
98, 59, 98, 97, 98, 98, 98, 56, 61, 35, 101, 62,
|
212
|
+
60, 97, 57, 58, 99, 100, 98, 59, 98, 97, 98, 98,
|
213
|
+
98, 56, 103, 21, 105, 106, 104, 107, 104, 103, 104, 104,
|
214
|
+
104, 102, 24, 108, 68, 63, 21, 107, 102, 109, 109, 109,
|
215
|
+
109, 109, 109, 0, 111, 110, 110, 110, 110, 110, 110, 0,
|
216
|
+
112, 112, 112, 112, 112, 112, 0, 113, 115, 114, 114, 113,
|
217
|
+
114, 114, 114, 114, 0, 116, 117, 116, 0, 118, 120, 119,
|
218
|
+
123, 122, 122, 122, 122, 122, 121, 124, 125, 24, 25, 23,
|
219
|
+
24, 25, 23, 61, 35, 62, 60, 61, 35, 62, 60, 24,
|
220
|
+
68, 63, 24, 68, 63, 126, 0
|
221
|
+
};
|
222
|
+
}
|
223
|
+
|
224
|
+
private static final byte _parser_indicies[] = init__parser_indicies_0();
|
225
|
+
|
226
|
+
|
227
|
+
private static byte[] init__parser_trans_targs_0()
|
228
|
+
{
|
229
|
+
return new byte [] {
|
230
|
+
49, 1, 2, 3, 4, 3, 12, 52, 4, 5, 12, 52,
|
231
|
+
49, 6, 5, 7, 6, 7, 8, 42, 9, 10, 13, 9,
|
232
|
+
10, 13, 11, 5, 12, 52, 11, 5, 12, 52, 51, 14,
|
233
|
+
15, 16, 20, 54, 15, 16, 20, 54, 17, 16, 18, 17,
|
234
|
+
18, 19, 21, 15, 16, 20, 54, 53, 22, 23, 14, 31,
|
235
|
+
22, 23, 31, 24, 26, 27, 41, 58, 25, 26, 27, 41,
|
236
|
+
58, 28, 27, 29, 28, 29, 30, 40, 23, 32, 33, 34,
|
237
|
+
38, 56, 33, 34, 38, 56, 35, 34, 36, 35, 36, 37,
|
238
|
+
39, 33, 34, 38, 56, 55, 24, 26, 27, 41, 58, 25,
|
239
|
+
57, 44, 44, 45, 46, 47, 46, 59, 47, 59, 0, 49,
|
240
|
+
50, 49, 1, 43, 49, 49, 49
|
241
|
+
};
|
242
|
+
}
|
243
|
+
|
244
|
+
private static final byte _parser_trans_targs[] = init__parser_trans_targs_0();
|
245
|
+
|
246
|
+
|
247
|
+
private static byte[] init__parser_trans_actions_0()
|
248
|
+
{
|
249
|
+
return new byte [] {
|
250
|
+
27, 0, 31, 3, 5, 0, 5, 5, 0, 11, 0, 0,
|
251
|
+
29, 13, 0, 13, 0, 0, 0, 0, 15, 43, 15, 0,
|
252
|
+
17, 0, 7, 64, 34, 34, 0, 37, 9, 9, 0, 17,
|
253
|
+
7, 64, 34, 81, 0, 37, 9, 72, 13, 0, 13, 0,
|
254
|
+
0, 17, 0, 40, 76, 68, 86, 58, 15, 46, 43, 15,
|
255
|
+
0, 17, 0, 0, 7, 64, 34, 81, 0, 0, 37, 9,
|
256
|
+
72, 13, 0, 13, 0, 0, 0, 17, 43, 17, 7, 64,
|
257
|
+
34, 81, 0, 37, 9, 72, 13, 0, 13, 0, 0, 17,
|
258
|
+
17, 40, 76, 68, 86, 58, 15, 40, 76, 68, 86, 15,
|
259
|
+
58, 1, 0, 31, 3, 5, 0, 5, 0, 0, 0, 23,
|
260
|
+
61, 25, 1, 0, 52, 49, 55
|
261
|
+
};
|
262
|
+
}
|
263
|
+
|
264
|
+
private static final byte _parser_trans_actions[] = init__parser_trans_actions_0();
|
265
|
+
|
266
|
+
|
267
|
+
private static byte[] init__parser_to_state_actions_0()
|
268
|
+
{
|
269
|
+
return new byte [] {
|
270
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
271
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
272
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
273
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
274
|
+
19, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
275
|
+
};
|
276
|
+
}
|
277
|
+
|
278
|
+
private static final byte _parser_to_state_actions[] = init__parser_to_state_actions_0();
|
279
|
+
|
280
|
+
|
281
|
+
private static byte[] init__parser_from_state_actions_0()
|
282
|
+
{
|
283
|
+
return new byte [] {
|
284
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
285
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
286
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
287
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
288
|
+
0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
289
|
+
};
|
290
|
+
}
|
291
|
+
|
292
|
+
private static final byte _parser_from_state_actions[] = init__parser_from_state_actions_0();
|
293
|
+
|
294
|
+
|
295
|
+
private static short[] init__parser_eof_trans_0()
|
296
|
+
{
|
297
|
+
return new short [] {
|
298
|
+
0, 1, 1, 1, 1, 13, 13, 13, 13, 13, 13, 13,
|
299
|
+
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
300
|
+
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
301
|
+
13, 13, 13, 13, 13, 13, 13, 1, 1, 1, 1, 1,
|
302
|
+
0, 0, 122, 125, 126, 125, 126, 125, 126, 125, 126, 127
|
303
|
+
};
|
304
|
+
}
|
305
|
+
|
306
|
+
private static final short _parser_eof_trans[] = init__parser_eof_trans_0();
|
307
|
+
|
308
|
+
|
309
|
+
static final int parser_start = 49;
|
310
|
+
static final int parser_first_final = 49;
|
311
|
+
static final int parser_error = 0;
|
312
|
+
|
313
|
+
static final int parser_en_Closeout = 48;
|
314
|
+
static final int parser_en_main = 49;
|
315
|
+
|
316
|
+
|
317
|
+
// line 143 "JavaScanner.rl"
|
318
|
+
|
319
|
+
public RubyArray operate(String tag_prefix, String input) {
|
320
|
+
char[] data = input.toCharArray();
|
321
|
+
String disposable_string;
|
322
|
+
|
323
|
+
String name = "";
|
324
|
+
String prefix = "";
|
325
|
+
RubySymbol flavor = RubySymbol.newSymbol(runtime, "tasteless".intern());
|
326
|
+
RubyHash attributes = RubyHash.newHash(runtime);
|
327
|
+
|
328
|
+
int tagstart = 0;
|
329
|
+
int mark_pfx = 0;
|
330
|
+
int mark_stg = 0;
|
331
|
+
int mark_attr = 0;
|
332
|
+
int mark_nat = 0;
|
333
|
+
int mark_vat = 0;
|
334
|
+
|
335
|
+
String nat = "";
|
336
|
+
String vat = "";
|
337
|
+
|
338
|
+
int cs;
|
339
|
+
int p = 0;
|
340
|
+
int pe = data.length;
|
341
|
+
int eof = pe;
|
342
|
+
int act;
|
343
|
+
int ts;
|
344
|
+
int te;
|
345
|
+
|
346
|
+
rv = RubyArray.newArray(runtime);
|
347
|
+
char[] remainder = data;
|
348
|
+
|
349
|
+
|
350
|
+
// line 351 "JavaScanner.java"
|
351
|
+
{
|
352
|
+
cs = parser_start;
|
353
|
+
ts = -1;
|
354
|
+
te = -1;
|
355
|
+
act = 0;
|
356
|
+
}
|
357
|
+
|
358
|
+
// line 175 "JavaScanner.rl"
|
359
|
+
|
360
|
+
// line 361 "JavaScanner.java"
|
361
|
+
{
|
362
|
+
int _klen;
|
363
|
+
int _trans = 0;
|
364
|
+
int _acts;
|
365
|
+
int _nacts;
|
366
|
+
int _keys;
|
367
|
+
int _goto_targ = 0;
|
368
|
+
|
369
|
+
_goto: while (true) {
|
370
|
+
switch ( _goto_targ ) {
|
371
|
+
case 0:
|
372
|
+
if ( p == pe ) {
|
373
|
+
_goto_targ = 4;
|
374
|
+
continue _goto;
|
375
|
+
}
|
376
|
+
if ( cs == 0 ) {
|
377
|
+
_goto_targ = 5;
|
378
|
+
continue _goto;
|
379
|
+
}
|
380
|
+
case 1:
|
381
|
+
_acts = _parser_from_state_actions[cs];
|
382
|
+
_nacts = (int) _parser_actions[_acts++];
|
383
|
+
while ( _nacts-- > 0 ) {
|
384
|
+
switch ( _parser_actions[_acts++] ) {
|
385
|
+
case 15:
|
386
|
+
// line 1 "NONE"
|
387
|
+
{ts = p;}
|
388
|
+
break;
|
389
|
+
// line 390 "JavaScanner.java"
|
390
|
+
}
|
391
|
+
}
|
392
|
+
|
393
|
+
_match: do {
|
394
|
+
_keys = _parser_key_offsets[cs];
|
395
|
+
_trans = _parser_index_offsets[cs];
|
396
|
+
_klen = _parser_single_lengths[cs];
|
397
|
+
if ( _klen > 0 ) {
|
398
|
+
int _lower = _keys;
|
399
|
+
int _mid;
|
400
|
+
int _upper = _keys + _klen - 1;
|
401
|
+
while (true) {
|
402
|
+
if ( _upper < _lower )
|
403
|
+
break;
|
404
|
+
|
405
|
+
_mid = _lower + ((_upper-_lower) >> 1);
|
406
|
+
if ( data[p] < _parser_trans_keys[_mid] )
|
407
|
+
_upper = _mid - 1;
|
408
|
+
else if ( data[p] > _parser_trans_keys[_mid] )
|
409
|
+
_lower = _mid + 1;
|
410
|
+
else {
|
411
|
+
_trans += (_mid - _keys);
|
412
|
+
break _match;
|
413
|
+
}
|
414
|
+
}
|
415
|
+
_keys += _klen;
|
416
|
+
_trans += _klen;
|
417
|
+
}
|
418
|
+
|
419
|
+
_klen = _parser_range_lengths[cs];
|
420
|
+
if ( _klen > 0 ) {
|
421
|
+
int _lower = _keys;
|
422
|
+
int _mid;
|
423
|
+
int _upper = _keys + (_klen<<1) - 2;
|
424
|
+
while (true) {
|
425
|
+
if ( _upper < _lower )
|
426
|
+
break;
|
427
|
+
|
428
|
+
_mid = _lower + (((_upper-_lower) >> 1) & ~1);
|
429
|
+
if ( data[p] < _parser_trans_keys[_mid] )
|
430
|
+
_upper = _mid - 2;
|
431
|
+
else if ( data[p] > _parser_trans_keys[_mid+1] )
|
432
|
+
_lower = _mid + 2;
|
433
|
+
else {
|
434
|
+
_trans += ((_mid - _keys)>>1);
|
435
|
+
break _match;
|
436
|
+
}
|
437
|
+
}
|
438
|
+
_trans += _klen;
|
439
|
+
}
|
440
|
+
} while (false);
|
441
|
+
|
442
|
+
_trans = _parser_indicies[_trans];
|
443
|
+
case 3:
|
444
|
+
cs = _parser_trans_targs[_trans];
|
445
|
+
|
446
|
+
if ( _parser_trans_actions[_trans] != 0 ) {
|
447
|
+
_acts = _parser_trans_actions[_trans];
|
448
|
+
_nacts = (int) _parser_actions[_acts++];
|
449
|
+
while ( _nacts-- > 0 )
|
450
|
+
{
|
451
|
+
switch ( _parser_actions[_acts++] )
|
452
|
+
{
|
453
|
+
case 0:
|
454
|
+
// line 4 "JavaScanner.rl"
|
455
|
+
{ mark_pfx = p; }
|
456
|
+
break;
|
457
|
+
case 1:
|
458
|
+
// line 5 "JavaScanner.rl"
|
459
|
+
{
|
460
|
+
prefix = input.substring(mark_pfx, p);
|
461
|
+
}
|
462
|
+
break;
|
463
|
+
case 2:
|
464
|
+
// line 8 "JavaScanner.rl"
|
465
|
+
{
|
466
|
+
if ( !prefix.equals(tag_prefix) ) {
|
467
|
+
// have to manually add ':' / Sep
|
468
|
+
// pass the text through & reset state
|
469
|
+
pass_through(input.substring(tagstart, p) + ":");
|
470
|
+
prefix = "";
|
471
|
+
{cs = 49; _goto_targ = 2; if (true) continue _goto;}
|
472
|
+
}
|
473
|
+
}
|
474
|
+
break;
|
475
|
+
case 3:
|
476
|
+
// line 18 "JavaScanner.rl"
|
477
|
+
{ mark_stg = p; }
|
478
|
+
break;
|
479
|
+
case 4:
|
480
|
+
// line 19 "JavaScanner.rl"
|
481
|
+
{ name = input.substring(mark_stg, p); }
|
482
|
+
break;
|
483
|
+
case 5:
|
484
|
+
// line 20 "JavaScanner.rl"
|
485
|
+
{ mark_attr = p; }
|
486
|
+
break;
|
487
|
+
case 6:
|
488
|
+
// line 21 "JavaScanner.rl"
|
489
|
+
{
|
490
|
+
attributes.op_aset(
|
491
|
+
runtime.getCurrentContext(),
|
492
|
+
RubyString.newString(runtime, nat),
|
493
|
+
RubyString.newString(runtime, vat)
|
494
|
+
);
|
495
|
+
}
|
496
|
+
break;
|
497
|
+
case 7:
|
498
|
+
// line 29 "JavaScanner.rl"
|
499
|
+
{ mark_nat = p; }
|
500
|
+
break;
|
501
|
+
case 8:
|
502
|
+
// line 30 "JavaScanner.rl"
|
503
|
+
{ nat = input.substring(mark_nat, p); }
|
504
|
+
break;
|
505
|
+
case 9:
|
506
|
+
// line 31 "JavaScanner.rl"
|
507
|
+
{ mark_vat = p; }
|
508
|
+
break;
|
509
|
+
case 10:
|
510
|
+
// line 32 "JavaScanner.rl"
|
511
|
+
{ vat = input.substring(mark_vat, p); }
|
512
|
+
break;
|
513
|
+
case 11:
|
514
|
+
// line 34 "JavaScanner.rl"
|
515
|
+
{ flavor = RubySymbol.newSymbol(runtime, "open".intern()); }
|
516
|
+
break;
|
517
|
+
case 12:
|
518
|
+
// line 35 "JavaScanner.rl"
|
519
|
+
{ flavor = RubySymbol.newSymbol(runtime, "self".intern()); }
|
520
|
+
break;
|
521
|
+
case 13:
|
522
|
+
// line 36 "JavaScanner.rl"
|
523
|
+
{ flavor = RubySymbol.newSymbol(runtime, "close".intern()); }
|
524
|
+
break;
|
525
|
+
case 16:
|
526
|
+
// line 1 "NONE"
|
527
|
+
{te = p+1;}
|
528
|
+
break;
|
529
|
+
case 17:
|
530
|
+
// line 72 "JavaScanner.rl"
|
531
|
+
{act = 1;}
|
532
|
+
break;
|
533
|
+
case 18:
|
534
|
+
// line 79 "JavaScanner.rl"
|
535
|
+
{act = 2;}
|
536
|
+
break;
|
537
|
+
case 19:
|
538
|
+
// line 79 "JavaScanner.rl"
|
539
|
+
{te = p+1;{
|
540
|
+
pass_through(input.substring(p, p + 1));
|
541
|
+
tagstart = p + 1;
|
542
|
+
}}
|
543
|
+
break;
|
544
|
+
case 20:
|
545
|
+
// line 72 "JavaScanner.rl"
|
546
|
+
{te = p;p--;{
|
547
|
+
tag(prefix, name, attributes, flavor);
|
548
|
+
prefix = "";
|
549
|
+
name = "";
|
550
|
+
attributes = RubyHash.newHash(runtime);
|
551
|
+
flavor = RubySymbol.newSymbol(runtime, "tasteless".intern());
|
552
|
+
}}
|
553
|
+
break;
|
554
|
+
case 21:
|
555
|
+
// line 79 "JavaScanner.rl"
|
556
|
+
{te = p;p--;{
|
557
|
+
pass_through(input.substring(p, p + 1));
|
558
|
+
tagstart = p + 1;
|
559
|
+
}}
|
560
|
+
break;
|
561
|
+
case 22:
|
562
|
+
// line 79 "JavaScanner.rl"
|
563
|
+
{{p = ((te))-1;}{
|
564
|
+
pass_through(input.substring(p, p + 1));
|
565
|
+
tagstart = p + 1;
|
566
|
+
}}
|
567
|
+
break;
|
568
|
+
case 23:
|
569
|
+
// line 1 "NONE"
|
570
|
+
{ switch( act ) {
|
571
|
+
case 1:
|
572
|
+
{{p = ((te))-1;}
|
573
|
+
tag(prefix, name, attributes, flavor);
|
574
|
+
prefix = "";
|
575
|
+
name = "";
|
576
|
+
attributes = RubyHash.newHash(runtime);
|
577
|
+
flavor = RubySymbol.newSymbol(runtime, "tasteless".intern());
|
578
|
+
}
|
579
|
+
break;
|
580
|
+
case 2:
|
581
|
+
{{p = ((te))-1;}
|
582
|
+
pass_through(input.substring(p, p + 1));
|
583
|
+
tagstart = p + 1;
|
584
|
+
}
|
585
|
+
break;
|
586
|
+
}
|
587
|
+
}
|
588
|
+
break;
|
589
|
+
// line 590 "JavaScanner.java"
|
590
|
+
}
|
591
|
+
}
|
592
|
+
}
|
593
|
+
|
594
|
+
case 2:
|
595
|
+
_acts = _parser_to_state_actions[cs];
|
596
|
+
_nacts = (int) _parser_actions[_acts++];
|
597
|
+
while ( _nacts-- > 0 ) {
|
598
|
+
switch ( _parser_actions[_acts++] ) {
|
599
|
+
case 14:
|
600
|
+
// line 1 "NONE"
|
601
|
+
{ts = -1;}
|
602
|
+
break;
|
603
|
+
// line 604 "JavaScanner.java"
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
if ( cs == 0 ) {
|
608
|
+
_goto_targ = 5;
|
609
|
+
continue _goto;
|
610
|
+
}
|
611
|
+
if ( ++p != pe ) {
|
612
|
+
_goto_targ = 1;
|
613
|
+
continue _goto;
|
614
|
+
}
|
615
|
+
case 4:
|
616
|
+
if ( p == eof )
|
617
|
+
{
|
618
|
+
if ( _parser_eof_trans[cs] > 0 ) {
|
619
|
+
_trans = _parser_eof_trans[cs] - 1;
|
620
|
+
_goto_targ = 3;
|
621
|
+
continue _goto;
|
622
|
+
}
|
623
|
+
}
|
624
|
+
|
625
|
+
case 5:
|
626
|
+
}
|
627
|
+
break; }
|
628
|
+
}
|
629
|
+
|
630
|
+
// line 176 "JavaScanner.rl"
|
631
|
+
|
632
|
+
return rv;
|
633
|
+
}
|
634
|
+
}
|