Re: Parser needed.

2015-06-11 Thread Rustom Mody
On Thursday, June 11, 2015 at 6:08:22 PM UTC+5:30, larry@gmail.com wrote: > On Thu, Jun 11, 2015 at 8:35 AM, Joel Goldstick wrote: > > but you aren't asking questions. You are having a conversation with > > yourself on a public q/a list. Its unpleasant > > Well, he did mention masterbation i

Re: Parser needed.

2015-06-11 Thread Larry Martell
On Thu, Jun 11, 2015 at 8:35 AM, Joel Goldstick wrote: > but you aren't asking questions. You are having a conversation with > yourself on a public q/a list. Its unpleasant Well, he did mention masterbation in another post. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-11 Thread Joel Goldstick
On Thu, Jun 11, 2015 at 7:15 AM, Skybuck Flying wrote: > Well it did help a little bit. > > Somebody asked if there was already a parser for it. > > I answered yes in C#. > > So I took a closer look at it... and learned something from it. > > Maybe I would have done that anyway... or maybe not...

Re: Parser needed.

2015-06-11 Thread Skybuck Flying
Well it did help a little bit. Somebody asked if there was already a parser for it. I answered yes in C#. So I took a closer look at it... and learned something from it. Maybe I would have done that anyway... or maybe not... Now we will never know... but I am happy that the parser is now ok,

Re: Parser needed.

2015-06-09 Thread Rustom Mody
On Wednesday, June 10, 2015 at 5:04:17 AM UTC+5:30, Michael Torrie wrote: > On 06/09/2015 06:20 AM, Skybuck Flying wrote: > > Euhm... > > > > My parser is already done... since today > > > > Loving it too > > > > Wrote it myself... based on the c# code technique explained somewhere in > > this

Re: Parser needed.

2015-06-09 Thread Michael Torrie
On 06/09/2015 06:20 AM, Skybuck Flying wrote: > Euhm... > > My parser is already done... since today > > Loving it too > > Wrote it myself... based on the c# code technique explained somewhere in > this thread too I'm glad you're having fun, and making good progress. And it's good to hear of

Re: Parser needed.

2015-06-09 Thread Skybuck Flying
Euhm... My parser is already done... since today Loving it too Wrote it myself... based on the c# code technique explained somewhere in this thread too Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-09 Thread Ryan Stuart
On Tue, Jun 9, 2015 at 12:30 PM, Skybuck Flying wrote: > Anyway... I am trying a more robust parser... because my own parser right > now didn't work out for new inputs. > You should take a look at lrparsing: https://pypi.python.org/pypi/lrparsing/1.0.11 Cheers > > It almost worked except for

Re: Parser needed.

2015-06-08 Thread Skybuck Flying
I made it way too difficult on myself with that stupid dictionary bs... What I really wanted was to know if the ref was already in the reflist. Turns out python has a really nice simple operation for that: if not (Ref in EntityRef): EntityRef.append(Ref) DONE ! =D No need for dictionary.

Re: Parser needed.

2015-06-08 Thread Skybuck Flying
Oh I think I forgot to mention... parser is now getting close to 1 second... with tokenizer and such. But I think this is still within acceptable performance level for now. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Well... I must say I am impressed: Python parsers the file/info I want in just: Seconds: 0.013389648 For +/- 20.000 lines of input data/text. This makes it very usuable cool ! Now I try the bigger file: +/- 285.000 lines of input data/text: Seconds: 0.092351501 Very impressive ! I

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Ok problem found. The data contains: EntityRef EntityRef So perhaps I screwed it up or perhaps the data is a bit bad. I ll check on my web drive: http://www.skybuck.org/Games/StartrekOnline/Parser/SpaceFleetAlertEnemyExample.demo Firefox doesn't find it... so apperently I fucked up data a b

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Something strange happens with: 36044817 near the update section... for some reason it doesn't copy it properly... Hmm... Maybe a bug in output or an additional new line or maybe something wrong... Hmm.. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
I feel my conclusion is a bit hasty... but using dictionaries is not easy that for sure. Apperently the problem is DemoEntityInde is none ? But why would it be none ? Hmmm strange... maybe some refs are not in there... hmmm... Yeah could be... I cutted some stuff out... so I better check for

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
get was tried but now new error somewhere else: [error] TypeError ( list indices must be integers ) [error] --- Traceback --- error source first line: module ( function ) statement 133: main ( ProcessUpdateEntityDead ) DemoEntityDead[DemoEntityIndex] = Dead Apperently the returned index from

Re: Parser needed.

2015-06-04 Thread Michael Torrie
On 06/04/2015 11:14 AM, Steven D'Aprano wrote: > On Fri, 5 Jun 2015 03:02 am, Skybuck Flying wrote: > >> Yeah... my first nice parser for this kind of stuff... >> >> Python is really nice for this stuff... >> >> Piece a cake.. now I just need to stuff it in some dictionary and I am >> done or so ;

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Very nice code almost done. Now I am trying to do the code correctly and fast, thus using a dictionary, but I run into a little problem: The dictionary is declared as: DemoEntityRefIndex = {} Pairs are added as: DemoEntityRefIndex[Ref] = DemoEntityIndex And now I try to retrieve the demo e

Re: Parser needed.

2015-06-04 Thread Steven D'Aprano
On Fri, 5 Jun 2015 03:02 am, Skybuck Flying wrote: > Yeah... my first nice parser for this kind of stuff... > > Python is really nice for this stuff... > > Piece a cake.. now I just need to stuff it in some dictionary and I am > done or so ;) > > Though a dictionary might be hard to traverse in

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Yeah... my first nice parser for this kind of stuff... Python is really nice for this stuff... Piece a cake.. now I just need to stuff it in some dictionary and I am done or so ;) Though a dictionary might be hard to traverse in sequence... A list is probably enough... assuming no duplicate

Re: Parser needed.

2015-06-04 Thread Skybuck Flying
Yes these string processing techniques will work very nicely and very fast: cut and pasted an example but should work... now I developed it a bit further, bye ,bye. BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic Studios\\Star Trek Online\\Live\\demos" BotDemoFile = "Sp

Re: Parser needed.

2015-06-02 Thread Skybuck Flying
"MRAB" wrote in message news:mailman.71.1433263397.13271.python-l...@python.org... On 2015-06-02 05:45, Skybuck Flying wrote: Example for python: MyString = "Hello World" print MyString.rfind("World") if MyString.rfind("World"): print "yes" else: print "no" Pretty cool. " .rfind retur

Re: Parser needed.

2015-06-02 Thread MRAB
On 2015-06-02 05:45, Skybuck Flying wrote: Example for python: MyString = "Hello World" print MyString.rfind("World") if MyString.rfind("World"): print "yes" else: print "no" Pretty cool. .rfind returns the index if found, -1 if not found. "World".rfind("World") returns 0, which will be tre

Re: Parser needed.

2015-06-02 Thread Grant Edwards
On 2015-06-02, Skybuck Flying wrote: > > { > > >{ > >} > } IOW, it's almost, but not quite, JSON. -- Grant Edwards grant.b.edwardsYow! My vaseline is at RUNNING... gmai

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Actually that's not true... messages not that interesting. This C# parser does not parse what I want which is: "updates" and "positions". Thus I rejected this parser some days ago. But it's technique could be handy. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
If some of this code could be made to work it could be of some use: ParserEngine is the least important... MessageParser is interesting. class AbstractSectionsParser(AbstractParser): # Provides a method to return a list of sections def GetResult(self): # Returns the list with the found resourc

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Example for python: MyString = "Hello World" print MyString.rfind("World") if MyString.rfind("World"): print "yes" else: print "no" Pretty cool. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Hmm this parser uses an interesting technique: if line.Contains("activePlayerRef"): self._activePlayerRef = Convert.ToInt64(line.Substring(line.LastIndexOf("activePlayerRef") + 16)) I'll see if python can do this as well... ;) Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/p

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Together with this it's might be of some use: http://codeconverter.sharpdevelop.net/SnippetConverter.aspx It converts C# to Python pretty fast. I'll give it a try to see if it can work. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Here is a parser for sto demo files written in C# maybe it can be of some use, check trunk folders: http://sourceforge.net/p/stodemolauncher/code/HEAD/tree/ Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Mark Lawrence
On 02/06/2015 01:29, Skybuck Flying wrote: Hello, I need some kind of parser and some kind of way to access the data contained in a file like the one below: (text file): http://www.skybuck.org/Games/StartrekOnline/Parser/SpaceFleetAlertEnemyExample.demo I am interested in learning the entity

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Perhaps the list.append operation is the cause of the slowdown, or perhaps my algo is flawed. No idea yet with slowdown of parser code so far. Instead of trying to debug everything going to add some time outputs to the whole thing to get to bottom of this ;) Ok another sikuli failure... I ju

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Apperently print speed has some exponential time issue in SikuliX kinda weird. But at least processing is high... however, debug console/print is only thing I got to diagnose problems... Could get time-wise nasty... hmmm... Perhaps I should make a small little parser in Delphi and port it to

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Test program shows, python/sikulix can handle about 3m chars per second so I must continue with a parser attempt. Apperently there is some bottleneck/slowdown in posted code... I may have to slow down a bit take more time... and perhaps use global vars or so... instead of parameters. Maybe t

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Test program shows, python/sikulix can handle about 3m chars per second so I must continue with a parser attempt. # test char processing speed. # test if sikulix 1.1, python, jython/whatever is a piece of shit when it comes to parsing dealing with characters, unicode processing bottleneck theo

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
I tried running this in SikuliX 1.1 from pyparsing import Word, alphas greet = Word( alphas ) + "," + Word( alphas ) + "!" greeting = greet.parseString( "Hello, World!" ) print greeting Doesn't seem to run pyparser module missing. Another reason why not to use it, unfortunately. Not sure if i

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
"Joel Goldstick" wrote in message news:mailman.34.1433209315.13271.python-l...@python.org... On Mon, Jun 1, 2015 at 9:31 PM, Skybuck Flying wrote: Yes this will work: DemoChars = FileObject.read() I think this is a cleaner solution. EOL can be ignored and focusses on { } and stuff like

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
I am trying to rush it a bit but things are starting to go to hell. SikuliX needs to be restarted continously to deal with bugs. Plus Eclipse breakpoints cannot be set. So both IDEs totally suck for any complex code development. Plus I can already tell this is going to be insanely slow in pyth

Re: Parser needed.

2015-06-01 Thread Joel Goldstick
On Mon, Jun 1, 2015 at 9:31 PM, Skybuck Flying wrote: > Yes this will work: > > DemoChars = FileObject.read() > > I think this is a cleaner solution. EOL can be ignored and focusses on { } > and stuff like that... when extracting information EOL could be used as > well. > > > Bye, > Skybuck. > --

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
On 06/01/2015 07:19 PM, Skybuck Flying wrote: How hard would it be to encode that into pyparser ? " Check out the docs and you probably will get an idea. The only real way to find out is to try it. Is this file from a certain program? If so, it's possible someone has already written a python

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Nice char based code: BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic Studios\\Star Trek Online\\Live\\demos" BotDemoFile = "SpaceFleetAlert.demo" import time def ParseDemoLines( ParaLines ): print "Parsing " + str( len(ParaLines) ) + " lines." for LineIndex in range(0,

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Yes this will work: DemoChars = FileObject.read() I think this is a cleaner solution. EOL can be ignored and focusses on { } and stuff like that... when extracting information EOL could be used as well. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Ok, so far so good, a little start has been made. Text file is read into lines... I am not so sure if this is a good idea... Maybe it's easier if the entire file is one gigant array of characters instead of fragmented lines. However I don't know yet exactly how to read as one gigant array of

Re: Parser needed.

2015-06-01 Thread Michael Torrie
On 06/01/2015 07:19 PM, Skybuck Flying wrote: > How hard would it be to encode that into pyparser ? Check out the docs and you probably will get an idea. The only real way to find out is to try it. Is this file from a certain program? If so, it's possible someone has already written a python li

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Since the file is probably ascii... not sure... I might come away with: " file.read([size]) Reads at most size bytes from the file (less if the read hits EOF before obtaining size bytes). " The doc does not mention is size is optionally... I will try and leave it out, see what happens, other

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
"Michael Torrie" wrote in message news:mailman.31.1433207544.13271.python-l...@python.org... On 06/01/2015 06:29 PM, Skybuck Flying wrote: The parser should be able to parse a textfile of somewhere between 20.000 lines to 50.000 lines in about 1 to 2 seconds. My environment is SikuliX 1.1 "

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
So far this is what I got... I like to name things for what they are so FileObject I like better than something abstract/weird like "text file", my code: BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic Studios\\Star Trek Online\\Live\\demos" BotDemoFile = "SpaceFleetAler

Re: Parser needed.

2015-06-01 Thread Michael Torrie
On 06/01/2015 06:29 PM, Skybuck Flying wrote: > The parser should be able to parse a textfile of somewhere between 20.000 > lines to 50.000 lines in about 1 to 2 seconds. > > My environment is SikuliX 1.1 I don't have any inclination to examine your input files, but you could certainly mock up a

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Readlines is indeed documented as reading EOF: http://www.tutorialspoint.com/python/file_methods.htm Bye, skybuck. "Skybuck Flying" wrote in message news:37cda$556d009d$5419aafe$38...@news.ziggo.nl... This will probably help: http://stackoverflow.com/questions/14676265/how-to-read-text-fi

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
I really like this python help file, it has served me well so far: http://www.tutorialspoint.com/python/python_functions.htm It's unusually better than the rest on the net ;) It matches nicely Sikuli's python's capabilities. Bye, Skybuck :) -- https://mail.python.org/mailman/listinfo/python-l

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Link looks a bit odd, home index link: Nice python documentation/tutorial/help: http://www.tutorialspoint.com/python/index.htm Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Except for the first bracket... it has no structure name. Perhaps the demo filename could be used as structure name or just be left empty. Bye, Skybuck. "Skybuck Flying" wrote in message news:aef84$556d00e7$5419aafe$39...@news.ziggo.nl... From examining the demo file it seems each brac

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
From examining the demo file it seems each bracketted data sections if pre-header/pre-fixed with it's name. So it's somewhat similar to a C structure: structure { } Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
This can help with parsing the C like bracketted data: http://stackoverflow.com/questions/1651487/python-parsing-bracketed-blocks algo: " For each string in the array: Find the first '{'. If there is none, leave that string alone. Init a counter to 0. For each character in the string:

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
This will probably help: http://stackoverflow.com/questions/14676265/how-to-read-text-file-into-a-list-or-array-with-python text_file = open("filename.dat", "r") lines = text_file.readlines() print lines print len(lines) text_file.close() Usually I like to consult officals docs though...Bye, Sk

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
Some further information about the demo file: It seems to be split up into "creation sections" and "update" sections. The update sections contain the positions. The update sections also contain a reference number to the created entities. (There is one empty creation section but that's because

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
I will try and help for as far as possible, maybe I will end up writing it myself in the process. The first problem seems to be, how to read a textfile into python all at once... and then perhaps process them per line. Bye, Skybuck. -- https://mail.python.org/mailman/listinfo/python-list

Parser needed.

2015-06-01 Thread Skybuck Flying
Hello, I need some kind of parser and some kind of way to access the data contained in a file like the one below: (text file): http://www.skybuck.org/Games/StartrekOnline/Parser/SpaceFleetAlertEnemyExample.demo I am interested in learning the entity numbers: "EntityRef " and their position