code logs -> 2006 -> Thu, 17 Aug 2006< code.20060816.log - code.20060818.log >
--- Log opened Thu Aug 17 00:00:02 2006
00:00
<@ToxicFrog>
It is a P4 variant with, IIRC, slightly more cache, and hyperthreading. (which not all P4 variants have)
00:00
<@Vornicus>
Ok.
00:01 himi-coffee [~himi@Nightstar-29007.ACT.netspace.net.au] has quit [Operation timed out]
00:02 himi-coffee [~himi@Nightstar-29007.ACT.netspace.net.au] has joined #code
00:13
<@Vornicus>
OKay.
00:13
<@Vornicus>
There.
00:21
<@Vornicus>
Good, better, and awesome.
01:03 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has joined #code
01:03 mode/#code [+o Mahal] by ChanServ
01:31 ReivSLEP is now known as Reiver
01:56
<@Vornicus>
Quittin' time.
01:56 Vornicus [~vorn@Nightstar-18307.slkc.qwest.net] has quit [Quit: ]
02:22 * ToxicFrog glares at SciTE.
02:26 * Chalcedon throws her self in the deep end of csv parsing
02:26
<@Chalcedon>
boy am I glad I figured out how to read files yesterday
02:28
<@Reiver>
There's a csv parser out there, IIRC.
02:28
<@Chalcedon>
yeah... and a csv module
02:29
<@Reiver>
Right.
02:29
<@Reiver>
That'll be handy, then.
02:29
<@Reiver>
:)
02:29
<@Chalcedon>
but all I want it to do is parse out a row, parse it into another file, then append the same row out of two more files, then move on to the next row
02:29
<@Chalcedon>
it's not a big deal
02:29
<@Chalcedon>
it's really just copy paste, I just can't figure out how to do it manually cos there's so much bloody data
02:30
<@Chalcedon>
besides, it would take forever and hurt like hell
02:31
<@ToxicFrog>
This sounds like a job for...Awk!
02:31
<@Reiver>
...heh.
02:32
<@ToxicFrog>
...So. Riddle me this.
02:32
<@ToxicFrog>
I have an editor.
02:32
<@ToxicFrog>
This editor is highly configurable, and lets you define text styles for string, character and numeric constants, keywords, type names, etc, etc.
02:33
<@ToxicFrog>
So I do all of this in the global options file, as I am meant to, so that everything will be the colors and styles I am used to.
02:33
<@ToxicFrog>
Why, then, do half the language-specific configuration files override the styles in the global config?
02:33
<@Chalcedon>
can I read more than one file at a time
02:33
<@Chalcedon>
*?
02:33
< himi-coffee>
TF: because they're trying to drive you insane
02:34 * Chalcedon seconds himi
02:34
<@ToxicFrog>
Chalcedon: yes.
02:34
<@Chalcedon>
excellent :) thanks :)
02:34
<@ToxicFrog>
But if you ask me how, in python, I don't remember~
02:34
<@Chalcedon>
open different instances of the reader function?
02:34
<@ToxicFrog>
Reader object.
02:35
<@ToxicFrog>
Yes.
02:35
<@Chalcedon>
that. yes.
02:35
<@ToxicFrog>
I mean, I don't remember the syntax for doing so, etc. The concept is pretty much the same for most languages: open multiple file objects/reader interfaces/file handles/etc.
02:39
<@Chalcedon>
I've downloaded the documentation, so I can figure out most of the syntax. My problem is figuring out what I need to look for usually.
02:41 * ToxicFrog nods.
02:42
<@Vornicus-Latens>
YOu've got one file open, right?
02:42
<@Vornicus-Latens>
You do the same thing - just, give a different variable name.
02:44
<@Chalcedon>
that's what I did
02:44
<@Chalcedon>
I seem to be having difficulty reading though
02:44 * Chalcedon fiddles
02:46
<@Chalcedon>
hrm... that's interesting
02:47
<@Chalcedon>
currently my reader is returning something that isn't in the file...
02:49
<@Chalcedon>
it also seems to be having issues with the for loop
02:49 * Chalcedon is perplexed
02:57 Reiver is now known as ReivWr0k
02:57
<@Chalcedon>
why oh why are you returning letters....
02:57
<@Chalcedon>
the file only has numbers.....
02:59
<@ToxicFrog>
Blargh. I can tell it that stuff that /starts/ with things are a certain type, but not that stuff that /ends/.
03:01
<@ToxicFrog>
Chalcedon: well, what's it returning?
03:02
<@Chalcedon>
its returning a string containing a single letter inside a list
03:02
<@ToxicFrog>
If you have a file containing [[1 2 3]], it may be normal for it to return "1 2 3" or { '1', ' ', '2', ' ', '3', '\n' } rather than 1,2,3
03:02
<@ToxicFrog>
o.O
03:03
<@Chalcedon>
letters are e, t, c and v (in that order) file contains 1,1,0,1 etc
03:03
<@Chalcedon>
I don't understand how it's interpreting numbers as letters
03:04
<@Chalcedon>
the other examples I could understand, maybe even deal with but this seems bizarre.
03:04
<@ToxicFrog>
03:04
<@ToxicFrog>
That's v. odd.
03:04
<@ToxicFrog>
Paste the code?
03:05
<@Chalcedon>
def readLine():
03:05
<@Chalcedon>
f = reader('test.csv', dialect='excel')
03:05
<@Chalcedon>
for row in f:
03:05
<@Chalcedon>
line = f.next()
03:05
<@Chalcedon>
print line
03:05
<@ToxicFrog>
Shouldn't dialect be 'csv'?
03:06
<@Chalcedon>
I don't think so, but I'll try it (csv's have different dialects depending on how they're created)
03:06
<@Chalcedon>
no, doesn't like that.
03:06 * ToxicFrog is just guessing here.
03:06
<@ToxicFrog>
Argh, I need Vorn's mad SciTE-fu.
03:07 * Chalcedon hugs TF, profers cookies
03:07 * ToxicFrog bribes libscintilla with cookies until it offers him regex-based lexing.
03:08
<@Chalcedon>
heh
03:08
<@Chalcedon>
the old kick it in the seat of the pants trick doesn't work either
03:08
<@ToxicFrog>
This irrates me so much.
03:08
<@ToxicFrog>
SciTE has so many awesome features that NEdit doesn't.
03:08
<@Chalcedon>
hence why you're still up at a ridiculous hour?
03:09
<@ToxicFrog>
But the actual syntax highlighting stuff, compared to NEdit's, is weaksauce!
03:09
<@ToxicFrog>
...it's 2205.
03:09
<@ToxicFrog>
Hardle ridiculous.
03:09
<@Chalcedon>
oh, ok, I thought it was like 2am
03:09 * Chalcedon readjusts her memory of TF's timezone
03:10
<@Chalcedon>
duh.. you're five hours behind britain.
03:10
<@Chalcedon>
what are SciTE and NEdit anyway?
03:11
<@ToxicFrog>
Source editors.
03:11
<@ToxicFrog>
NEdit has obscenely powerful ERE-based syntax highlighting features, but isn't terribly extensible otherwise.
03:12
<@ToxicFrog>
SciTE has slews of IDE-like integration features, but the syntax highlighting is keyword-based with binary lexers.
03:14
<@Chalcedon>
and I suppose ideally you really want both bits to work well?
03:15
<@ToxicFrog>
Yes.
03:15
<@ToxicFrog>
Basically, I want SciTE, with NEdit's text rendering engine instead of Scintilla's.
03:17
<@Chalcedon>
:s
03:17
<@ToxicFrog>
As it is, I can specify stuff with keywords...so I have, for example, a list of all the C keywords, and a list of all the C types.
03:17
<@Chalcedon>
good luck?
03:17
<@ToxicFrog>
But I also want it to, for example, hilight anything ending with _t as a type as well.
03:17
<@ToxicFrog>
And hilight anything of the form foo(...) as a function call.
03:17
<@ToxicFrog>
And so forth.
03:17
<@ToxicFrog>
And it can't do that.
03:18
<@ToxicFrog>
At least, as far as I can tell.
03:19
<@Chalcedon>
:s
03:19
<@Vornicus-Latens>
I do not have much SciTE-fu.
03:20
<@ToxicFrog>
Woe.
03:21
<@Vornicus-Latens>
Frankly I have little editor-fu period.
03:21
<@Vornicus-Latens>
Which is something I must remedy, eventually.
03:22
<@Vornicus-Latens>
--the extent of my customization of Eclipse, for instance, is to use Skia.
03:23
<@Chalcedon>
I wonder if I'm having problems because python doesn't recognise the dialect?
03:23
<@ToxicFrog>
I /have/ found a generic regex-based lexer (and speaking of, why the hell do they call them lexers when they plainly are not), but it does not appear to be in the main branch or indeed even up to date. And of course I have to recompile the entire thing to use it ;'.;
03:23
<@Vornicus-Latens>
Chalcy: "dialect"?
03:23
<@Chalcedon>
csv reader/writer has a dialect bit
03:24
<@Vornicus-Latens>
oh, yes.
03:24
<@Vornicus-Latens>
You must tell it what dialect you're using. It is probably Excel.
03:24
<@Chalcedon>
I did tell it that, but well, it still wont work properly
03:24
<@Vornicus-Latens>
...gnar.
03:24
<@Chalcedon>
I've used excel to generate it, but it doesn't recognise it.
03:25
<@Chalcedon>
(has a get_dialect() as well)
03:26
<@Vornicus-Latens>
I don't know, then.
03:27 * Chalcedon hrm
03:28
<@ToxicFrog>
Argh. And external lexer modules are not source-compatible with builtins, so I'd have to rewrite very large chunks of it to make it a loadable DLL.
03:28
< himi-coffee>
Why are you using this?
03:29
<@ToxicFrog>
Is that directed at me, or Chalcy? And if the former, what do you mean by 'this'? SciTE?
03:31
< himi-coffee>
You
03:32 * himi-coffee sighs
03:32
< himi-coffee>
Fujitsu service is /shit/
03:33 * Chalcedon supplies himi with a cookie
03:33 * Chalcedon nrom one herself
03:34
<@ToxicFrog>
Ok, assuming that you meant SciTE since you didn't clarify - I'm using it because it has many interesting features that NEdit lacks, and which cannot be added to NEdit without extensive source modification.
03:34
< himi-coffee>
Sounds good
03:34
<@ToxicFrog>
I'm foaming at it because there is one place where NEdit simply walks all over it, and that's the actual text rendering engine itself.
03:34
< himi-coffee>
Possibly a better question, then, would be why are you using nedit?
03:35
<@ToxicFrog>
Because NEdit's text rendering engine kicks vast amounts of ass and I've been using it for years, whereas I only learned about SciTE a few days ago.
03:36
<@ToxicFrog>
The things SciTE does that NEdit doesn't are all IDE-like things - code folding, shortcuts for compile, build and run, matching error messages in the compiler or terp to lines in the editing pane, that sort of thing.
03:36 * himi-coffee is used to this particular argument being between emacs/vi/vim/jed/etc . . .
03:37
<@Vornicus-Latens>
Except that he's arguing with himself.
03:37
<@ToxicFrog>
Yes. Because I'm trying to settle on an editor, and the conclusion I keep coming to is "I must remove Scintilla from SciTE with a pickaxe and replace it with NEdit's engine"
03:38
<@ToxicFrog>
Which is not practical.
03:38
< himi-coffee>
I take it SciTE is proprietary?
03:38
<@ToxicFrog>
No, it's OSS, as is Scintilla itself.
03:39
<@ToxicFrog>
I just don't have the time, especially when you consider that this means rewriting big chunks of NEdit's engine (which uses, IIRC, motif, whereas SciTE uses gtk)
03:39
< himi-coffee>
. . . . . an OSS editor that uses /binary/ plugins and /doesn't/ support regex based highlighting decisions?
03:40
< himi-coffee>
Them's some odd design decisions
03:40
<@ToxicFrog>
Binary plugins are kind of a given, unless you give it a built in scripting VM.
03:40
<@ToxicFrog>
Which in fact it has, but not enough of one to implement the features I want.
03:41
< himi-coffee>
. . . . . plug in lua
03:41
<@ToxicFrog>
That's the scripting VM.
03:41
<@Vornicus-Latens>
I gather that the problem is that none of the hooks get him to the rendering pipeline.
03:41
< himi-coffee>
So implement the highlighting in lua!
03:41
< himi-coffee>
Oh
03:41
<@ToxicFrog>
himi-coffee: as I said, I can't do that!
03:41
< himi-coffee>
Bummer
03:42
<@Vornicus-Latens>
SHOPING
03:42
<@ToxicFrog>
I don't have access to the rendering pipeline from there, nor do I have access to the rendering /event/.
03:42 * Vornicus-Latens goes shoping.
03:42
<@ToxicFrog>
Lack of regex-based hilighting decisions I honestly can't figure out. The design paradigm here appears to be that if you want support for another language, you write a set of C functions that take blocks of text and tell the caller how it should be categorized,
03:42
<@ToxicFrog>
Then you either link these with the editor at build time, or turn them into a DSO that the editor loads at runtime.
03:42
< himi-coffee>
That's . . . . stupid
03:43
< himi-coffee>
Remarkably stupid, really
03:43
<@ToxicFrog>
This is advantageous if you are using some completely, batshit insane language that cannot be effectively described in EREs, a characteristic shared by precisely 0 of the languages supported by either SciTE or NEdit.
03:43
< himi-coffee>
That's the /only/ editor that I can think of
03:43
< himi-coffee>
that does that
03:43
<@ToxicFrog>
Thus, I have no option but to classify this design decision as "bugfuck"
03:43
<@ToxicFrog>
Himi: DevCPP, MSDev.
03:43
<@ToxicFrog>
Both of those have hardcoded hilighting engines AFAIR.
03:44
< himi-coffee>
Aren't those IDEs, though?
03:44
< himi-coffee>
And proprietary ones at that?
03:44
<@ToxicFrog>
DevCPP is OSS.
03:44
< himi-coffee>
Oh
03:44 * himi-coffee isn't familiar with it
03:44
<@ToxicFrog>
Both are IDEs, but so is SciTE to some extent.
03:44
< himi-coffee>
But I mean, if you've already got lua embedded, you can use /that/ to make your decisions
03:44
<@ToxicFrog>
And "it's an IDE" does not imply "so the part of it that's an editor is allowed to be crap"
03:45
< himi-coffee>
For any case beyond what a regex can handle
03:45
< himi-coffee>
Well sure
03:45
< himi-coffee>
But it does tend to result in this, doesn't it?
03:47 * Chalcedon thwap herself
03:47
<@Chalcedon>
RTFM!!!!!!!!!!
03:48
<@ToxicFrog>
Anyways. The Lua interface lets you do a bunch of stuff, including modifying the existing text colorization rules, but it doesn't let you colorize text directly.
03:48
<@ToxicFrog>
...
03:48
<@ToxicFrog>
Although.
03:49
<@ToxicFrog>
I think I may be able to fake it.
03:49 * Chalcedon quietly excuses herself...
03:49 * Mahal huggles Chalcedon
03:50
<@Chalcedon>
ty Mahal :)
03:50
<@ToxicFrog>
Specifically, I define initially empty properties for things like function calls, tables, etc, with associated styles.
03:50
<@ToxicFrog>
Then I write Lua code that checks for matches against the appropriate regexes.
03:50
<@ToxicFrog>
When it gets a match, it adds it as a literal to the appropriate property.
03:51
<@ToxicFrog>
So ugly, though!
03:54
< himi-coffee>
Indeed
03:56
<@ToxicFrog>
..oh, hey. It exposes the Scintilla:Iface functions, or at least most of them.
03:56
<@ToxicFrog>
Which are completely undocumented, so off to the header file I go
04:02
<@ToxicFrog>
Hot damn.
04:02
<@ToxicFrog>
editor:SetStyling() is exactly what I need, I think.
04:02
<@ToxicFrog>
It's not true EREs, which will make life slightly difficult, but close enough.
04:08
<@ToxicFrog>
...ok, so. The Lua extension is mentioned extensively on the official site and even documented there.
04:08
<@ToxicFrog>
So where the hell is it?
04:16
<@Chalcedon>
its aliiiiiiiiiiiiivvvvveeee!
04:16
<@Mahal>
Whohoo, Chalcedon !
04:22
<@Chalcedon>
w00t it even works properly
04:22 * Chalcedon has the correct number of columns
04:33 Vornicus-Latens is now known as Vornicus
05:06
<@Mahal>
Reiver: ETA on the wiki, Vorny?
05:07
<@Mahal>
He is asking me to relay via gtalk to im.
05:07
<@Vornicus>
I called today but apparently the folks I need to talk to had left early.
05:07
<@Mahal>
Relayed.
05:08
<@Vornicus>
So I left a message.
05:18
<@Mahal>
:17] Reiver: *huggles the poor vorny*
05:43 himi-coffee is now known as himi-banking
06:27 ReivWr0k is now known as Reiver
06:45 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Ping Timeout]
07:49 himi-banking is now known as himi-appointmenting
08:09 Reiver is now known as ReivF0d
08:27 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code
08:32 Vornicus is now known as Vornicus-Latens
08:41 ReivF0d is now known as Reiver
09:41 nice_n_smooth_1 [~Changethi@124.197.11.ns-2849] has joined #Code
09:49 nice_n_smooth_1 [~Changethi@124.197.11.ns-2849] has left #Code []
09:50 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has quit [Quit: It's hard to be mad at someone who misses you while you're asleep. ]
09:51 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has joined #code
09:51 mode/#code [+o Mahal] by ChanServ
09:52 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has quit [Quit: It's hard to be mad at someone who misses you while you're asleep. ]
09:53 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has joined #code
09:53 mode/#code [+o Mahal] by ChanServ
09:54 Mahal is now known as MahalTest
09:54 MahalTest is now known as Mahal
09:59 himi-appointmenting is now known as himi-FotR
12:07 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has quit [Quit: bedtime]
12:17 EvilDarkLord is now known as EvilPirateLord
12:29 EvilPirateLord is now known as EvilDarkLord
14:23 Reiver is now known as ReivZzz
14:25
<@ToxicFrog|AFK>
Vornicus-Latens: what wiki is this?
14:29
< Serah>
The almighty wiki.
14:31
<@ReivZzz>
The wiki, TF.
14:31
<@ReivZzz>
(Theonewiki, Vorns wiki, the D&D wiki?)
14:32
<@ToxicFrog|AFK>
Aah.
14:32
<@ToxicFrog|AFK>
I was thinking a #codewiki.
14:34
< Serah>
It can be used for that with Vorn's consent.
14:48 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
14:49 mode/#code [+o Chalcy] by ChanServ
14:50 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
16:04 Syloqs-AFH [Syloq@NetAdmin.Nightstar.Net] has quit [Connection reset by peer]
16:16 Vornicus-Latens [~vorn@Nightstar-25742.veracitycom.net] has quit [Connection reset by peer]
16:25 EvilDarkLord is now known as I
16:28 I is now known as T3hC00kieM0nster
16:29 T3hC00kieM0nster is now known as EvilDarkLord
16:36 ToxicFrog|AFK is now known as ToxicFrog|W`rkn
16:40 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Killed (NickServ (GHOST command used by Shemhazai))]
16:40 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code
16:43 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Killed (NickServ (GHOST command used by Shemhazai))]
16:44 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code
16:46 Syloq [Syloq@NetAdmin.Nightstar.Net] has joined #code
17:06 Vornotron [~vorn@Nightstar-18307.slkc.qwest.net] has joined #code
17:17
< Vornotron>
bash guru required: I need to ensure that a particular process is a singleton.
17:18
< Vornotron>
That, rather, my script's process is a singleton.
17:22
<@ToxicFrog|W`rkn>
As in, that it's the only instance of that script?
17:22
<@ToxicFrog|W`rkn>
Is a search based on script name acceptable, or do we actually have to read process memory?
17:23
<@ToxicFrog|W`rkn>
(and/or dereference symlinks)
17:25
<@ToxicFrog|W`rkn>
if pgrep "$0" >/dev/null; then
17:25
<@ToxicFrog|W`rkn>
# there's another instance of this script running
17:25
<@ToxicFrog|W`rkn>
else
17:25
<@ToxicFrog|W`rkn>
...wait, no.
17:26
< Serah>
Bash is just Unix.
17:26
< Serah>
Innit?
17:26
<@ToxicFrog|W`rkn>
No, bash is an actual programming language.
17:26
< Serah>
Oh. That kind of bash.
17:26
<@ToxicFrog|W`rkn>
It's /also/ a Bourne-compatible shell common on Linux and Unix systems.
17:26
<@ToxicFrog|W`rkn>
Which is an interpreter for the bash language.
17:27
<@ToxicFrog|W`rkn>
Alright, I believe I have it.
17:27
<@ToxicFrog|W`rkn>
if [ `pgrep "$0" | wc -l` -gt 1 ]; then
17:27
<@ToxicFrog|W`rkn>
# there's >1 of us running, counting this instance
17:27
<@ToxicFrog|W`rkn>
else
17:27
<@ToxicFrog|W`rkn>
# there's exactly 1, this instance
17:27
<@ToxicFrog|W`rkn>
fi
17:28 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
17:28
<@ToxicFrog|W`rkn>
This doesn't appear to work on Cygwin, though; pgrep barfs. But you can roll your own with ps and grep.
17:31
<@ToxicFrog|W`rkn>
Vornotron: does that help?
17:31
< Vornotron>
Yes, it does.
17:32 * Serah cheers for froggy.
17:37 * ToxicFrog|W`rkn bows
17:38 * ToxicFrog|W`rkn starts dissecting NEdit's syntax hilighting logic
17:41
<@ToxicFrog|W`rkn>
...oh my god, they wrote their own implementions of regexec() and regcomp().
17:42 Netsplit DeepThought.NY.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: Vornotron, @ReivZzz, @jerith, Reivlin, @Chalain
17:42
<@ToxicFrog|W`rkn>
!!
17:44 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Ping Timeout]
17:44 mode/#code [+o jerith] by ChanServ
17:44 Netsplit over, joins: jerith
17:44 Chalain [~chalain@Admin.Nightstar.Net] has joined #Code
17:44 Netsplit over, joins: Reivlin, ReivZzz
17:44 mode/#code [+o Chalain] by ChanServ
17:44 Netsplit over, joins: Vornotron
17:44 mode/#code [+o ReivZzz] by ChanServ
17:45 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code
17:46
<@ToxicFrog|W`rkn>
Wibs, Serah and all netsplit victims.
17:51
<@ToxicFrog|W`rkn>
Ok, NEdit's hilighting engine is even more powerful than I remembered, and implementing it as a SciTE lexer may involve making sacrifices to Azathoth and begging for the merciful annihilation of everything that is.
17:51
<@ToxicFrog|W`rkn>
But I'm going to do it anyways~
17:51
< Vornotron>
THat's the TF I know.
17:52
<@ToxicFrog|W`rkn>
(it actually understands four different kinds of pattern - pass-one, pass-two, subpattern, and capture. Pass-one and pass-two I can safely glom together into one category, the others will be somewhat more interesting)
17:54
< Vornotron>
(one thing I've always wanted is a very pale backing to variables, based on the hash of the name.)
17:56
<@ToxicFrog|W`rkn>
(that's doable, although it implies some way to distinguish variables from everything else)
17:57
< Vornotron>
(true - in most languages this isn't a problem. Ruby, on the other hand, is a different sack of potatoes.)
17:57
<@ToxicFrog|W`rkn>
(indeed).
17:57
<@ToxicFrog|W`rkn>
...snrk.
17:57
<@ToxicFrog|W`rkn>
* BEWARE that some of this code is subtly aware of the way operator
17:58
<@ToxicFrog|W`rkn>
* precedence is structured in regular expressions. Serious changes in
17:58
<@ToxicFrog|W`rkn>
* regular-expression syntax might require a total rethink.
17:58
<@ToxicFrog|W`rkn>
* -- Henry Spencer
17:58
<@ToxicFrog|W`rkn>
* (Yes, it did!) -- Christopher Conrad, Dec. 1999
17:58
< Vornotron>
Okay, that's a good one.
18:10
< Vornotron>
(apropos of nothing: you win the game in AW by killing your opponent's last unit, even if he still controls bases that can generate units.
18:10
< Vornotron>
(I find that a bit odd.)
18:12
<@ToxicFrog|W`rkn>
(so do I)
18:12
< Vornotron>
(on the other hand, if he's out of units and you're standing on his bases, that should be an endgame)
18:13
<@ToxicFrog|W`rkn>
(or out of offensive units, or out of offensive units capable of attacking the units on the bases, or...etc)
18:13
<@ToxicFrog|W`rkn>
Ok, the logic for this is going to be twisted.
18:13
< Vornotron>
which this?
18:14
< Vornotron>
and why is it twisted?
18:14
<@ToxicFrog|W`rkn>
Well. A language spec consists of a list of rules.
18:14
<@ToxicFrog|W`rkn>
Each rule consists of:
18:14
<@ToxicFrog|W`rkn>
- a starting regex
18:14
<@ToxicFrog|W`rkn>
- an optional ending regex
18:14
<@ToxicFrog|W`rkn>
- an option list of subrules
18:14
<@ToxicFrog|W`rkn>
- a lexical type to flag matching text as
18:16
<@ToxicFrog|W`rkn>
The basic behaviour of this is that if something just has a starting regex, whatever that matches is of this type; if it has start and end, everything between them (and their matches) is of this type.
18:16
<@ToxicFrog|W`rkn>
If it has subrules, those rules are then applied to the text of this type.
18:16
<@ToxicFrog|W`rkn>
(for example, the rule for cstrings is start [["]], end [["]], subrule 'escaped character' [[\\.]])
18:18
<@ToxicFrog|W`rkn>
And any text that doesn't match any of the rules is simply set to the default lexical type and otherwise skipped.
18:18
<@ToxicFrog|W`rkn>
What makes it twisted is that I'm not necessarily examining the whole file at once.
18:18
<@ToxicFrog|W`rkn>
I'm handed a block of text and told "lex this"
18:19
< Vornotron>
....oh god.
18:19
<@ToxicFrog|W`rkn>
So in addition to the above, I also have to examine the existing lexical type properties of the text I'm passed to determine what state I should be in...
18:20
<@ToxicFrog|W`rkn>
And it's entirely possible to be handed a block of text that starts or ends halfway through a token.
18:22
<@ToxicFrog|W`rkn>
It's not pretty.
18:27
<@ToxicFrog|W`rkn>
...oh, hey.
18:27
<@ToxicFrog|W`rkn>
Looking at some existing lexers, it's actually not that bad.
18:27
<@ToxicFrog|W`rkn>
You /can/ access the rest of text.
18:28
<@ToxicFrog|W`rkn>
You're passed in stuff you have to color, but are given the rest for examination if necessary.
18:30
< Vornotron>
Is this the NEdit lexer, or the Scintilla lexer?
18:30
<@ToxicFrog|W`rkn>
Scintilla.
18:30
< Vornotron>
aha
18:31
<@ToxicFrog|W`rkn>
The NEdit lexer was copied from the walls of R'lyeh, but fortunately you don't actually have to look at the source to extend it; it's entirely controlled by EREs.
18:31
<@ToxicFrog|W`rkn>
Which is the capability I'm attempting to add to SciTE.
18:33
<@ToxicFrog|W`rkn>
I love the way libscintilla is completely undocumented, though.
18:33
< Vornotron>
This should be rectified.
18:34
<@ToxicFrog|W`rkn>
(well, not /completely/. But there's no documentation for most of it, including things like the StyleContext class, and what documentation there is tends to be very sketchy)
18:46
<@ToxicFrog|W`rkn>
Ok, it looks like here's what I have:
18:46
<@ToxicFrog|W`rkn>
- I know the block starts on the start of a line
18:46
<@ToxicFrog|W`rkn>
- I know the lexical type of the character immediately preceding the block, which will be the linefeed at the end of the previous line
18:47
<@ToxicFrog|W`rkn>
...shit.
18:47
<@ToxicFrog|W`rkn>
I don't know the lexical type.
18:48
<@ToxicFrog|W`rkn>
I know the style index.
18:48
<@ToxicFrog|W`rkn>
If I have multiple types (eg, "string and 'string) mapping to the same display style (eg, string literal), I can't tell which one.
18:48
<@ToxicFrog|W`rkn>
Fux0r.
19:01
<@ToxicFrog|W`rkn>
I am starting to see why this has not been done before.
19:04
< Vornotron>
What are you lexing?
19:04
<@ToxicFrog|W`rkn>
Whatever the user specifies with regexes.
19:04
< Vornotron>
ah
19:04
<@ToxicFrog|W`rkn>
That's the entire point of this project, to let people define a language in terms of regex->style mappings, rather than writing a binary lexer for it.
19:06
< Vornotron>
So you don't have a specific lexer, you have a generic lexer that does scary things.
19:06
<@ToxicFrog|W`rkn>
Yes.
19:06
< Vornotron>
OKay.
19:07
<@ToxicFrog|W`rkn>
The idea is that once this is written an installed, you can write a language spec and choose "regex" as the lexer to use.
19:07
<@ToxicFrog|W`rkn>
And then, rather than using keyword lists and the like, you set up lists of regex->style mappings.
19:08
<@ToxicFrog|W`rkn>
And there's all kinds of nasty potential cases.
19:09
<@ToxicFrog|W`rkn>
For example, regexec() returns the first match of the corresponding regex in the given string.
19:09
<@ToxicFrog|W`rkn>
So if you have:
19:09
<@ToxicFrog|W`rkn>
int foo; /* scratch space */
19:10
<@ToxicFrog|W`rkn>
And then you regexec() on that with the 'comment' regex, it skips over the 'int foo'. So for a given string you basically have to run all regexes on it, then pick the one that starts earliest, skip to the end of it and continue.
19:11
<@ToxicFrog|W`rkn>
Although...hmm.
19:12
<@ToxicFrog|W`rkn>
Ok, here's an algo for it.
19:13
<@ToxicFrog|W`rkn>
Iterate over the list of rules. When one matches:
19:13
<@ToxicFrog|W`rkn>
- if it starts at the beginning of the string, flag it accordingly, skip to the end of the match and break
19:13
<@ToxicFrog|W`rkn>
Err. Flag it accordingly, mark everything after it as SCE_DEFAULT, and break.
19:14
<@ToxicFrog|W`rkn>
- if it starts earlier than the previous earliest match, make this the new earliest match, flag the match accordingly, skip to the end, flag everything after it as SCE_DEFAULT and break.
19:15
<@ToxicFrog|W`rkn>
Argh. No skip to the end.
19:15
<@ToxicFrog|W`rkn>
Turning this into works is harder than it looks in my head.
19:15
<@ToxicFrog|W`rkn>
Into words.
19:15
< Vornotron>
heh
19:15
< Vornotron>
And people wonder why the flowchart exists.
19:17
<@ToxicFrog|W`rkn>
Aaanyways. When done, what we should have is: zero or more characters with SCE_DEFAULT, which matched no pattern; an optional block of flagged characters which were the first-occuring rule match; and the cursor positioned at the end of this block.
19:17
<@ToxicFrog|W`rkn>
And, if no matches occurred at all, it's all SCE_DEFAULT and the cursor is at the end.
19:19
<@ToxicFrog|W`rkn>
Although this means that if we change something we end up relexing everything from that to the end of the file.
19:20
<@ToxicFrog|W`rkn>
There's got to be a better way.
19:20
< Vornotron>
In a certain sense you have to do that anyway.
19:20
< Vornotron>
If we change something, we change the state of things nearby.
19:20
<@ToxicFrog|W`rkn>
Yes.
19:21
<@ToxicFrog|W`rkn>
But I know you don't actually have to process all the rest of the file; otherwise NEdit would be unusable on large files.
19:21
< Vornotron>
And we change the state of things all the way to the end, if we can't...
19:21
< Vornotron>
uh.
19:21 * Vornotron tries to figure out how to describe it
19:22
< Vornotron>
you need to, almost, build the AST and figure out a way to tell when you're done applying the changes.
19:24
<@ToxicFrog|W`rkn>
The problem being that I don't have an AST.
19:24
< Vornotron>
indeed.
19:25
< Vornotron>
But you do have leaves and nodes, as defined by pre- and post- regexes.
19:27
<@ToxicFrog|W`rkn>
Um?
19:27
< Vornotron>
11:13:49] <ToxicFrog|W`rkn> - a starting regex
19:27
< Vornotron>
[11:13:52] <ToxicFrog|W`rkn> - an optional ending regex
19:27
< Vornotron>
[11:13:57] <ToxicFrog|W`rkn> - an option list of subrules
19:27
< Vornotron>
[11:14:09] <ToxicFrog|W`rkn> - a lexical type to flag matching text as
19:28
< Vornotron>
A thing with only a starting regex, it is a leaf. You consume the whole thing.
19:28
< Vornotron>
A thing with an ending regex, it is a container.
19:28
<@ToxicFrog|W`rkn>
Something with only a start can also contain subrules, I note.
19:28
< Vornotron>
what do subrules do?
19:28
<@ToxicFrog|W`rkn>
(Hmm. One possibility is to break it apart by lines, which appears to be what nedit does.)
19:29
<@ToxicFrog|W`rkn>
They only apply inside the rule that contains them.
19:29
< Vornotron>
hm
19:29
<@ToxicFrog|W`rkn>
They also modify the rule that contains them.
19:29 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
19:29 mode/#code [+o Chalcy] by ChanServ
19:31
<@ToxicFrog|W`rkn>
Hmm
19:31
<@ToxicFrog|W`rkn>
.And there's subtleties in NEdit's behaviour I still don't grok.
19:31 * Vornotron fiddles with svn and grep.
19:34
<@ToxicFrog|W`rkn>
For example, [["[^"]*"]] matches everything after the first " in the file.
19:34
<@ToxicFrog|W`rkn>
Which is v. not right.
19:35
< Vornotron>
Uh
19:35
< Vornotron>
oh, yeah, it's not right. daah.
19:36 * Vornotron can read.
19:39 * Vornotron suxxorz at grep.
19:40
<@ToxicFrog|W`rkn>
Hmm. The regexec(3) documentation doesn't say whether it spans line boundaries or not.
19:40
<@ToxicFrog|W`rkn>
But I think I can get way with arbitrarily saying that regexes do not cross lines.
19:41
<@ToxicFrog|W`rkn>
Which means that if you reach the end of a line, which is at or past the end of the segment that needs recoloring, and the status of the EOL hasn't changed as a result of your lexing, you can stop.
19:42 Netsplit DeepThought.NY.US.Nightstar.Net <-> Troika.TX.US.Nightstar.Net quits: Vornotron, @ReivZzz, @jerith, Reivlin, @Chalain
19:42
<@ToxicFrog|W`rkn>
Goddamit, Troika.
19:44 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has quit [Ping Timeout]
19:44 Netsplit over, joins: jerith, Chalain, Reivlin
19:44 mode/#code [+o jerith] by ChanServ
19:44 Netsplit over, joins: ReivZzz
19:44 mode/#code [+o Chalain] by ChanServ
19:44 Netsplit over, joins: Vornotron
19:44 mode/#code [+o ReivZzz] by ChanServ
19:44
<@ToxicFrog|W`rkn>
14:38 <ToxicFrog|W`rkn> Hmm. The regexec(3) documentation doesn't say whether it spans line boundaries or not.
19:44
<@ToxicFrog|W`rkn>
14:38 <ToxicFrog|W`rkn> But I think I can get way with arbitrarily saying that regexes do not cross lines.
19:44
<@ToxicFrog|W`rkn>
14:39 <ToxicFrog|W`rkn> Which means that if you reach the end of a line, which is at or past the end of the segment that needs recoloring, and the status of the EOL hasn't changed as a result of your lexing, you can stop.
19:44
<@ToxicFrog|W`rkn>
Also, [[/\*.*\*/]] matches nothing. Wtf?
19:44 Serah [~Shemhazai@Nightstar-8502.ds1-ba.adsl.cybercity.dk] has joined #Code
19:46
<@ToxicFrog|W`rkn>
Aha. Because regexes /don't/ cross line boundaries.
19:47 Syloq is now known as Syloqs-AFH
19:51
<@ToxicFrog|W`rkn>
I think I may have the lexing logic worked out!
19:52
< Vornotron>
...why is Grep not recognizing +?
19:53
<@ToxicFrog|W`rkn>
That is a very good question.
19:53
<@ToxicFrog|W`rkn>
Oh, wait.
19:53
<@ToxicFrog|W`rkn>
Grep, or egrep?
19:53
< Vornotron>
grep
19:53
< Vornotron>
do I need to use egrep to use +?
19:53
<@ToxicFrog|W`rkn>
14:38 <ToxicFrog|W`rkn> Hmm. The regexec(3) documentation doesn't say whether it spans line boundaries or not.
19:53
<@ToxicFrog|W`rkn>
Erm.
19:53
<@ToxicFrog|W`rkn>
14:38 <ToxicFrog|W`rkn> But I think I can get way with arbitrarily saying that regexes do not cross lines.
19:53
<@ToxicFrog|W`rkn>
14:39 <ToxicFrog|W`rkn> Which means that if you reach the end of a line, which is at or past the end of the segment that needs recoloring, and the status of the EOL hasn't changed as a result of your lexing, you can stop.
19:54
<@ToxicFrog|W`rkn>
http://www.greenend.org.uk/rjk/2002/06/regexp.html
19:54
<@ToxicFrog|W`rkn>
Bastard windows C/P interface.
19:54
<@ToxicFrog|W`rkn>
+ is an ERE feature; plain grep uses BREs.
19:54
< Vornotron>
ok
19:54
< Vornotron>
...that's an awesome page.
19:54
<@ToxicFrog|W`rkn>
It is one of my many tiny gods, yes.
19:57 * Vornotron bookmarkinates.
19:57
< Vornotron>
I need to make a developers wiki.
19:57
< Vornotron>
Just to put all this crap on.
19:58
< Vornotron>
...indeed, I got my new publicly routable IP address now, so I can do just that.
19:58
< Vornotron>
...though, uh, later, when I get home.
19:58
< Vornotron>
HEY REIVER GOOD NEWS
19:58
<@ToxicFrog|W`rkn>
Or we could just put it on wikia or something.
20:00
< Vornotron>
...I completely forgot about the existence of wikia.
20:02
<@ToxicFrog|W`rkn>
I only found out about it a few days ago.
20:03
< Vornotron>
I've known about it for a while.
20:03
<@ToxicFrog|W`rkn>
code.wikia.com doesn't appear to exist~
20:03
< Vornotron>
GET IT NOQW
20:03
< Vornotron>
NOW
20:04
<@ToxicFrog|W`rkn>
It appears to not be that timple.
20:04
<@ToxicFrog|W`rkn>
*simple.
20:05
<@ToxicFrog|W`rkn>
It needs a mission statement and stuff ;.;
20:06
<@ToxicFrog|W`rkn>
And it takes 2-10 days to be created.
20:07
<@ToxicFrog|W`rkn>
On whole, wrestling bare-editored with the regex lexer sounds more fun~
20:07
< Vornotron>
Heh
20:07
< Vornotron>
I'll just set one up when I get home.
20:07
<@ToxicFrog|W`rkn>
On your local box, you mean?
20:15
< Vornotron>
yeah
20:15
< Vornotron>
I am not a marketroid, I cannot write a mission statement.
20:15
< Vornotron>
And I am not that patient.
20:17
<@ToxicFrog|W`rkn>
Likewise.
20:32 Chalcy is now known as Chalcedon
20:32 * ToxicFrog|W`rkn greets Chalcy with a toasted ERE
20:33
<@Chalcedon>
toasted ERE?
20:33
<@Chalcedon>
what is this?
20:35
<@ToxicFrog|W`rkn>
Well, first you take a regular expression.
20:35
<@ToxicFrog|W`rkn>
Then you set REG_EXTENDED to turn it into an Extended Regular Expression.
20:35
<@ToxicFrog|W`rkn>
Then you toast it for five minutes in regcomp().
20:36
<@ToxicFrog|W`rkn>
And then you eat it!
20:38
<@Chalcedon>
ok
20:38 * Chalcedon munches
20:39
<@ToxicFrog|W`rkn>
(you are familiar with regexes, yes?)
20:45
<@Chalcedon>
no, not really, are they what they sound like, or are they something else in disguise?
20:45
<@ToxicFrog|W`rkn>
What do they sound like?
20:45
<@ToxicFrog|W`rkn>
What they are is the single most powerful text matching tool known to man.
20:46
<@Chalcedon>
no, thats not what I was thinking of, but it kinda makes sense.
20:46
<@ToxicFrog|W`rkn>
If a text editor's find feature is a flashlight, regexes are orbital solar mirrors capable of melting continents.
20:46
<@Chalcedon>
hehe
20:47
<@Chalcedon>
sounds handy, I could do with one of those
20:47
<@ToxicFrog|W`rkn>
The regex, or the orbital solar mirror?~
20:47
<@Chalcedon>
the regex
20:47
<@ToxicFrog|W`rkn>
Aah.
20:47
<@ToxicFrog|W`rkn>
Yes, they are the tool of choice for text processing, and are the key to grep, sed and awk.
20:47
<@Chalcedon>
the orbital solar mirror sounds cool, but it'd make a big mess
20:48
<@Chalcedon>
I know awk is a language, are the other two as well?
20:48
<@ToxicFrog|W`rkn>
One of the things I like about NEdit is that it lets you describe syntax hilighting rules in terms of regexes - so, for example, you can say that anything matching the regex u?int(8|16|32|64)_t should be colored as a basic type.
20:49
<@ToxicFrog|W`rkn>
Awk is both a tool, and the language used by that tool.
20:49
<@Chalcedon>
ah, right.
20:49
<@ToxicFrog|W`rkn>
grep and sed are just tools. Sed (Stream EDitor) can do lots of interesting stuff, but the feature that gets 99% of the use is find-replace using regexes.
20:49
<@ToxicFrog|W`rkn>
Grep just searches for stuff in files, using regexes.
20:50
<@ToxicFrog|W`rkn>
This is a rather big "just" and I have a whole bunch of aliases for quickly invoking grep in various ways because I use it so much~
20:50 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has joined #code
20:50 mode/#code [+o Mahal] by ChanServ
20:50
<@Chalcedon>
morning Mahal !
20:51
<@Mahal>
Morning!
20:51 * ToxicFrog|W`rkn waves to MAhal
20:51
<@Chalcedon>
any how TF, while I would love to stay and chat (that all sounds both interesting and useful).... I have to go have a shower then head up to uni.
20:54
<@ToxicFrog|W`rkn>
Alrighty, have fun.
20:54
<@Mahal>
Later Chal
20:54
<@Chalcedon>
I will, though I don't fancy telling my supervisor I haven't done as much work as I'm supposed to have.......
21:37 ToxicFrog|W`rkn is now known as ToxicFrog|AFK
21:50 * Vornotron returns, does more battle with grep.
22:08
<@Chalcedon>
why is it that the same stuff that takes 5 mins to copy off my usb key, takes 20mins to delete?
22:09
< Vornotron>
I don't know.
22:10
< Vornotron>
Technically a deletion should take very, very little time - it's just a delink.
22:10
<@Chalcedon>
it's taking /forever/
22:10
<@Chalcedon>
and now... I'm late.
22:10
< Vornotron>
:(
22:10 * Vornotron applies stoatburgers
22:11
<@Chalcedon>
:)
22:11
<@Chalcedon>
yay!
22:11 * Chalcedon nrom
22:11
<@ToxicFrog|AFK>
Vorn: USB keys are generally FAT32.
22:11
<@Chalcedon>
sadly, however, I think my supervisor will be unimpressed
22:11
<@ToxicFrog|AFK>
And relatively slow.
22:11 * Mahal ponders breakfast.
22:11
<@ToxicFrog|AFK>
Unlinks on FAT seem to involve a lot more bookkeeping than on extfs.
22:11
<@Chalcedon>
you'd have thought that copying would be similarly slow though...
22:11
<@ToxicFrog|AFK>
It isn't?
22:11
<@Chalcedon>
no
22:11
<@Chalcedon>
copying took 5min
22:11
<@Chalcedon>
deleting is taking 20
22:12
< Vornotron>
weirdass.
22:14
<@ToxicFrog|AFK>
Bizarre.
22:14
<@ToxicFrog|AFK>
I mean, copies are read-only, deletes are read-write, but still.
22:18 * Chalcedon flee!!
22:24 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
22:25 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
22:25 mode/#code [+o Chalcedon] by ChanServ
22:29 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
22:29 mode/#code [+o Chalcy] by ChanServ
22:29 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
22:56
< Vornotron>
...or I could just ask the right question.
23:06 ReivZzz is now known as Reiver
23:13
<@ToxicFrog>
?
23:14
< Vornotron>
turns out that I don't need to grep for the thing I need, because I can just do svn propget --revprop svn:log
23:14
< Vornotron>
and that returns it.
23:14
<@ToxicFrog>
Aah.
23:15 Mahal [~Mahal@Nightstar-5049.worldnet.co.nz] has quit [Quit: ohshitworkbyeeee!]
23:17
< Vornotron>
And I have the Dragon Warrior song stuck in my head.
23:46
< Vornotron>
Templating with sed!
23:52
<@Reiver>
Miniguns!
23:52 * Reiver giggles.
23:53
< Vornotron>
REiver: when i arrive home, wiki will be up.
23:53
< Vornotron>
...miniguns?
23:53
<@Reiver>
Yay Vorn! *huggles*
23:53
<@Reiver>
I'm starting a new game, wikiage could be useful.
23:53
<@Reiver>
And yes, miniguns.
23:54
< Vornotron>
why miniguns?
23:54
<@Reiver>
Because you gotta hide something under your trenchcoat?
23:54
< Vornotron>
oh.
23:54
< Vornotron>
okay.
23:54
<@Reiver>
:)
23:54 * Reiver gives Vorn a minigun.
23:55 * Vornotron stashes the minigun in his Vault.
23:55
<@Reiver>
Yay boom!
23:55
< Vornotron>
Are you gonna sing the boom song now?
23:56 Reiver is now known as ReivClass
23:56
<@ReivClass>
No, I'm going to sit a test.
23:57
<@ReivClass>
But singing songs later may be an option.
23:57
<@ReivClass>
Bye!
23:57
< Vornotron>
have fun
--- Log closed Fri Aug 18 00:00:02 2006
code logs -> 2006 -> Thu, 17 Aug 2006< code.20060816.log - code.20060818.log >