02:37:00  * DarkGodquit (Ping timeout: 276 seconds)
04:40:35  * a__quit (Remote host closed the connection)
04:43:41  * a__joined
05:16:53  * SkyRocknRolljoined
05:29:37  * rgrinbergquit (Ping timeout: 260 seconds)
07:30:27  * DarkGodjoined
07:36:28  * a__quit (Ping timeout: 264 seconds)
08:13:07  * sharpobjectquit (Ping timeout: 250 seconds)
08:13:37  * sharpobjectjoined
08:21:31  * rendarjoined
12:21:20  * rgrinbergjoined
14:05:27  * SkyRocknRollquit (Remote host closed the connection)
16:23:14  * SkyRocknRolljoined
17:29:37  <cat5e>creationix, so I heard you write compilers
17:29:48  <creationix>yep
17:30:01  <cat5e>creationix, I need some advice with regards to a parser I'm writing
17:30:27  <cat5e>so there's this thing I'm working on https://github.com/SoniEx2/MDXML
17:30:37  * rgrinbergquit (Ping timeout: 260 seconds)
17:31:47  <cat5e>creationix, any idea how to parse something like this? http://sprunge.us/ELBc
17:36:27  <creationix>like I said before, it looks pretty simple. I don't know how to use lpeg so I'd probably just read a line at a time and match using lua patterns
17:36:39  <creationix>that's what I personally would do
17:36:51  <creationix>but lpeg is probably better once you get over the learning curve
17:37:58  <creationix>since your resulting data is structured you'd either need some sort of recursion or carry around an object simulating the stack and the partial data
17:43:07  <cat5e>creationix, technically I can count > and use that as depth
17:43:24  <cat5e>(altho there are some cases where that fails)
17:43:34  <creationix>sure, I think recursive descent would be simplest code-wise
17:43:39  <creationix>but whatever you feel comfortable with
17:43:52  <creationix>https://en.wikipedia.org/wiki/Recursive_descent_parser
17:45:48  <cat5e>actually no, depth would be simpler
17:46:03  <cat5e>I'd have to skip a number of >'s either way
17:49:24  <cat5e>I mean here's the whole thing basically: local t = {} local depth = -1 while true do local line = nextLine() if isEmpty(line) then depth = -1 else if depth == -1 then depth = getDepth(line) end local _t = t for i=1,depth do _t = _t[#_t] end end end
17:49:40  <cat5e>(oversimplified a bit)
17:50:38  <cat5e>no wait
17:51:18  <cat5e>sorry, more like: local t = {} local depth = 0 while true do local line = nextLine() if isEmpty(line) then depth = 0 else if depth < getDepth(line) then depth = getDepth(line) end local _t = t for i=1,depth do _t = _t[#_t] end end end
17:53:48  <cat5e>creationix, so, *technically*, that edge case I linked is undefined
17:54:16  <creationix>ok
17:54:21  <cat5e>the only thing that's defined is that # denotes a tag, ## denotes an attribute, ### denotes an attribute value, #### denotes a tag namespace and ##### denotes an attribute namespace
17:54:30  <cat5e>the spec says nothing about the ordering
17:55:03  <cat5e>but uh, *because* the spec says nothing about the ordering, that means I can support that if I want
17:55:44  <cat5e>(and yeah I should define that attributes must come after tags and attribute values must come after attributes)
17:56:22  <cat5e>(that still doesn't define that content must come after *all* attributes and values and stuff)
17:57:04  <cat5e>creationix, what do you think?
17:57:09  * rgrinbergjoined
17:57:46  <creationix>It's up to you
17:58:15  <cat5e>ok
17:58:32  <cat5e>creationix, would you use something like this in production? :P
17:58:53  <creationix>I don't really like the language, I find actual XML a lot easier to read and write
17:59:08  <cat5e>ಠ_ಠ
17:59:27  <creationix>that's my opinion, if you like it, go ahead
17:59:51  <creationix>I'm not about to tell anyone they shouldn't make something they want to make
17:59:52  <cat5e>I have issues with reading nested parens (), XML just has named parens which actually makes it worse
18:00:07  <creationix>have you seen haml style encoding?
18:00:07  <cat5e>python is much easier to read for me
18:00:28  <creationix>it's really popular among node template engines (probably because I ported haml to node in the early days)
18:00:48  <creationix>cat5e, for example http://jade-lang.com/
18:04:09  <cat5e>creationix, well it's just as readable I guess...
18:20:12  * rgrinbergquit (Quit: WeeChat 1.5)
18:21:40  * rgrinbergjoined
18:26:25  <creationix>it's basically python style xml
18:27:00  <creationix>it's a little tricky to parse till you realize that you can convert indentation into tokens in the lexer phase
19:24:14  * SkyRocknRollquit (Remote host closed the connection)
19:54:57  * rgrinbergquit (Ping timeout: 244 seconds)
19:58:01  * rgrinbergjoined
20:14:25  * erlbot--quit (Remote host closed the connection)
20:15:10  * erlbot--joined
20:20:20  * rendar_joined
20:21:25  * rendarquit (Disconnected by services)
20:21:50  * rendar_quit (Client Quit)
20:22:05  * rendarjoined
21:51:11  * rgrinbergquit (Ping timeout: 244 seconds)
21:59:28  * rendarquit (Quit: std::lower_bound + std::less_equal *works* with a vector without duplicates!)
22:33:04  * a__joined