luoma 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/.rdoc_options +16 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +68 -0
- data/Rakefile +69 -0
- data/Steepfile +41 -0
- data/certs/jgrp.pem +27 -0
- data/docs/configuration.md +180 -0
- data/docs/custom_filters.md +3 -0
- data/docs/custom_tags.md +3 -0
- data/docs/expressions.md +3 -0
- data/docs/extension_types.md +41 -0
- data/docs/filter_reference.md +1702 -0
- data/docs/index.md +73 -0
- data/docs/luoma_for_template_authors.md +3 -0
- data/docs/markdown.md +111 -0
- data/docs/predicate_reference.md +3 -0
- data/docs/static_analysis.md +3 -0
- data/docs/tag_reference.md +352 -0
- data/docs/template_loaders.md +177 -0
- data/docs/undefined_variables.md +3 -0
- data/docs-requirements.txt +11 -0
- data/docs_/cycle.md +17 -0
- data/docs_/font_rendering_example.md +157 -0
- data/docs_/header_block_example.md +51 -0
- data/docs_/increment_and_decrement.md +49 -0
- data/docs_/logo_style_example.md +40 -0
- data/docs_/migration.md +11 -0
- data/docs_/notes.md +19 -0
- data/lib/luoma/cache.rb +80 -0
- data/lib/luoma/chain_hash.rb +54 -0
- data/lib/luoma/context.rb +227 -0
- data/lib/luoma/drop.rb +84 -0
- data/lib/luoma/drops/block.rb +33 -0
- data/lib/luoma/drops/expression.rb +29 -0
- data/lib/luoma/drops/html_safe.rb +36 -0
- data/lib/luoma/drops/range.rb +69 -0
- data/lib/luoma/drops/undefined.rb +119 -0
- data/lib/luoma/environment.rb +479 -0
- data/lib/luoma/errors.rb +79 -0
- data/lib/luoma/escape.rb +35 -0
- data/lib/luoma/expression.rb +1271 -0
- data/lib/luoma/filter.rb +97 -0
- data/lib/luoma/filters/array.rb +372 -0
- data/lib/luoma/filters/date.rb +19 -0
- data/lib/luoma/filters/default.rb +16 -0
- data/lib/luoma/filters/json.rb +14 -0
- data/lib/luoma/filters/math.rb +84 -0
- data/lib/luoma/filters/size.rb +13 -0
- data/lib/luoma/filters/slice.rb +52 -0
- data/lib/luoma/filters/sort.rb +113 -0
- data/lib/luoma/filters/string.rb +186 -0
- data/lib/luoma/fnv.rb +15 -0
- data/lib/luoma/lexer.rb +106 -0
- data/lib/luoma/lexer_legacy.rb +396 -0
- data/lib/luoma/lexer_unified.rb +279 -0
- data/lib/luoma/loader.rb +50 -0
- data/lib/luoma/loaders/choice_loader.rb +20 -0
- data/lib/luoma/loaders/file_system_loader.rb +75 -0
- data/lib/luoma/loaders/mixins.rb +52 -0
- data/lib/luoma/markup.rb +109 -0
- data/lib/luoma/parser.rb +252 -0
- data/lib/luoma/parser_unified.rb +979 -0
- data/lib/luoma/predicates/blank.rb +19 -0
- data/lib/luoma/predicates/defined.rb +10 -0
- data/lib/luoma/predicates/empty.rb +15 -0
- data/lib/luoma/predicates/type.rb +35 -0
- data/lib/luoma/static_analysis.rb +427 -0
- data/lib/luoma/tags/assign.rb +63 -0
- data/lib/luoma/tags/break.rb +23 -0
- data/lib/luoma/tags/capture.rb +43 -0
- data/lib/luoma/tags/case.rb +137 -0
- data/lib/luoma/tags/comment.rb +17 -0
- data/lib/luoma/tags/continue.rb +23 -0
- data/lib/luoma/tags/define.rb +42 -0
- data/lib/luoma/tags/else.rb +30 -0
- data/lib/luoma/tags/for.rb +108 -0
- data/lib/luoma/tags/if.rb +109 -0
- data/lib/luoma/tags/import.rb +91 -0
- data/lib/luoma/tags/include.rb +77 -0
- data/lib/luoma/tags/output.rb +20 -0
- data/lib/luoma/tags/raw.rb +26 -0
- data/lib/luoma/tags/render.rb +92 -0
- data/lib/luoma/tags/with.rb +55 -0
- data/lib/luoma/template.rb +178 -0
- data/lib/luoma/token.rb +84 -0
- data/lib/luoma/version.rb +5 -0
- data/lib/luoma.rb +75 -0
- data/sig/luoma/cache.rbs +44 -0
- data/sig/luoma/chain_hash.rbs +26 -0
- data/sig/luoma/context.rbs +115 -0
- data/sig/luoma/drop.rbs +44 -0
- data/sig/luoma/drops/block.rbs +10 -0
- data/sig/luoma/drops/expression.rbs +10 -0
- data/sig/luoma/drops/html_safe.rbs +14 -0
- data/sig/luoma/drops/range.rbs +15 -0
- data/sig/luoma/drops/undefined.rbs +27 -0
- data/sig/luoma/environment.rbs +212 -0
- data/sig/luoma/errors.rbs +67 -0
- data/sig/luoma/escape.rbs +15 -0
- data/sig/luoma/expression.rbs +514 -0
- data/sig/luoma/filter.rbs +66 -0
- data/sig/luoma/filters/array.rbs +74 -0
- data/sig/luoma/filters/date.rbs +9 -0
- data/sig/luoma/filters/default.rbs +8 -0
- data/sig/luoma/filters/json.rbs +7 -0
- data/sig/luoma/filters/math.rbs +37 -0
- data/sig/luoma/filters/size.rbs +6 -0
- data/sig/luoma/filters/slice.rbs +10 -0
- data/sig/luoma/filters/sort.rbs +17 -0
- data/sig/luoma/filters/string.rbs +103 -0
- data/sig/luoma/fnv.rbs +3 -0
- data/sig/luoma/lexer.rbs +42 -0
- data/sig/luoma/lexer_legacy.rbs +81 -0
- data/sig/luoma/lexer_unified.rbs +49 -0
- data/sig/luoma/loader.rbs +40 -0
- data/sig/luoma/loaders/choice_loader.rbs +9 -0
- data/sig/luoma/loaders/file_system_loader.rbs +19 -0
- data/sig/luoma/loaders/mixins.rbs +16 -0
- data/sig/luoma/markup.rbs +68 -0
- data/sig/luoma/parser.rbs +105 -0
- data/sig/luoma/parser_unified.rbs +150 -0
- data/sig/luoma/predicates/blank.rbs +6 -0
- data/sig/luoma/predicates/defined.rbs +6 -0
- data/sig/luoma/predicates/empty.rbs +6 -0
- data/sig/luoma/predicates/type.rbs +21 -0
- data/sig/luoma/static_analysis.rbs +141 -0
- data/sig/luoma/tags/assign.rbs +12 -0
- data/sig/luoma/tags/break.rbs +11 -0
- data/sig/luoma/tags/capture.rbs +14 -0
- data/sig/luoma/tags/case.rbs +36 -0
- data/sig/luoma/tags/comment.rbs +11 -0
- data/sig/luoma/tags/continue.rbs +11 -0
- data/sig/luoma/tags/define.rbs +16 -0
- data/sig/luoma/tags/else.rbs +17 -0
- data/sig/luoma/tags/for.rbs +26 -0
- data/sig/luoma/tags/if.rbs +45 -0
- data/sig/luoma/tags/import.rbs +13 -0
- data/sig/luoma/tags/include.rbs +13 -0
- data/sig/luoma/tags/output.rbs +13 -0
- data/sig/luoma/tags/raw.rbs +11 -0
- data/sig/luoma/tags/render.rbs +13 -0
- data/sig/luoma/tags/with.rbs +15 -0
- data/sig/luoma/template.rbs +117 -0
- data/sig/luoma/token.rbs +81 -0
- data/sig/luoma.rbs +11 -0
- data/zensical.toml +363 -0
- data.tar.gz.sig +0 -0
- metadata +233 -0
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class UnifiedParser < Parser
|
|
3
|
+
class Precedence
|
|
4
|
+
LOWEST: Integer
|
|
5
|
+
|
|
6
|
+
COALESCE: Integer
|
|
7
|
+
|
|
8
|
+
LOGICAL_OR: Integer
|
|
9
|
+
|
|
10
|
+
LOGICAL_AND: Integer
|
|
11
|
+
|
|
12
|
+
LOGICAL_NOT: Integer
|
|
13
|
+
|
|
14
|
+
COMPARISON: Integer
|
|
15
|
+
|
|
16
|
+
MEMBERSHIP: Integer
|
|
17
|
+
|
|
18
|
+
PIPE: Integer
|
|
19
|
+
|
|
20
|
+
FILTER_ARG: Integer
|
|
21
|
+
|
|
22
|
+
ADD: Integer
|
|
23
|
+
|
|
24
|
+
MUL: Integer
|
|
25
|
+
|
|
26
|
+
NEG: Integer
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
PRECEDENCES: Hash[t_token_kind, Integer]
|
|
31
|
+
|
|
32
|
+
INFIX_OPERATORS: Hash[t_token_kind, untyped]
|
|
33
|
+
|
|
34
|
+
TERMINATE_EXPRESSION: Set[t_token_kind]
|
|
35
|
+
|
|
36
|
+
TERMINATE_FILTER: Set[t_token_kind]
|
|
37
|
+
|
|
38
|
+
PATH_PUNCTUATION: Set[t_token_kind]
|
|
39
|
+
|
|
40
|
+
STRING_LITERAL_KINDS: Set[t_token_kind]
|
|
41
|
+
|
|
42
|
+
PATH_SEGMENT_KINDS: Set[t_token_kind]
|
|
43
|
+
|
|
44
|
+
KEYWORD_ARGUMENT_DELIMITERS: Set[t_token_kind]
|
|
45
|
+
|
|
46
|
+
RE_SLASH_U: ::Regexp
|
|
47
|
+
|
|
48
|
+
RE_ESCAPE_INTERPOLATION: ::Regexp
|
|
49
|
+
|
|
50
|
+
# (?require_commas: bool?) -> Array[Expression | KeywordArgument]
|
|
51
|
+
def parse_arguments: (?require_commas: bool?) -> Array[Expression | KeywordArgument]
|
|
52
|
+
|
|
53
|
+
# (?stop: Set[String]?) -> t_block
|
|
54
|
+
def parse_block: (?stop: Set[String]?) -> t_block
|
|
55
|
+
|
|
56
|
+
# () -> Name
|
|
57
|
+
def parse_ident: () -> Name
|
|
58
|
+
|
|
59
|
+
# (?require_commas: bool?) -> Array[KeywordArgument]
|
|
60
|
+
def parse_keyword_arguments: (?require_commas: bool?) -> Array[KeywordArgument]
|
|
61
|
+
|
|
62
|
+
# Parse an identifier, possibly surrounded by quotes.
|
|
63
|
+
# () -> Name
|
|
64
|
+
def parse_name: () -> Name
|
|
65
|
+
|
|
66
|
+
# (?require_commas: bool?) -> Array[Expression]
|
|
67
|
+
def parse_positional_arguments: (?require_commas: untyped?) -> Array[Expression]
|
|
68
|
+
|
|
69
|
+
# () -> StringLiteral
|
|
70
|
+
def parse_string_literal: () -> StringLiteral
|
|
71
|
+
|
|
72
|
+
# (?precedence: Integer) -> Expression
|
|
73
|
+
def parse_primary: (?precedence: Integer) -> Expression
|
|
74
|
+
|
|
75
|
+
# (Expression) -> Expression
|
|
76
|
+
def parse_ternary: (Expression consequence) -> Expression
|
|
77
|
+
|
|
78
|
+
# () -> Expression
|
|
79
|
+
def parse_array_or_path: () -> Expression
|
|
80
|
+
|
|
81
|
+
# (t_token, Expression|Spread) -> Expression
|
|
82
|
+
def parse_partial_array: (t_token token, (Expression|Spread) first) -> Expression
|
|
83
|
+
|
|
84
|
+
# () -> ObjectLiteral
|
|
85
|
+
def parse_object_literal: () -> ObjectLiteral
|
|
86
|
+
|
|
87
|
+
# () -> Item | Spread
|
|
88
|
+
def parse_object_item: () -> (Item | Spread)
|
|
89
|
+
|
|
90
|
+
# (precedence: Integer) -> Expression
|
|
91
|
+
def parse_lambda_range_or_group: (precedence: Integer) -> Expression
|
|
92
|
+
|
|
93
|
+
# (Expression, precedence: Integer) -> Lambda
|
|
94
|
+
def parse_partial_lambda: (Expression expr, precedence: Integer) -> Expression
|
|
95
|
+
|
|
96
|
+
# () -> Expression
|
|
97
|
+
def parse_prefix: () -> Expression
|
|
98
|
+
|
|
99
|
+
# () -> Markup
|
|
100
|
+
def parse_output: () -> Markup
|
|
101
|
+
|
|
102
|
+
# () -> Markup
|
|
103
|
+
def parse_comment: () -> Markup
|
|
104
|
+
|
|
105
|
+
# () -> Markup
|
|
106
|
+
def parse_tag: () -> Markup
|
|
107
|
+
|
|
108
|
+
# () -> Variable
|
|
109
|
+
def parse_path: () -> Variable
|
|
110
|
+
|
|
111
|
+
# () -> Array[t_path_segment]
|
|
112
|
+
def parse_path_segments: () -> Array[t_path_segment]
|
|
113
|
+
|
|
114
|
+
# () -> t_path_segment
|
|
115
|
+
def parse_bracketed_segment: () -> t_path_segment
|
|
116
|
+
|
|
117
|
+
# () -> Expression
|
|
118
|
+
def parse_range_literal: () -> Expression
|
|
119
|
+
|
|
120
|
+
# () -> Expression
|
|
121
|
+
def parse_true_literal: () -> Expression
|
|
122
|
+
|
|
123
|
+
# () -> Expression
|
|
124
|
+
def parse_false_literal: () -> Expression
|
|
125
|
+
|
|
126
|
+
# () -> Expression
|
|
127
|
+
def parse_null_literal: () -> Expression
|
|
128
|
+
|
|
129
|
+
# () -> Expression
|
|
130
|
+
def parse_int_literal: () -> Expression
|
|
131
|
+
|
|
132
|
+
# () -> Expression
|
|
133
|
+
def parse_float_literal: () -> Expression
|
|
134
|
+
|
|
135
|
+
# (t_token, Expression) -> FilteredExpression
|
|
136
|
+
def parse_filter: (t_token token, Expression left) -> FilteredExpression
|
|
137
|
+
|
|
138
|
+
# (precedence: Integer) -> Lambda
|
|
139
|
+
def parse_lambda: (precedence: Integer) -> Lambda
|
|
140
|
+
|
|
141
|
+
# (Expression) -> Expression
|
|
142
|
+
def parse_infix: (Expression left) -> Expression
|
|
143
|
+
|
|
144
|
+
def unescape: (t_token token) -> String
|
|
145
|
+
|
|
146
|
+
def high_surrogate?: (Integer code_point) -> bool
|
|
147
|
+
|
|
148
|
+
def low_surrogate?: (Integer code_point) -> bool
|
|
149
|
+
end
|
|
150
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
module Predicates
|
|
3
|
+
# (RenderContext, untyped) -> bool
|
|
4
|
+
def self.null?: (RenderContext context, untyped obj) -> bool
|
|
5
|
+
|
|
6
|
+
# (RenderContext, untyped) -> bool
|
|
7
|
+
def self.string?: (RenderContext context, untyped obj) -> bool
|
|
8
|
+
|
|
9
|
+
# (RenderContext, untyped) -> bool
|
|
10
|
+
def self.number?: (RenderContext context, untyped obj) -> bool
|
|
11
|
+
|
|
12
|
+
# (RenderContext, untyped) -> bool
|
|
13
|
+
def self.array?: (RenderContext context, untyped obj) -> bool
|
|
14
|
+
|
|
15
|
+
# (RenderContext, untyped) -> bool
|
|
16
|
+
def self.object?: (RenderContext context, untyped obj) -> bool
|
|
17
|
+
|
|
18
|
+
# (RenderContext, untyped) -> bool
|
|
19
|
+
def self.numeric?: (RenderContext context, untyped obj) -> bool
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
# Template static analysis.
|
|
3
|
+
module StaticAnalysis
|
|
4
|
+
# The location of a variable, tag or filter.
|
|
5
|
+
class Location
|
|
6
|
+
@template: Luoma::Template
|
|
7
|
+
|
|
8
|
+
@token: Luoma::t_token
|
|
9
|
+
|
|
10
|
+
attr_reader template: Luoma::Template
|
|
11
|
+
|
|
12
|
+
attr_reader token: Luoma::t_token
|
|
13
|
+
|
|
14
|
+
# (Template, t_token) -> void
|
|
15
|
+
def initialize: (Luoma::Template template, Luoma::t_token token) -> void
|
|
16
|
+
|
|
17
|
+
# Return the line and column number of the given index.
|
|
18
|
+
#
|
|
19
|
+
# (Integer) -> [Integer, Integer]
|
|
20
|
+
def line_col: (Numeric index) -> [Numeric, Numeric]
|
|
21
|
+
|
|
22
|
+
def ==: (untyped other) -> bool
|
|
23
|
+
|
|
24
|
+
alias eql? ==
|
|
25
|
+
|
|
26
|
+
def hash: () -> untyped
|
|
27
|
+
|
|
28
|
+
# Return the line and column number for the start and end index spanning
|
|
29
|
+
# this location.
|
|
30
|
+
#
|
|
31
|
+
# () -> [[Integer, Integer],[Integer, Integer]]
|
|
32
|
+
def span: () -> [[Numeric, Numeric],[Numeric, Numeric]]
|
|
33
|
+
|
|
34
|
+
# Return the substring spanning this location.
|
|
35
|
+
#
|
|
36
|
+
# () -> String
|
|
37
|
+
def value: () -> String
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# A variable as a sequence of segments and its location.
|
|
41
|
+
class StaticVariable
|
|
42
|
+
@segments: untyped
|
|
43
|
+
|
|
44
|
+
@location: Location
|
|
45
|
+
|
|
46
|
+
attr_reader segments: untyped
|
|
47
|
+
|
|
48
|
+
attr_reader location: Location
|
|
49
|
+
|
|
50
|
+
RE_PROPERTY: ::Regexp
|
|
51
|
+
|
|
52
|
+
def initialize: (untyped segments, Location location) -> void
|
|
53
|
+
|
|
54
|
+
def to_s: () -> String
|
|
55
|
+
|
|
56
|
+
def ==: (untyped other) -> bool
|
|
57
|
+
|
|
58
|
+
alias eql? ==
|
|
59
|
+
|
|
60
|
+
def hash: () -> untyped
|
|
61
|
+
|
|
62
|
+
# () -> String
|
|
63
|
+
def root: () -> String
|
|
64
|
+
|
|
65
|
+
def segments_to_s: (untyped segments) -> String
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Helper to manage variable scope during static analysis.
|
|
69
|
+
class StaticScope
|
|
70
|
+
@stack: Array[Set[String]]
|
|
71
|
+
|
|
72
|
+
# (Set[String]) -> void
|
|
73
|
+
def initialize: (Set[String] globals) -> void
|
|
74
|
+
|
|
75
|
+
def include?: (String key) -> bool
|
|
76
|
+
|
|
77
|
+
def push: (Set[String] scope) -> self
|
|
78
|
+
|
|
79
|
+
def pop: () -> untyped
|
|
80
|
+
|
|
81
|
+
def add: (String name) -> void
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Helper to group variables by their root segment during static analysis.
|
|
85
|
+
class VariableMap
|
|
86
|
+
@data: Hash[String, Array[StaticVariable]]
|
|
87
|
+
|
|
88
|
+
attr_reader data: Hash[String, Array[StaticVariable]]
|
|
89
|
+
|
|
90
|
+
def initialize: () -> void
|
|
91
|
+
|
|
92
|
+
def []: (StaticVariable var) -> Array[StaticVariable]?
|
|
93
|
+
|
|
94
|
+
def add: (StaticVariable var) -> void
|
|
95
|
+
|
|
96
|
+
# () -> Hash[String, Array[_Var]]
|
|
97
|
+
def to_h: () -> untyped
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# The result of analyzing a template.
|
|
101
|
+
class Result
|
|
102
|
+
@variables: untyped
|
|
103
|
+
|
|
104
|
+
@globals: untyped
|
|
105
|
+
|
|
106
|
+
@locals: untyped
|
|
107
|
+
|
|
108
|
+
@filters: untyped
|
|
109
|
+
|
|
110
|
+
@tags: untyped
|
|
111
|
+
|
|
112
|
+
attr_reader variables: untyped
|
|
113
|
+
|
|
114
|
+
attr_reader globals: untyped
|
|
115
|
+
|
|
116
|
+
attr_reader locals: untyped
|
|
117
|
+
|
|
118
|
+
attr_reader filters: untyped
|
|
119
|
+
|
|
120
|
+
attr_reader tags: untyped
|
|
121
|
+
|
|
122
|
+
def initialize: (untyped variables, untyped globals, untyped locals, untyped filters, untyped tags) -> void
|
|
123
|
+
|
|
124
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def self.analyze: (Luoma::Template template, include_partials: bool) -> Result
|
|
128
|
+
|
|
129
|
+
# (Luoma::_Traversable, Luoma::Template, Luoma::RenderContext) -> Array[[String, Location]]
|
|
130
|
+
def self.extract_filters: (Luoma::_Traversable expression, Luoma::Template template, Luoma::RenderContext static_context) -> Array[[String, Location]]
|
|
131
|
+
|
|
132
|
+
# (Luoma:_Traversable, Luoma::Template, StaticScope, VariableMap, VariableMap, RenderContext) -> void
|
|
133
|
+
def self.analyze_variables: (Luoma::_Traversable expression, Luoma::Template template, StaticScope scope, VariableMap globals, VariableMap variables, Luoma::RenderContext static_context) -> untyped
|
|
134
|
+
|
|
135
|
+
# (Luoma::Variable, Luoma::Template) -> Array[untyped]
|
|
136
|
+
def self.segments: (Luoma::Variable var, Luoma::Template template) -> Array[untyped]
|
|
137
|
+
|
|
138
|
+
# (Hash[String, Array[Location]]) -> Hash[String, Array[untyped]]
|
|
139
|
+
def self.to_locations: (untyped map) -> untyped
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class AssignTag < Markup
|
|
3
|
+
|
|
4
|
+
@bindings: Array[Item]
|
|
5
|
+
|
|
6
|
+
# (t_token, String, Parser) -> Markup
|
|
7
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
8
|
+
|
|
9
|
+
# (t_token, Array[Item]) -> void
|
|
10
|
+
def initialize: (t_token token, String tag_name, Array[Item]) -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class BreakTag < Markup
|
|
3
|
+
# (t_token, String, Parser) -> Markup
|
|
4
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
5
|
+
|
|
6
|
+
def initialize: (t_token token, String tag_name) -> void
|
|
7
|
+
|
|
8
|
+
# (RenderContext, String) -> void
|
|
9
|
+
def render: (RenderContext context, String buffer) -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class CaptureTag < Markup
|
|
3
|
+
@identifier: Name
|
|
4
|
+
|
|
5
|
+
@block: t_block
|
|
6
|
+
|
|
7
|
+
END_CAPTURE_BLOCK: Set[String]
|
|
8
|
+
|
|
9
|
+
# (t_token, String, Parser) -> Markup
|
|
10
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
11
|
+
|
|
12
|
+
def initialize: (t_token token, String tag_name, Name identifier, t_block block) -> void
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class CaseTag < Markup
|
|
3
|
+
@expression: Expression
|
|
4
|
+
|
|
5
|
+
@blocks: Array[WhenBlock|ElseBlock]
|
|
6
|
+
|
|
7
|
+
END_CASE_BLOCK: Set[String]
|
|
8
|
+
|
|
9
|
+
# (t_token, String, Parser) -> Markup
|
|
10
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
11
|
+
|
|
12
|
+
# (t_token, String, Expression, Array[WhenBlock], ElseBlock?) -> void
|
|
13
|
+
def initialize: (t_token token, String tag_name, Expression expression, Array[WhenBlock|ElseBlock] blocks) -> void
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class WhenBlock < Markup
|
|
17
|
+
@right: Array[Expression]
|
|
18
|
+
|
|
19
|
+
@block: t_block
|
|
20
|
+
|
|
21
|
+
END_CASE_BLOCK: Set[String]
|
|
22
|
+
|
|
23
|
+
attr_reader block: t_block
|
|
24
|
+
|
|
25
|
+
attr_reader right: Array[Expression]
|
|
26
|
+
|
|
27
|
+
# (String, Parser) -> WhenBlock
|
|
28
|
+
def self.parse: (String tag_name, Parser parser) -> WhenBlock
|
|
29
|
+
|
|
30
|
+
# (t_token, String, Array[Expression], t_block) -> void
|
|
31
|
+
def initialize: (t_token token, String tag_name, Array[Expression] right, t_block block) -> void
|
|
32
|
+
|
|
33
|
+
#: () -> void
|
|
34
|
+
def filter_strings: () -> void
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class ContinueTag < Markup
|
|
3
|
+
# (t_token, String, Parser) -> Markup
|
|
4
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
5
|
+
|
|
6
|
+
def initialize: (t_token token, String tag_name) -> void
|
|
7
|
+
|
|
8
|
+
# (RenderContext, String) -> void
|
|
9
|
+
def render: (RenderContext context, String buffer) -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class DefineTag < Markup
|
|
3
|
+
@identifier: Name
|
|
4
|
+
|
|
5
|
+
@block: t_block
|
|
6
|
+
|
|
7
|
+
@drop: BlockDrop
|
|
8
|
+
|
|
9
|
+
END_DEFINE_BLOCK: Set[String]
|
|
10
|
+
|
|
11
|
+
# (t_token, String, Parser) -> Markup
|
|
12
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
13
|
+
|
|
14
|
+
def initialize: (t_token token, String tag_name, Name identifier, t_block block) -> void
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class ElseBlock < Markup
|
|
3
|
+
@expression: Expression
|
|
4
|
+
|
|
5
|
+
@block: t_block
|
|
6
|
+
|
|
7
|
+
attr_reader expression: Expression
|
|
8
|
+
|
|
9
|
+
attr_reader block: t_block
|
|
10
|
+
|
|
11
|
+
# (t_token, String, t_block) -> void
|
|
12
|
+
def initialize: (t_token token, String tag_name, t_block block) -> void
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def filter_strings: () -> untyped
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class ForTag < Markup
|
|
3
|
+
@params: Array[Name]
|
|
4
|
+
|
|
5
|
+
@expression: Expression
|
|
6
|
+
|
|
7
|
+
@block: t_block
|
|
8
|
+
|
|
9
|
+
@default: t_block?
|
|
10
|
+
|
|
11
|
+
END_FOR_BLOCK: Set[String]
|
|
12
|
+
|
|
13
|
+
# (t_token, String, Parser) -> Markup
|
|
14
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
15
|
+
|
|
16
|
+
#: (t_token, String, Array[Name], Expression, t_block, t_block?) -> void
|
|
17
|
+
def initialize: (
|
|
18
|
+
t_token token,
|
|
19
|
+
String tag_name,
|
|
20
|
+
Array[Name] params,
|
|
21
|
+
Expression expression,
|
|
22
|
+
t_block block,
|
|
23
|
+
t_block? default,
|
|
24
|
+
) -> void
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class IfTag < Markup
|
|
3
|
+
@alts: Array[IfBlock | ElseBlock]
|
|
4
|
+
|
|
5
|
+
END_IF_BLOCK: Set[String]
|
|
6
|
+
|
|
7
|
+
ELSE_IF_TAGS: Set[String]
|
|
8
|
+
|
|
9
|
+
# (t_token, String, Parser) -> Markup
|
|
10
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
11
|
+
|
|
12
|
+
def initialize: (t_token token, String tag_name, Array[IfBlock | ElseBlock] alts) -> void
|
|
13
|
+
|
|
14
|
+
# (RenderContext, String) -> void
|
|
15
|
+
def render: (RenderContext context, String buffer) -> void
|
|
16
|
+
|
|
17
|
+
# (RenderContext) -> Array[Markup]
|
|
18
|
+
def children: (RenderContext static_context) -> Array[Markup]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class IfBlock < Markup
|
|
22
|
+
@expression: Expression
|
|
23
|
+
|
|
24
|
+
@block: t_block
|
|
25
|
+
|
|
26
|
+
END_IF_BLOCK: Set[String]
|
|
27
|
+
|
|
28
|
+
attr_reader expression: Expression
|
|
29
|
+
|
|
30
|
+
attr_reader block: t_block
|
|
31
|
+
|
|
32
|
+
# (Parser) -> Markup
|
|
33
|
+
def self.parse: (String tag_name, Parser parser) -> IfBlock
|
|
34
|
+
|
|
35
|
+
def initialize: (t_token token, String tag_name, Expression expression, t_block block) -> void
|
|
36
|
+
|
|
37
|
+
# (RenderContext) -> Array[Markup]
|
|
38
|
+
def children: (RenderContext static_context) -> Array[Markup]
|
|
39
|
+
|
|
40
|
+
# () -> Array[Expression]
|
|
41
|
+
def expressions: () -> ::Array[Expression]
|
|
42
|
+
|
|
43
|
+
def filter_strings: () -> void
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class ImportTag < Markup
|
|
3
|
+
@template_name: Name
|
|
4
|
+
|
|
5
|
+
@namespace: Name?
|
|
6
|
+
|
|
7
|
+
# (t_token, String, Parser) -> Markup
|
|
8
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
9
|
+
|
|
10
|
+
# (t_token, String, Name?) -> void
|
|
11
|
+
def initialize: (t_token token, String tag_name, Name template_name, Name? namespace) -> void
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class IncludeTag < Markup
|
|
3
|
+
@template_name: Expression
|
|
4
|
+
|
|
5
|
+
@args: Array[KeywordArgument]
|
|
6
|
+
|
|
7
|
+
# (t_token, String, Parser) -> Markup
|
|
8
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
9
|
+
|
|
10
|
+
# (t_token, String, Expression, Array[KeywordArgument]) -> void
|
|
11
|
+
def initialize: (t_token token, String tag_name, Expression template_name, Array[KeywordArgument] args) -> void
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class OutputStatement < Markup
|
|
3
|
+
@expression: Expression
|
|
4
|
+
|
|
5
|
+
def initialize: (t_token token, Expression expression) -> void
|
|
6
|
+
|
|
7
|
+
# (RenderContext, String) -> void
|
|
8
|
+
def render: (RenderContext context, String buffer) -> void
|
|
9
|
+
|
|
10
|
+
# () -> Array[Expression]
|
|
11
|
+
def expressions: () -> ::Array[Expression]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class RawTag < Markup
|
|
3
|
+
@text: String
|
|
4
|
+
|
|
5
|
+
# (t_token, String, Parser) -> Markup
|
|
6
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
7
|
+
|
|
8
|
+
# (t_token, String, String) -> void
|
|
9
|
+
def initialize: (t_token token, String tag_name, String text) -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class RenderTag < Markup
|
|
3
|
+
@template_name: Name
|
|
4
|
+
|
|
5
|
+
@args: Array[KeywordArgument]
|
|
6
|
+
|
|
7
|
+
# (t_token, String, Parser) -> Markup
|
|
8
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
9
|
+
|
|
10
|
+
# (t_token, String, Name, Array[KeywordArgument]) -> void
|
|
11
|
+
def initialize: (t_token token, String tag_name, Name template_name, Array[KeywordArgument] args) -> void
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Luoma
|
|
2
|
+
class WithTag < Markup
|
|
3
|
+
@args: Array[KeywordArgument]
|
|
4
|
+
|
|
5
|
+
@block: t_block
|
|
6
|
+
|
|
7
|
+
END_WITH_BLOCK: Set[String]
|
|
8
|
+
|
|
9
|
+
# (t_token, String, Parser) -> Markup
|
|
10
|
+
def self.parse: (t_token token, String tag_name, Parser parser) -> Markup
|
|
11
|
+
|
|
12
|
+
# (t_token, String, Array[KeywordArgument], t_block) -> void
|
|
13
|
+
def initialize: (t_token token, String tag_name, Array[KeywordArgument] args, t_block block) -> void
|
|
14
|
+
end
|
|
15
|
+
end
|