flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
munga has quit [Read error: 110 (Connection timed out)]
RobertFischer has joined #ocaml
Mr_Awesome has joined #ocaml
Demitar has quit [Remote closed the connection]
cmeme has joined #ocaml
cmeme has quit [Read error: 104 (Connection reset by peer)]
cmeme has joined #ocaml
hkBst has quit ["Konversation terminated!"]
postalchris has joined #ocaml
Morphous_ has quit [Read error: 110 (Connection timed out)]
Morphous_ has joined #ocaml
Ched- has quit [Read error: 110 (Connection timed out)]
Ched- has joined #ocaml
postalchris has quit ["Leaving."]
seafood has joined #ocaml
marmotine has quit ["Quitte"]
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
seafood has quit []
<palomer> thelema, you around?
ygrek has joined #ocaml
seafood has joined #ocaml
<thelema> palomer: I just got in
LeeKnux has joined #ocaml
<palomer> thelema, what's the regexp for "any string not containing foo"?
<thelema> hmm, can't you just match on foo and reverse the logic?
<palomer> well, err
<thelema> if match foo then 'has foo' else 'doesn't have foo'
<palomer> I'm lexing an html file
<thelema> with regexps? bad form.
<palomer> how else can I lex it??
<palomer> I'm using a parser generator to parse html files
<thelema> with a proper ... well, I guess you could use regexps just for the lexing part...
<thelema> don't parse html with regexes.
<palomer> don't worry
<palomer> I've written my own parser generator
<thelema> okay, so you're lexing with regexes... why do you need a not-foo regexp?
<palomer> well...
<palomer> I'm lexing as follows
<palomer> 2 kinds of token
<palomer> first kind: <[^>]*>
<palomer> second kind: anything not containing <
<thelema> ok, so you need a regex for the second?
<palomer> righto!
<thelema> why not do (<[^>]*>)([^<]*)?
<thelema> to combine them. as for the not <, that's just the second grouping.
<palomer> good point
<palomer> there's another caveat
<palomer> < _can_ appear, but it has to be preceded by an odd number of \\
<palomer> err
<palomer> of \
<palomer> so foo \< bar is allowed
<palomer> and foo bar is allowed
<palomer> and foo \\\< bar is allowed
TheLittlePrince has joined #ocaml
<palomer> but foo < bar is not allowed
<thelema> hmmm...
<palomer> (am I being clear?)
<thelema> ((\\\\)*\\<)|[^<])*
<thelema> (I've escaped \ already - that's why there's so many \\)
<palomer> one too many parens
<palomer> let's see what it gives me
<thelema> add one more ( at the beginning
<palomer> cool, it works
<thelema> a dfa should work quite reasonably for doing this kind of parsing.
<thelema> s/parsing/lexing/
<palomer> in this case, the string I'm "unmatching" is <
<palomer> is it possible to do this kind of stuff for strings of length greater than 1?
<thelema> yes, i remember now how to do it...
<palomer> wait, it matches foo \\< t !!
<thelema> it shouldn't.
<palomer> lemme load up a test case
<thelema> ((\\)*\<) matches an odd # of \ before a single <
<thelema> anyway, to match "foo", use assertions to assert that "f" is never followed by "oo"
<thelema> err, unmatch
<palomer> oh, wait, you're escaping the \
<thelema> ([^f]*f(?!oo))* matches all strings not containing "foo"
<palomer> that's a wicked weird operator
<palomer> ?!
<thelema> yup. negative lookahead assertions. crazy stuff
<thelema> almost as crazy as lookbehind assertions.
<thelema> (?<=bullock|donkey)
<palomer> why not just (?!foo)* ?
<thelema> palomer: that never advances a character.
<thelema> just like you can't say $*
<thelema> or ^*
<thelema> I think it would only ever match the empty string.
<thelema> maybe you could do ((?!foo).)*
<palomer> so (?!foo) doesn't match a character
<palomer> it's just a predicate
<thelema> You may need to double-escape \ (once for ocaml's string, once for PCRE)
<thelema> yes, it's a zero-width assertion.
* palomer goes nuts with double escapings!
<palomer> I'm entering my regular expressions directly into ocaml through gtk
<thelema> gtk?
<palomer> yeah
<palomer> a text entry
<palomer> so I enter my regexp in a text entry
<palomer> what I want to match in a text entry
<palomer> and then my little application tells me if it's matched
<thelema> sounds like fun.
<palomer> ((?!foo).)* <-- seems to work
<palomer> (((\\\\)*\\<)|[^<])* <--doesn't work
<thelema> hmmm...
<thelema> it matches \\\\<?
<palomer> it matches \< and \\< and \\\< and \\\\<
<thelema> ah, you need to exclude \ as well...
<thelema> try (((\\\\)*\\<)|[^\\<])*
<thelema> but then you need to put \ back in, so...
<palomer> that's match <, no?
<palomer> seems to work
<thelema> try (((\\\\)*\\<)|(\[^<])|[^\\<])*
<palomer> but it works!
<thelema> without the extra bit, it'll fail on \3
<palomer> oh, righto
<palomer> whew
<thelema> try (((\\\\)*\\<)|(\\[^<])|[^\\<])* (need one more \ to stay consistent on my single-escaping
<palomer> maybe it's easier with ?! ?
<thelema> easier with dfa.
<thelema> nice easy states to manage.
<thelema> anyway, good job and good night.
<palomer> night!
<palomer> what a tough problem
<vixey> what's all this regex for
<palomer> I'm lexing an html file
<vixey> wow interesting choice of tool
<palomer> to lex an html file?
<palomer> do you have any better suggestions??!
<vixey> to use regex to do that
<vixey> well, why are you lexing HTML?
<palomer> for kicks
<vixey> then regex is fine :p
<palomer> too see how it's done
<palomer> seems like it's really hard
<vixey> I would use camllex
<palomer> I've developed a parser generator
<palomer> and I'm testing it out
palomer has quit [Remote closed the connection]
palomer has joined #ocaml
<palomer> hah
<palomer> looks like you can't escape < in html
<palomer> wicked!
<vixey> &lt;
<palomer> yeah
palomer has quit [Remote closed the connection]
Mr_Awesome has quit ["aunt jemima is the devil!"]
LeeKnux has quit ["Adios Amigos!"]
bohanlon has quit [Remote closed the connection]
bohanlon has joined #ocaml
filp has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
TheLittlePrince has quit [Client Quit]
petchema_ has joined #ocaml
rwmjones has joined #ocaml
petchema has quit [Read error: 110 (Connection timed out)]
<gildor_> rwmjones: i release ocaml-gettext 0.3.2, based on your patch yesterday
seafood_ has joined #ocaml
seafood has quit [Read error: 104 (Connection reset by peer)]
<rwmjones> gildor_, yes just saw it, thanks!
rwmjones has quit ["Closed connection"]
hkBst has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
authentic has joined #ocaml
Yoric[DT] has joined #ocaml
Demitar has joined #ocaml
munga has joined #ocaml
^authentic has joined #ocaml
Demitar has quit [leguin.freenode.net irc.freenode.net]
petchema_ has quit [leguin.freenode.net irc.freenode.net]
shortcircuit has quit [leguin.freenode.net irc.freenode.net]
rhar has quit [leguin.freenode.net irc.freenode.net]
sporkmonger has quit [leguin.freenode.net irc.freenode.net]
im_a_man has quit [leguin.freenode.net irc.freenode.net]
vixey has quit [leguin.freenode.net irc.freenode.net]
rhar has joined #ocaml
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
vixey has joined #ocaml
sporkmonger has joined #ocaml
shortcircuit has joined #ocaml
petchema_ has joined #ocaml
Demitar has joined #ocaml
im_a_man has joined #ocaml
bluestorm has joined #ocaml
authentic has quit [Remote closed the connection]
jlouis has quit ["Leaving"]
authentic has joined #ocaml
rwmjones has joined #ocaml
Snark_ has joined #ocaml
Snark_ is now known as Snark
sporkmonger has quit []
LordMetroid has joined #ocaml
rwmjones has quit ["Closed connection"]
rwmjones has joined #ocaml
LordMetroid has quit [Read error: 104 (Connection reset by peer)]
LordMetroid has joined #ocaml
RobertFischer has joined #ocaml
seafood_ has quit [Read error: 104 (Connection reset by peer)]
sporkmonger has joined #ocaml
sporkmonger has quit [Read error: 104 (Connection reset by peer)]
<flux> at times it would be useful if tuples could be converted into compatible records and vice versa
<flux> I suppose very rarely, though :)
<RobertFischer> They can be converted.
<RobertFischer> You have to write the conversion, but they can be converted just fine.
<flux> yes :)
<flux> I was thinking of a way that didn't involve writing anything :)
<bluestorm> (and you can have a camlp4 extension puking conversion functions from records in about 10 minutes)
<flux> and would work like %identity. but isn't not possible to statically determine the arity of a record
petchema_ has quit [Read error: 110 (Connection timed out)]
<flux> of course, the record should not have any mutable fields
<flux> it's too bad that all the conversion function generation need to be put to the definition site of the record
<flux> because camlp4 cannot access the type-level information, or other information defined in other modules
<bluestorm> i quite like the "with to_tuple" pa_type_conv way of enriching type definitions
<flux> while it's nice, I don't think it really is the right place to put the stuff
<flux> how about if you wanted to extend Unix.stats? no can do..
<flux> unless you modify the Unix module
<flux> hm, not extend, but derive the functions
<flux> but that's the way it must go at present
<bluestorm> you may be able to use
<bluestorm> type foo = Unix.foo = { ... }
<bluestorm> with ...
qwr has quit [Remote closed the connection]
<bluestorm> i'm not sure type-conv handle the re-exportation case right now, but it would be quite easy to add, and solve your problem in a limited way
<bluestorm> (but it involves a bit of code copying)
filp has quit ["Bye"]
qwr has joined #ocaml
authentic has quit [Remote closed the connection]
LordMetroid has quit [Connection timed out]
m3ga has joined #ocaml
authentic has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
LordMetroid has joined #ocaml
RobertFischer has quit []
marmotine has joined #ocaml
gaja has quit ["leaving"]
struk_atwork is now known as struk|busy
lordmetroid_ has joined #ocaml
lordmetroid_ has quit [Client Quit]
lordmetroid_ has joined #ocaml
ygrek has quit [Remote closed the connection]
LordMetroid has quit [Read error: 110 (Connection timed out)]
seafood has joined #ocaml
ygrek has joined #ocaml
vixey has quit ["* I'm too lame to read BitchX.doc *"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
rwmjones has quit [Read error: 110 (Connection timed out)]
^authentic has joined #ocaml
seafood has quit []
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
authentic has quit [Remote closed the connection]
Linktim has joined #ocaml
Linktim has quit [Remote closed the connection]
smimou has quit ["bli"]
Linktim has joined #ocaml
RobertFischer has joined #ocaml
lordmetroid__ has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
det has joined #ocaml
lordmetroid_ has quit [Connection timed out]
LordMetroid has joined #ocaml
rwmjones has joined #ocaml
lordmetroid_ has joined #ocaml
lordmetroid__ has quit [Read error: 110 (Connection timed out)]
LordMetroid has quit [Connection timed out]
lordmetroid__ has joined #ocaml
guillem has joined #ocaml
Snark has quit ["Ex-Chat"]
rhar has quit ["Leaving"]
lordmetroid_ has quit [Read error: 110 (Connection timed out)]
lordmetroid_ has joined #ocaml
jarimatti has joined #ocaml
munga has quit ["Ex-Chat"]
postalchris has joined #ocaml
lordmetroid__ has quit [Read error: 110 (Connection timed out)]
smimou has joined #ocaml
filp has joined #ocaml
rwmjones has quit [Read error: 104 (Connection reset by peer)]
jarimatti has quit []
lordmetroid_ has quit [Read error: 110 (Connection timed out)]
filp has quit ["Bye"]
LordMetroid has joined #ocaml
bohanlon has quit [Remote closed the connection]
lordmetroid_ has joined #ocaml
lordmetroid_ has quit [Client Quit]
bohanlon has joined #ocaml
lordmetroid_ has joined #ocaml
LordMetroid has quit [Read error: 110 (Connection timed out)]
lordmetroid_ is now known as LordMetroid
mbishop has quit [Remote closed the connection]
mbishop has joined #ocaml
ygrek has quit [Remote closed the connection]
thelema has quit [Read error: 110 (Connection timed out)]
rwmjones has joined #ocaml
ulfdoz has quit [Remote closed the connection]
ulfdoz has joined #ocaml
lordmetroid_ has joined #ocaml
marmotine has quit ["Quitte"]
LordMetroid has quit [Connection timed out]
vbmithr_ has quit ["zz"]
guillem has quit [Remote closed the connection]
bluestorm has quit [Read error: 113 (No route to host)]
lordmetroid_ has quit [Read error: 110 (Connection timed out)]
Linktim has quit [Remote closed the connection]
shortcircuit_ has joined #ocaml
shortcircuit_ has quit [Client Quit]
tomh has joined #ocaml
dabd has joined #ocaml
postalchris has quit [Read error: 113 (No route to host)]
hkBst has quit ["Konversation terminated!"]
marmotine has joined #ocaml
RobertFischer has quit ["Taking off -- check out http://smokejumperit.com and http://enfranchisedmind.com/blog/"]
Yoric[DT] has quit ["Ex-Chat"]
struk|busy has quit [Read error: 104 (Connection reset by peer)]
struk|busy has joined #ocaml
Morphous_ has quit ["shutdown"]
Amorphous has joined #ocaml
AxleLonghorn has joined #ocaml
AxleLonghorn has left #ocaml []
dabd has quit ["Ex-Chat"]
huh has left #ocaml []
Mr_Awesome has joined #ocaml
rwmjones has quit ["Closed connection"]