diff --git a/src/bindings/ruby/lib/hammer/internal.rb b/src/bindings/ruby/lib/hammer/internal.rb index 4fadb500a930bee0e36a9f4bd68f3723b4dbfb75..8132567b12e971c7590a4f56611793fa5f689dfa 100644 --- a/src/bindings/ruby/lib/hammer/internal.rb +++ b/src/bindings/ruby/lib/hammer/internal.rb @@ -27,9 +27,8 @@ module Hammer attach_function :h_left, [:pointer, :pointer], :pointer attach_function :h_right, [:pointer, :pointer], :pointer attach_function :h_middle, [:pointer, :pointer, :pointer], :pointer - # h_action - # h_in - # h_not_in + #attach_function :h_in, [:string, :size_t], :pointer + #attach_function :h_not_in, [:string, :size_t], :pointer attach_function :h_end_p, [], :pointer attach_function :h_nothing_p, [], :pointer attach_function :h_sequence, [:varargs], :pointer @@ -39,18 +38,27 @@ module Hammer attach_function :h_xor, [:pointer, :pointer], :pointer attach_function :h_many, [:pointer], :pointer attach_function :h_many1, [:pointer], :pointer - # h_repeat_n - # h_optional - # h_ignore - # h_sepBy - # h_sepBy1 - # h_epsilon_p - # h_length_value - # h_attr_bool - # h_and - # h_not - # h_indirect - # h_bind_indirect + #attach_function :h_repeat_n, [:pointer, :size_t], :pointer + attach_function :h_optional, [:pointer], :pointer + attach_function :h_ignore, [:pointer], :pointer + attach_function :h_sepBy, [:pointer, :pointer], :pointer + attach_function :h_sepBy1, [:pointer, :pointer], :pointer + attach_function :h_epsilon_p, [], :pointer + attach_function :h_length_value, [:pointer, :pointer], :pointer + attach_function :h_and, [:pointer], :pointer + attach_function :h_not, [:pointer], :pointer + + attach_function :h_indirect, [], :pointer + attach_function :h_bind_indirect, [:pointer, :pointer], :void + + #attach_function :h_action, [:pointer, ...], :pointer + #attach_function :h_attr_bool, [:pointer, ...], :pointer + + #class HParseResult < FFI::Struct + # layout :ast, :pointer, + # :bit_length, :longlong, + # :arena, :pointer + #end # free the parse result attach_function :h_parse_result_free, [:pointer], :void diff --git a/src/bindings/ruby/lib/hammer/parser.rb b/src/bindings/ruby/lib/hammer/parser.rb index 5e4e3c01239ec6e50d0dea78986fef463ea1adff..12d047629308e5546bb1da9fa6cfc781d84a7349 100644 --- a/src/bindings/ruby/lib/hammer/parser.rb +++ b/src/bindings/ruby/lib/hammer/parser.rb @@ -84,6 +84,17 @@ module Hammer define_parser :xor define_parser :many define_parser :many1 + define_parser :optional + define_parser :ignore + define_parser :sepBy + define_parser :sepBy1 + define_parser :epsilon_p + define_parser :length_value + define_parser :and + define_parser :not + + # TODO: If indirect, add a bind method that calls h_bind_indirect + define_parser :indirect attr_reader :h_parser end diff --git a/src/bindings/ruby/lib/hammer/parser_builder.rb b/src/bindings/ruby/lib/hammer/parser_builder.rb index 9547c6e3fb1db1c51bd39356622eb5d04e62f750..d1618c51860ffd882294b55e3a6d9348eb865873 100644 --- a/src/bindings/ruby/lib/hammer/parser_builder.rb +++ b/src/bindings/ruby/lib/hammer/parser_builder.rb @@ -82,6 +82,16 @@ module Hammer define_parser :xor define_parser :many define_parser :many1 + define_parser :optional + define_parser :ignore + define_parser :sepBy + define_parser :sepBy1 + define_parser :epsilon_p + define_parser :length_value + define_parser :and + define_parser :not + define_parser :indirect + end # class ParserBuilder end # module Hammer