Add more parsers.

This commit is contained in:
Jakob Rath 2013-12-11 14:01:43 +01:00 committed by Dan Hirsch
parent 8048f2e731
commit 8ff5e181ce
3 changed files with 44 additions and 15 deletions

View file

@ -27,9 +27,8 @@ module Hammer
attach_function :h_left, [:pointer, :pointer], :pointer attach_function :h_left, [:pointer, :pointer], :pointer
attach_function :h_right, [:pointer, :pointer], :pointer attach_function :h_right, [:pointer, :pointer], :pointer
attach_function :h_middle, [:pointer, :pointer, :pointer], :pointer attach_function :h_middle, [:pointer, :pointer, :pointer], :pointer
# h_action #attach_function :h_in, [:string, :size_t], :pointer
# h_in #attach_function :h_not_in, [:string, :size_t], :pointer
# h_not_in
attach_function :h_end_p, [], :pointer attach_function :h_end_p, [], :pointer
attach_function :h_nothing_p, [], :pointer attach_function :h_nothing_p, [], :pointer
attach_function :h_sequence, [:varargs], :pointer attach_function :h_sequence, [:varargs], :pointer
@ -39,18 +38,27 @@ module Hammer
attach_function :h_xor, [:pointer, :pointer], :pointer attach_function :h_xor, [:pointer, :pointer], :pointer
attach_function :h_many, [:pointer], :pointer attach_function :h_many, [:pointer], :pointer
attach_function :h_many1, [:pointer], :pointer attach_function :h_many1, [:pointer], :pointer
# h_repeat_n #attach_function :h_repeat_n, [:pointer, :size_t], :pointer
# h_optional attach_function :h_optional, [:pointer], :pointer
# h_ignore attach_function :h_ignore, [:pointer], :pointer
# h_sepBy attach_function :h_sepBy, [:pointer, :pointer], :pointer
# h_sepBy1 attach_function :h_sepBy1, [:pointer, :pointer], :pointer
# h_epsilon_p attach_function :h_epsilon_p, [], :pointer
# h_length_value attach_function :h_length_value, [:pointer, :pointer], :pointer
# h_attr_bool attach_function :h_and, [:pointer], :pointer
# h_and attach_function :h_not, [:pointer], :pointer
# h_not
# h_indirect attach_function :h_indirect, [], :pointer
# h_bind_indirect 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 # free the parse result
attach_function :h_parse_result_free, [:pointer], :void attach_function :h_parse_result_free, [:pointer], :void

View file

@ -84,6 +84,17 @@ module Hammer
define_parser :xor define_parser :xor
define_parser :many define_parser :many
define_parser :many1 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 attr_reader :h_parser
end end

View file

@ -82,6 +82,16 @@ module Hammer
define_parser :xor define_parser :xor
define_parser :many define_parser :many
define_parser :many1 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 # class ParserBuilder
end # module Hammer end # module Hammer