caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamllex and yyless, putting back chars in lexbuf
@ 2009-11-12 18:47 yoann padioleau
  2009-11-12 20:32 ` [Caml-list] " Dario Teixeira
  0 siblings, 1 reply; 2+ messages in thread
From: yoann padioleau @ 2009-11-12 18:47 UTC (permalink / raw)
  To: caml-list

Hi,

Is there a way in ocamllex to put back certain characters
in the buffer. In flex you can do that

<LOOKING_FOR_XXX>[a-z]+ {
	yy_pop_state();
	yy_push_state(ST_TOP);
	return T_STRING_VARNAME;
}


<LOOKING_FOR_XXX>{ANY_CHAR} {
	yyless(0);
	yy_pop_state();
	yy_push_state(ST_TOP);
}


Should I play with fields like lexbuf_lex_curr_pos ?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocamllex and yyless, putting back chars in lexbuf
  2009-11-12 18:47 ocamllex and yyless, putting back chars in lexbuf yoann padioleau
@ 2009-11-12 20:32 ` Dario Teixeira
  0 siblings, 0 replies; 2+ messages in thread
From: Dario Teixeira @ 2009-11-12 20:32 UTC (permalink / raw)
  To: caml-list, yoann padioleau

Hi,

> Is there a way in ocamllex to put back certain characters
> in the buffer. In flex you can do that

It is also possible with Ulex, using Ulexing.rollback.

Even if you don't need the UTF8 features, I suggest you take a
look at Ulex anyway; the approach used (it's a syntax extension)
provides greater flexibility.  Moreover, it also handles latin1
streams fine.

Cheers,
Dario Teixeira






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-12 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-12 18:47 ocamllex and yyless, putting back chars in lexbuf yoann padioleau
2009-11-12 20:32 ` [Caml-list] " Dario Teixeira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).