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

Use "cookies" from 4.02.1 to make named regexps work in toplevel #10

Closed
wants to merge 2 commits into from
Closed

Conversation

whitequark
Copy link
Contributor

Test code (t.ml):

#require "sedlex";;

let lid = [%sedlex.regexp? "foo"];;

let lex lexbuf =
  match%sedlex lexbuf with
  | lid -> true
  | _ -> false
;;
ocaml <t.ml

@alainfrisch
Copy link
Collaborator

Thanks! It would require much more work (esp. because the internal representation currently uses functions), but I'd be more inclined to store the regexp definitions in a more structured way (e.g. by keeping the original Parsetree fragments) rather than through the generic binary marshaling.

@whitequark
Copy link
Contributor Author

@alainfrisch I thought about it, but I'm certainly not up to an almost complete rewrite of sedlex.

@alainfrisch
Copy link
Collaborator

@whitequark You're so pessimistic :-) See commit bceb0d9

@whitequark
Copy link
Contributor Author

@alainfrisch I tried to do something like that but failed--I guess I did not try hard enough.

You still need the opam changes from this PR, after which it may be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants