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
|
# File 'lib/xdry/parsing/parsers.rb', line 55
def parse_line! line, , indent
@this_line_tags = Set.new
[[/!p\b/, 'wants-property'], [/!c\b/, 'wants-constructor']].each do |regexp, tag|
if line =~ regexp
marker = $&
is_full_line = line.gsub(marker, '').strip.empty?
klass = is_full_line ? NFullLineMarker : NPartLineMarker
yield klass.new(marker)
(is_full_line ? @tags : @this_line_tags) << tag
return if is_full_line
end
end
case line
when /\}/
yield NInterfaceFieldsEnd.new
when %r~^//\s*persistent$~
@tags << 'persistent'
when ''
@tags.clear
when /^(\w+)\s+(\w+)\s*;/
type_name, field_name = $1, $2
yield process_type_hint(NFieldDef.new(field_name, SimpleVarType.new(type_name)), )
when /^(\w+)\s*\*\s*(\w+)\s*;/
type_name, field_name = $1, $2
yield process_type_hint(NFieldDef.new(field_name, PointerVarType.new(type_name)), )
when /^id<(\w+)>\s+(\w+)\s*;/
type_name, field_name = $1, $2
yield process_type_hint(NFieldDef.new(field_name, IdVarType.new()), )
end
end
|