radius 0.7.0.prerelease2 → 0.7.0.prerelease3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/radius/parser/scanner.rb +45 -1183
- data/lib/radius/parser/squiggle_scanner.rb +8 -1178
- data/lib/radius/version.rb +2 -1
- data/radius.gemspec +1 -2
- data/radius.gemspec.orig +40 -0
- metadata +113 -96
- data/lib/radius/parser/scanner.rl +0 -125
- data/lib/radius/parser/squiggle_scanner.rl +0 -126
data/lib/radius/version.rb
CHANGED
data/radius.gemspec
CHANGED
data/radius.gemspec.orig
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
require 'radius/version'
|
6
|
+
|
7
|
+
<<<<<<< Updated upstream
|
8
|
+
require File.join(File.dirname(__FILE__), 'lib', 'radius', 'version')
|
9
|
+
=======
|
10
|
+
>>>>>>> Stashed changes
|
11
|
+
Gem::Specification.new do |s|
|
12
|
+
s.name = %q{radius}
|
13
|
+
s.version = Radius::VERSION
|
14
|
+
|
15
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
16
|
+
s.authors = [%q{John W. Long (me@johnwlong.com)}, %q{David Chelimsky (dchelimsky@gmail.com)}, %q{Bryce Kerley (bkerley@brycekerley.net)}]
|
17
|
+
s.description = %q{Radius is a powerful tag-based template language for Ruby inspired by the template languages used in MovableType and TextPattern. It uses tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc...).}
|
18
|
+
s.email = %q{me@johnwlong.com}
|
19
|
+
s.extra_rdoc_files = [
|
20
|
+
"CHANGELOG",
|
21
|
+
"LICENSE",
|
22
|
+
"QUICKSTART.rdoc",
|
23
|
+
"README.rdoc"
|
24
|
+
]
|
25
|
+
|
26
|
+
ignores = File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
|
27
|
+
s.files = Dir['**/*','.gitignore'] - ignores
|
28
|
+
|
29
|
+
s.homepage = %q{http://github.com/jlong/radius}
|
30
|
+
s.summary = %q{A tag-based templating language for Ruby.}
|
31
|
+
|
32
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
33
|
+
s.add_development_dependency(%q<RedCloth>, [">= 0"])
|
34
|
+
s.add_development_dependency('rake', ['~> 0.9.2'])
|
35
|
+
else
|
36
|
+
s.add_dependency(%q<RedCloth>, [">= 0"])
|
37
|
+
s.add_dependency('rake', ['~> 0.9.2'])
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
metadata
CHANGED
@@ -1,31 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radius
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 2185222979
|
4
5
|
prerelease: 6
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
- prerelease
|
11
|
+
- 3
|
12
|
+
version: 0.7.0.prerelease3
|
6
13
|
platform: ruby
|
7
14
|
authors:
|
8
|
-
|
9
|
-
|
10
|
-
|
15
|
+
- John W. Long (me@johnwlong.com)
|
16
|
+
- David Chelimsky (dchelimsky@gmail.com)
|
17
|
+
- Bryce Kerley (bkerley@brycekerley.net)
|
11
18
|
autorequire:
|
12
19
|
bindir: bin
|
13
20
|
cert_chain: []
|
14
21
|
|
15
|
-
date: 2011-
|
22
|
+
date: 2011-08-03 00:00:00 -04:00
|
16
23
|
default_executable:
|
17
24
|
dependencies:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: RedCloth
|
27
|
+
prerelease: false
|
28
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
hash: 3
|
34
|
+
segments:
|
35
|
+
- 0
|
36
|
+
version: "0"
|
37
|
+
type: :development
|
38
|
+
version_requirements: *id001
|
29
39
|
description: Radius is a powerful tag-based template language for Ruby inspired by the template languages used in MovableType and TextPattern. It uses tags similar to XML, but can be used to generate any form of plain text (HTML, e-mail, etc...).
|
30
40
|
email: me@johnwlong.com
|
31
41
|
executables: []
|
@@ -33,79 +43,78 @@ executables: []
|
|
33
43
|
extensions: []
|
34
44
|
|
35
45
|
extra_rdoc_files:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
46
|
+
- CHANGELOG
|
47
|
+
- LICENSE
|
48
|
+
- QUICKSTART.rdoc
|
49
|
+
- README.rdoc
|
40
50
|
files:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
- .gitignore
|
51
|
+
- CHANGELOG
|
52
|
+
- Gemfile
|
53
|
+
- lib/radius/context.rb
|
54
|
+
- lib/radius/context.rbc
|
55
|
+
- lib/radius/delegating_open_struct.rb
|
56
|
+
- lib/radius/delegating_open_struct.rbc
|
57
|
+
- lib/radius/error.rb
|
58
|
+
- lib/radius/error.rbc
|
59
|
+
- lib/radius/ord_string.rb
|
60
|
+
- lib/radius/ord_string.rbc
|
61
|
+
- lib/radius/parse_tag.rb
|
62
|
+
- lib/radius/parse_tag.rbc
|
63
|
+
- lib/radius/parser/java_scanner.jar
|
64
|
+
- lib/radius/parser/JavaScanner$Flavor.class
|
65
|
+
- lib/radius/parser/JavaScanner$Tag.class
|
66
|
+
- lib/radius/parser/JavaScanner.class
|
67
|
+
- lib/radius/parser/JavaScanner.java
|
68
|
+
- lib/radius/parser/JavaScanner.rl
|
69
|
+
- lib/radius/parser/scanner.rb
|
70
|
+
- lib/radius/parser/scanner.rbc
|
71
|
+
- lib/radius/parser/squiggle_scanner.rb
|
72
|
+
- lib/radius/parser/squiggle_scanner.rbc
|
73
|
+
- lib/radius/parser.rb
|
74
|
+
- lib/radius/parser.rbc
|
75
|
+
- lib/radius/tag_binding.rb
|
76
|
+
- lib/radius/tag_binding.rbc
|
77
|
+
- lib/radius/tag_definitions.rb
|
78
|
+
- lib/radius/tag_definitions.rbc
|
79
|
+
- lib/radius/utility.rb
|
80
|
+
- lib/radius/utility.rbc
|
81
|
+
- lib/radius/version.rb
|
82
|
+
- lib/radius/version.rbc
|
83
|
+
- lib/radius.rb
|
84
|
+
- lib/radius.rbc
|
85
|
+
- LICENSE
|
86
|
+
- pkg/radius-0.7.0.prerelease.gem
|
87
|
+
- QUICKSTART.rdoc
|
88
|
+
- radius.gemspec
|
89
|
+
- radius.gemspec.orig
|
90
|
+
- Rakefile
|
91
|
+
- README.rdoc
|
92
|
+
- tasks/rdoc.rake
|
93
|
+
- tasks/rdoc.rake.compiled.rbc
|
94
|
+
- tasks/rubinius.rake
|
95
|
+
- tasks/rubinius.rake.compiled.rbc
|
96
|
+
- tasks/scan.rake
|
97
|
+
- tasks/scan.rake.compiled.rbc
|
98
|
+
- tasks/test.rake
|
99
|
+
- tasks/test.rake.compiled.rbc
|
100
|
+
- test/benchmarks.rb
|
101
|
+
- test/context_test.rb
|
102
|
+
- test/context_test.rbc
|
103
|
+
- test/multithreaded_test.rb
|
104
|
+
- test/multithreaded_test.rbc
|
105
|
+
- test/ord_string_test.rb
|
106
|
+
- test/ord_string_test.rbc
|
107
|
+
- test/parser_test.rb
|
108
|
+
- test/parser_test.rbc
|
109
|
+
- test/quickstart_test.rb
|
110
|
+
- test/quickstart_test.rbc
|
111
|
+
- test/squiggle_test.rb
|
112
|
+
- test/squiggle_test.rbc
|
113
|
+
- test/test_helper.rb
|
114
|
+
- test/test_helper.rbc
|
115
|
+
- test/utility_test.rb
|
116
|
+
- test/utility_test.rbc
|
117
|
+
- .gitignore
|
109
118
|
has_rdoc: true
|
110
119
|
homepage: http://github.com/jlong/radius
|
111
120
|
licenses: []
|
@@ -114,23 +123,31 @@ post_install_message:
|
|
114
123
|
rdoc_options: []
|
115
124
|
|
116
125
|
require_paths:
|
117
|
-
|
126
|
+
- lib
|
118
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
128
|
none: false
|
120
129
|
requirements:
|
121
|
-
|
122
|
-
|
123
|
-
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
124
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
137
|
none: false
|
126
138
|
requirements:
|
127
|
-
|
128
|
-
|
129
|
-
|
139
|
+
- - ">"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 25
|
142
|
+
segments:
|
143
|
+
- 1
|
144
|
+
- 3
|
145
|
+
- 1
|
146
|
+
version: 1.3.1
|
130
147
|
requirements: []
|
131
148
|
|
132
149
|
rubyforge_project:
|
133
|
-
rubygems_version: 1.
|
150
|
+
rubygems_version: 1.6.2
|
134
151
|
signing_key:
|
135
152
|
specification_version: 3
|
136
153
|
summary: A tag-based templating language for Ruby.
|
@@ -1,125 +0,0 @@
|
|
1
|
-
%%{
|
2
|
-
machine parser;
|
3
|
-
|
4
|
-
|
5
|
-
action _prefix { mark_pfx = p }
|
6
|
-
action prefix {
|
7
|
-
if data[mark_pfx..p-1] != @prefix
|
8
|
-
closing = data[mark_pfx-1,1] == '/'
|
9
|
-
@nodes.last << data[mark_pfx-(closing ? 2 : 1)..p]
|
10
|
-
fbreak;
|
11
|
-
end
|
12
|
-
}
|
13
|
-
action _starttag { mark_stg = p }
|
14
|
-
action starttag { @starttag = data[mark_stg..p-1] }
|
15
|
-
action _attr { mark_attr = p }
|
16
|
-
action attr {
|
17
|
-
@attrs[@nat] = @vat
|
18
|
-
}
|
19
|
-
|
20
|
-
action prematch {
|
21
|
-
@prematch_end = p
|
22
|
-
@prematch = data[0..p] if p > 0
|
23
|
-
}
|
24
|
-
|
25
|
-
action _nameattr { mark_nat = p }
|
26
|
-
action nameattr { @nat = data[mark_nat..p-1] }
|
27
|
-
action _valattr { mark_vat = p }
|
28
|
-
action valattr { @vat = data[mark_vat..p-1] }
|
29
|
-
|
30
|
-
action opentag { @flavor = :open }
|
31
|
-
action selftag { @flavor = :self }
|
32
|
-
action closetag { @flavor = :close }
|
33
|
-
|
34
|
-
action stopparse {
|
35
|
-
@cursor = p;
|
36
|
-
fbreak;
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
Closeout := empty;
|
41
|
-
|
42
|
-
# words
|
43
|
-
PrefixChar = [\-A-Za-z0-9._?] ;
|
44
|
-
NameChar = [\-A-Za-z0-9._:?] ;
|
45
|
-
TagName = NameChar+ >_starttag %starttag;
|
46
|
-
Prefix = PrefixChar+ >_prefix %prefix;
|
47
|
-
|
48
|
-
Name = Prefix ":" TagName;
|
49
|
-
|
50
|
-
NameAttr = NameChar+ >_nameattr %nameattr;
|
51
|
-
Q1Char = ( "\\\'" | [^'] ) ;
|
52
|
-
Q1Attr = Q1Char* >_valattr %valattr;
|
53
|
-
Q2Char = ( "\\\"" | [^"] ) ;
|
54
|
-
Q2Attr = Q2Char* >_valattr %valattr;
|
55
|
-
|
56
|
-
Attr = NameAttr space* "=" space* ('"' Q2Attr '"' | "'" Q1Attr "'") space* >_attr %attr;
|
57
|
-
Attrs = (space+ Attr* | empty);
|
58
|
-
|
59
|
-
CloseTrailer = "/>" %selftag;
|
60
|
-
OpenTrailer = ">" %opentag;
|
61
|
-
|
62
|
-
Trailer = (OpenTrailer | CloseTrailer);
|
63
|
-
|
64
|
-
OpenOrSelfTag = Name Attrs? Trailer;
|
65
|
-
CloseTag = "/" Name space* ">" %closetag;
|
66
|
-
|
67
|
-
SomeTag = '<' (OpenOrSelfTag | CloseTag);
|
68
|
-
|
69
|
-
main := |*
|
70
|
-
SomeTag => {
|
71
|
-
tag = {:prefix=>@prefix, :name=>@starttag, :flavor => @flavor, :attrs => @attrs}
|
72
|
-
@prefix = nil
|
73
|
-
@name = nil
|
74
|
-
@flavor = :tasteless
|
75
|
-
@attrs = {}
|
76
|
-
@nodes << tag << ''
|
77
|
-
fbreak;
|
78
|
-
};
|
79
|
-
any => {
|
80
|
-
@nodes.last << data[p]
|
81
|
-
@tagstart = p
|
82
|
-
};
|
83
|
-
*|;
|
84
|
-
}%%
|
85
|
-
|
86
|
-
module Radius
|
87
|
-
class Scanner
|
88
|
-
def operate(prefix, data)
|
89
|
-
data = Radius::OrdString.new data
|
90
|
-
buf = ""
|
91
|
-
csel = ""
|
92
|
-
@prematch = ''
|
93
|
-
@starttag = nil
|
94
|
-
@attrs = {}
|
95
|
-
@flavor = :tasteless
|
96
|
-
@cursor = 0
|
97
|
-
@tagstart = 0
|
98
|
-
@nodes = ['']
|
99
|
-
remainder = data.dup
|
100
|
-
|
101
|
-
until remainder.length == 0
|
102
|
-
p = perform_parse(prefix, remainder)
|
103
|
-
remainder = remainder[p..-1]
|
104
|
-
end
|
105
|
-
|
106
|
-
return @nodes
|
107
|
-
end
|
108
|
-
|
109
|
-
private
|
110
|
-
def perform_parse(prefix, data)
|
111
|
-
stack = []
|
112
|
-
p = 0
|
113
|
-
ts = 0
|
114
|
-
te = 0
|
115
|
-
act = 0
|
116
|
-
eof = data.length
|
117
|
-
|
118
|
-
@prefix = prefix
|
119
|
-
%% write data;
|
120
|
-
%% write init;
|
121
|
-
%% write exec;
|
122
|
-
return p
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
%%{
|
2
|
-
machine parser;
|
3
|
-
|
4
|
-
|
5
|
-
# action _prefix { mark_pfx = p }
|
6
|
-
# action prefix {
|
7
|
-
# if data[mark_pfx..p-1] != @prefix
|
8
|
-
# @nodes.last << data[mark_pfx-1..p]
|
9
|
-
# fbreak;
|
10
|
-
# end
|
11
|
-
# }
|
12
|
-
action _starttag { mark_stg = p }
|
13
|
-
action starttag { @starttag = data[mark_stg..p-1] }
|
14
|
-
action _attr { mark_attr = p }
|
15
|
-
action attr {
|
16
|
-
@attrs[@nat] = @vat
|
17
|
-
}
|
18
|
-
|
19
|
-
action prematch {
|
20
|
-
@prematch_end = p
|
21
|
-
@prematch = data[0..p] if p > 0
|
22
|
-
}
|
23
|
-
|
24
|
-
action _nameattr { mark_nat = p }
|
25
|
-
action nameattr { @nat = data[mark_nat..p-1] }
|
26
|
-
action _valattr { mark_vat = p }
|
27
|
-
action valattr { @vat = data[mark_vat..p-1] }
|
28
|
-
|
29
|
-
action opentag { @flavor = :open }
|
30
|
-
action selftag { @flavor = :self }
|
31
|
-
action closetag { @flavor = :close }
|
32
|
-
|
33
|
-
action stopparse {
|
34
|
-
@cursor = p;
|
35
|
-
fbreak;
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
Closeout := empty;
|
40
|
-
|
41
|
-
# words
|
42
|
-
# PrefixChar = [\-A-Za-z0-9._?] ;
|
43
|
-
NameChar = [\-A-Za-z0-9._:?] ;
|
44
|
-
TagName = NameChar+ >_starttag %starttag;
|
45
|
-
# Prefix = PrefixChar+ >_prefix %prefix;
|
46
|
-
|
47
|
-
# Name = Prefix ":" TagName;
|
48
|
-
|
49
|
-
NameAttr = NameChar+ >_nameattr %nameattr;
|
50
|
-
Q1Char = ( "\\\'" | [^'] ) ;
|
51
|
-
Q1Attr = Q1Char* >_valattr %valattr;
|
52
|
-
Q2Char = ( "\\\"" | [^"] ) ;
|
53
|
-
Q2Attr = Q2Char* >_valattr %valattr;
|
54
|
-
|
55
|
-
Attr = NameAttr space* "=" space* ('"' Q2Attr '"' | "'" Q1Attr "'") space* >_attr %attr;
|
56
|
-
Attrs = (space+ Attr* | empty);
|
57
|
-
|
58
|
-
CloseTrailer = "/}" %selftag;
|
59
|
-
OpenTrailer = "}" %opentag;
|
60
|
-
|
61
|
-
Trailer = (OpenTrailer | CloseTrailer);
|
62
|
-
|
63
|
-
# OpenOrSelfTag = Name Attrs? Trailer;
|
64
|
-
OpenOrSelfTag = TagName Attrs? Trailer;
|
65
|
-
# CloseTag = "/" Name space* "}" %closetag;
|
66
|
-
CloseTag = "/" TagName space* "}" %closetag;
|
67
|
-
|
68
|
-
SomeTag = '{' space* (OpenOrSelfTag | CloseTag);
|
69
|
-
|
70
|
-
main := |*
|
71
|
-
SomeTag => {
|
72
|
-
tag = {:prefix=>@prefix, :name=>@starttag, :flavor => @flavor, :attrs => @attrs}
|
73
|
-
@prefix = nil
|
74
|
-
@name = nil
|
75
|
-
@flavor = :tasteless
|
76
|
-
@attrs = {}
|
77
|
-
@nodes << tag << ''
|
78
|
-
fbreak;
|
79
|
-
};
|
80
|
-
any => {
|
81
|
-
@nodes.last << data[p]
|
82
|
-
@tagstart = p
|
83
|
-
};
|
84
|
-
*|;
|
85
|
-
}%%
|
86
|
-
|
87
|
-
module Radius
|
88
|
-
class SquiggleScanner
|
89
|
-
def operate(prefix, data)
|
90
|
-
data = Radius::OrdString.new data
|
91
|
-
buf = ""
|
92
|
-
csel = ""
|
93
|
-
@prematch = ''
|
94
|
-
@starttag = nil
|
95
|
-
@attrs = {}
|
96
|
-
@flavor = :tasteless
|
97
|
-
@cursor = 0
|
98
|
-
@tagstart = 0
|
99
|
-
@nodes = ['']
|
100
|
-
remainder = data.dup
|
101
|
-
|
102
|
-
until remainder.length == 0
|
103
|
-
p = perform_parse(prefix, remainder)
|
104
|
-
remainder = remainder[p..-1]
|
105
|
-
end
|
106
|
-
|
107
|
-
return @nodes
|
108
|
-
end
|
109
|
-
|
110
|
-
private
|
111
|
-
def perform_parse(prefix, data)
|
112
|
-
stack = []
|
113
|
-
p = 0
|
114
|
-
ts = 0
|
115
|
-
te = 0
|
116
|
-
act = 0
|
117
|
-
eof = data.length
|
118
|
-
|
119
|
-
@prefix = prefix
|
120
|
-
%% write data;
|
121
|
-
%% write init;
|
122
|
-
%% write exec;
|
123
|
-
return p
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|