Skip to content

Rewrite camel_case_to_capitalized_snake_case with OCamLe #12

@cedlemo

Description

@cedlemo

see first implementation cedlemo/OCaml-GObject-Introspection@5e1faaa

https://github.com/cedlemo/OCaml-GObject-Introspection/blob/master/lib/lexer.mll

  • find a better name ?
  • improve with IOChannel -> IO_channel ?

When a string does not correspond to the pattern of Lexer.snake_case, there is an exception:

Fatal error: exception GObject_introspection__Lexer.Error("illegal character 'c'"

How to catch it ?

there is an issue with the skip functionnalities,
in the Loader when Binding_utils.match_on_of is used, it is checked on the C name (ByteArray) for example while every where else, it is used on the binding name that is build with the lexer.

The problem is that in Loader I can not use the lexer directly because,
the function get_binding_name raise an error with:

  • constant name A_CONSTANT_NAME
  • function name a_function_name

Should the lexer raise an error, should it return the non modified string if it does not match ?
for now, the skip list will contain both C name and Ocaml binding names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions