Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Annotation mixin to add idl_stringified #359

Merged
merged 3 commits into from
Feb 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions ridlbe/c++11/config/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,37 @@ def scoped_skel_cxxname
include ValuetypeMixin
end

module AnnotationMixin
def idl_stringified
s = '@' + id.to_s
unless fields.empty?
s += '('
fields.each_with_index do |_, index|
if fields.size > 1
s += fields.keys[index].to_s + '='
end
case fields.values[index]
when TrueClass
s += 'TRUE'
when FalseClass
s += 'FALSE'
else
s += fields.values[index].to_s
end
if index < fields.size - 1
s += ','
end
end
s += ')'
end
s
end
end

IDL::AST::Annotation.class_eval do
include AnnotationMixin
end

module ScannerMixin
CXXKW = [
:alignas,
Expand Down