зеркало из https://github.com/github/ruby.git
[ruby/prism] More documentation for ast.h
https://github.com/ruby/prism/commit/84e22c5581
This commit is contained in:
Родитель
17923cc876
Коммит
51079a89af
|
@ -14,9 +14,10 @@
|
|||
*/
|
||||
typedef enum pm_token_type {
|
||||
<%- tokens.each do |token| -%>
|
||||
<%= token.declaration %>
|
||||
<%- end -%>
|
||||
/** <%= token.comment %> */
|
||||
PM_TOKEN_<%= token.name %><% " = #{token.value}" if token.value %>,
|
||||
|
||||
<%- end -%>
|
||||
/** The maximum token value. */
|
||||
PM_TOKEN_MAXIMUM,
|
||||
} pm_token_type_t;
|
||||
|
@ -69,9 +70,10 @@ typedef struct pm_node_list {
|
|||
*/
|
||||
enum pm_node_type {
|
||||
<%- nodes.each_with_index do |node, index| -%>
|
||||
/** <%= node.name %> */
|
||||
<%= node.type %> = <%= index + 1 %>,
|
||||
<%- end -%>
|
||||
|
||||
<%- end -%>
|
||||
/** A special kind of node used for compilation. */
|
||||
PM_SCOPE_NODE
|
||||
};
|
||||
|
@ -153,7 +155,9 @@ typedef struct pm_<%= node.human %> {
|
|||
*/
|
||||
typedef enum pm_<%= flag.human %> {
|
||||
<%- flag.values.each_with_index do |value, index| -%>
|
||||
PM_<%= flag.human.upcase %>_<%= value.name %> = 1 << <%= index %>,
|
||||
<%= "\n" if index > 0 -%>
|
||||
/** <%= value.comment %> */
|
||||
PM_<%= flag.human.upcase %>_<%= value.name %> = <%= 1 << index %>,
|
||||
<%- end -%>
|
||||
} pm_<%= flag.human %>_t;
|
||||
<%- end -%>
|
||||
|
|
|
@ -298,14 +298,6 @@ module Prism
|
|||
@value = config["value"]
|
||||
@comment = config.fetch("comment")
|
||||
end
|
||||
|
||||
def declaration
|
||||
output = []
|
||||
output << "PM_TOKEN_#{name}"
|
||||
output << " = #{value}" if value
|
||||
output << ", // #{comment}"
|
||||
output.join
|
||||
end
|
||||
end
|
||||
|
||||
# Represents a set of flags that should be internally represented with an enum.
|
||||
|
|
Загрузка…
Ссылка в новой задаче