Re: A new feature request - parser add_mutually_exclusive_group - add a default value

2024-07-09 Thread אורי via Python-list
Thank you. Uri. אורי u...@speedy.net On Tue, Jul 9, 2024 at 6:40 PM Barry Scott wrote: > > > On 9 Jul 2024, at 06:13, ⁨אורי via Python-list⁩ <⁨python-list@python.org⁩> > wrote: > > I tried to subscribe to Python-ideas > > > These days ideas are discussed on https://discuss.python.org/ > It is

Re: A new feature request - parser add_mutually_exclusive_group - add a default value

2024-07-09 Thread Barry Scott via Python-list
> On 9 Jul 2024, at 06:13, ⁨אורי via Python-list⁩ <⁨python-list@python.org⁩> > wrote: > > I tried to subscribe to Python-ideas These days ideas are discussed on https://discuss.python.org/ It is rare to see an idea on the mailing list. Barry -- https://mail.python.org/mailman/listinfo/pyt

A new feature request - parser add_mutually_exclusive_group - add a default value

2024-07-08 Thread אורי via Python-list
Hi, Please look at this Stack Overflow post: https://stackoverflow.com/questions/78722378/parser-add-mutually-exclusive-group-how-can-i-set-a-default-value 1. Is there a way to add a default to parser add_mutually_exclusive_group groups - a value that will be set by default? In this case I want

[ANN] PyYAML-5.3.1: YAML parser and emitter for Python

2020-03-18 Thread Tina Müller
parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible error messages. PyYAML supports standard YAML tags and provides Python-specific tags that allow to represent an arbitrary Python object. PyYAML is

[ANN] PyYAML-5.3: YAML parser and emitter for Python

2020-01-06 Thread Tina Müller
About PyYAML YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible

[ANN] PyYAML-5.2: YAML parser and emitter for Python

2019-12-02 Thread Tina Müller
s a YAML parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible error messages. PyYAML supports standard YAML tags and provides Python-specific tags that allow to represent an arbitrary Python object. PyYAML

Re: Do I need a parser?

2019-07-08 Thread josé mariano
ipt and run > it. > > So, to get to my questions: > > - To load and read the config file I need a parser, right? Is their a parser > library where we can define the syntax of the language to use? Are there > better (meaning easier) ways to accomplish the same result? >

Re: Do I need a parser?

2019-07-02 Thread Michael Torrie
On 07/02/2019 12:47 PM, Thomas Jollans wrote: > Obviously, as Cameron points out, using Python instead of a custom > scripting language has security implications, that go with the increased > power that the user has. I've always found this kind of thing to be a bit strange. I do understand where

Re: Do I need a parser?

2019-07-02 Thread Thomas Jollans
On 01/07/2019 17:23, josé mariano wrote: > Dear All, > > Thank you very much for your valuable input. > Thanks Alan for your kind words. I'm not Spanish, I'm Portuguese, but I know > what you mean. > Thomas, I was able to track down the author but he is not willing to release > the source code.

Re: Do I need a parser?

2019-07-02 Thread Mario R. Osorio
the script and run > it. > > So, to get to my questions: > > - To load and read the config file I need a parser, right? Is their a parser > library where we can define the syntax of the language to use? Are there > better (meaning easier) ways to accomplish the same result?

Re: Do I need a parser?

2019-07-01 Thread Cameron Simpson
On 01Jul2019 08:23, josé mariano wrote: The new software would use a settings files in one "standard" format. I like INI. It's note very powerful, but is easy to read and enough for the matter at hand. I could then use configparser to parse the settings to the main module. One separate module

Re: Do I need a parser?

2019-07-01 Thread josé mariano
Dear All, Thank you very much for your valuable input. Thanks Alan for your kind words. I'm not Spanish, I'm Portuguese, but I know what you mean. Thomas, I was able to track down the author but he is not willing to release the source code. The executable is free but apparently the source is not

Re: Do I need a parser?

2019-06-29 Thread Alan Meyer via Python-list
the shell, run "my_new_software old_script_file.***". The new software would load the old_script, parse it (?), set the internal variables, load the script and run it. So, to get to my questions: - To load and read the config file I need a parser, right? Is their a parser library where we

Re: Do I need a parser?

2019-06-29 Thread bob gailer
I might be able to help. I'd need to understand a bit more about the configuration and scripting languages. Do you have any reference material? Or some way to look up the titration device on the internet? -- Bob Gailer -- https://mail.python.org/mailman/listinfo/python-list

Re: Do I need a parser?

2019-06-29 Thread Thomas Jollans
les, load the script and run it. So, to get to my questions: - To load and read the config file I need a parser, right? Is their a parser library where we can define the syntax of the language to use? Are there better (meaning easier) ways to accomplish the same result? You need to parse the file,

Do I need a parser?

2019-06-29 Thread josé mariano
cript_file.***". The new software would load the old_script, parse it (?), set the internal variables, load the script and run it. So, to get to my questions: - To load and read the config file I need a parser, right? Is their a parser library where we can define the syntax of the language

[ANN] PyYAML-5.1: YAML parser and emitter for Python

2019-03-13 Thread Ingy dot Net
YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible error messages. PyYAML su

[ANN] PyYAML-5.1b1: YAML parser and emitter for Python

2019-02-24 Thread Ingy dot Net
homepage: http://yaml.org/ YAML-core mailing list: http://lists.sourceforge.net/lists/listinfo/yaml-core About PyYAML YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML featu

[ANN] PyYAML-3.13: YAML parser and emitter for Python

2018-07-05 Thread Ingy dot Net
://yaml.org/ YAML-core mailing list: http://lists.sourceforge.net/lists/listinfo/yaml-core About PyYAML YAML is a data serialization format designed for human readability and interaction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML features a complete

[ANN] PyYAML-4.1: YAML parser and emitter for Python

2018-06-26 Thread Ingy dot Net
ction with scripting languages. PyYAML is a YAML parser and emitter for Python. PyYAML features a complete YAML 1.1 parser, Unicode support, pickle support, capable extension API, and sensible error messages. PyYAML supports standard YAML tags and provides Python-specific tags that allow to represent an

Lexer/Parser question: TPG

2016-11-14 Thread Johannes Bauer
$ s += "ESCAPED[" + e + "]" | '[^\\()]+'/e $ s += e | String/e $ s += "(" + e + ")" )* end_string ; (the "ESCAPED" part is just for demonstration to g

ANN: parsita 1.0.0, a new parser combinator library

2016-10-03 Thread David Hagen
Parsita is a parser combinator library for Python. I wrote it because I missed the intuitive parser combinator library in Scala while trying to parse custom model file formats in Python. Parsita is focused on a clean grammar-like syntax, defining operators like `|` and `&` and functions

Re: Which one is the best XML-parser?

2016-07-02 Thread Stefan Behnel
Random832 schrieb am 24.06.2016 um 15:09: > On Fri, Jun 24, 2016, at 02:39, dieter wrote: >> You want an incremental parser if the XML documents are so huge that >> you must process them incrementally rather than have a data structure >> representing the whole document (in

Re: Which one is the best JSON parser?

2016-06-27 Thread Ned Batchelder
On Monday, June 27, 2016 at 9:31:04 AM UTC-4, Nagy László Zsolt wrote: > On 2016-06-23, MRAB wrote: > >> On 2016-06-23 21:58, David Shi via Python-list wrote: > >>> Can any one tell me? > >>> Regards. > >>> David > >>> > >> There's one in the standard library. > > Which has always worked fine for

Re: Which one is the best JSON parser?

2016-06-27 Thread Nagy László Zsolt
On 2016-06-23, MRAB wrote: >> On 2016-06-23 21:58, David Shi via Python-list wrote: >>> Can any one tell me? >>> Regards. >>> David >>> >> There's one in the standard library. > Which has always worked fine for me... Which always reminds me: >>> import json >>> d = {0:1, False:2} >>> d {0: 2} >>>

Re: Which one is the best XML-parser?

2016-06-24 Thread Ned Batchelder
On Friday, June 24, 2016 at 8:44:49 PM UTC-4, Sayth Renshaw wrote: > On Friday, 24 June 2016 07:03:18 UTC+10, David Shi wrote: > > Which one is the best XML-parser? > > Can any one tell me? > > Regards. > > David > > Most use lxml http://lxml.de/index.html &g

Re: Which one is the best XML-parser?

2016-06-24 Thread lorenzo . gatti
On Thursday, June 23, 2016 at 11:03:18 PM UTC+2, David Shi wrote: > Which one is the best XML-parser? > Can any one tell me? > Regards. > David Lxml offers lxml.etree.iterparse (http://lxml.de/tutorial.html#event-driven-parsing), an important combination of the memory savings of

Re: Which one is the best XML-parser?

2016-06-24 Thread Sayth Renshaw
On Friday, 24 June 2016 07:03:18 UTC+10, David Shi wrote: > Which one is the best XML-parser? > Can any one tell me? > Regards. > David Most use lxml http://lxml.de/index.html Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Which one is the best XML-parser?

2016-06-24 Thread Sayth Renshaw
On Friday, 24 June 2016 07:03:18 UTC+10, David Shi wrote: > Which one is the best XML-parser? > Can any one tell me? > Regards. > David xml parser most use lxml http://lxml.de/index.html Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Which one is the best XML-parser?

2016-06-24 Thread Sayth Renshaw
On Friday, 24 June 2016 07:03:18 UTC+10, David Shi wrote: > Which one is the best XML-parser? > Can any one tell me? > Regards. > David Most would use lxml sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Which one is the best XML-parser?

2016-06-24 Thread Sayth Renshaw
On Friday, 24 June 2016 07:03:18 UTC+10, David Shi wrote: > Which one is the best XML-parser? > Can any one tell me? > Regards. > David Most use lxml Sayth -- https://mail.python.org/mailman/listinfo/python-list

Which one is the best XML-parser?

2016-06-24 Thread Sayth Renshaw
Lxml -- https://mail.python.org/mailman/listinfo/python-list

Re: Which one is the best XML-parser?

2016-06-24 Thread Peter Otten
Marko Rauhamaa wrote: > Random832 : >> You know what would be really nice? A "semi-incremental" parser that >> can e.g. yield (whether through an event or through the iterator >> protocol) a fully formed element (preferably one that can be queried >> with

Re: Which one is the best JSON parser?

2016-06-24 Thread Grant Edwards
On 2016-06-23, MRAB wrote: > On 2016-06-23 21:58, David Shi via Python-list wrote: >> Can any one tell me? >> Regards. >> David >> > There's one in the standard library. Which has always worked fine for me... -- Grant Edwards grant.b.edwardsYow! I want another

Re: Which one is the best XML-parser?

2016-06-24 Thread Marko Rauhamaa
Random832 : > You know what would be really nice? A "semi-incremental" parser that > can e.g. yield (whether through an event or through the iterator > protocol) a fully formed element (preferably one that can be queried > with xpath) at a time for each record of a document

Re: Which one is the best XML-parser?

2016-06-24 Thread Random832
On Fri, Jun 24, 2016, at 02:39, dieter wrote: > You want an incremental parser if the XML documents are so huge that > you must process them incrementally rather than have a data structure > representing the whole document (in memory). Incremental parsers > for XML are usually called &

Re: Which one is the best XML-parser?

2016-06-23 Thread dieter
David Shi via Python-list writes: > Which one is the best XML-parser? "best" is not an absolute term but depends on criteria/conditions. There are essentially two kinds of parsers: incremental parsers which parse the structure and report events for everything they see and no

Re: Which one is the best JSON parser?

2016-06-23 Thread MRAB
On 2016-06-23 21:58, David Shi via Python-list wrote: Can any one tell me? Regards. David There's one in the standard library. -- https://mail.python.org/mailman/listinfo/python-list

Which one is the best JSON parser?

2016-06-23 Thread David Shi via Python-list
Can any one tell me? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Which one is the best XML-parser?

2016-06-23 Thread David Shi via Python-list
Which one is the best XML-parser? Can any one tell me? Regards. David -- https://mail.python.org/mailman/listinfo/python-list

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread rocky
a full Python 2.6 > > language. > > Does anybody bother with LR(k) parsers any more? I don't understand. Python itself I think does. And By the way, SPARK is an Early-Algorithm parser [1], so it is a little more general than LL or LR parsers. [1] https://en.wikipedia.org/wiki/Earley

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread rocky
ed the date in [1] > > https://pypi.python.org/pypi/spark_parser/1.3.0 > > > > The automated tests in the package just don't catch stuff like this. But > > I'm sure there are also other mistakes as well in there so feel free to let > > me know. > > > not a

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-10 Thread Robin Becker
don't catch stuff like this. But I'm sure there are also other mistakes as well in there so feel free to let me know. not a big deal; I like the spark parser :) -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-09 Thread Lawrence D’Oliveiro
On Wednesday, June 8, 2016 at 10:39:00 PM UTC+12, rocky wrote: > In addition to the example programs which give the classic arithmetic > expression evaluator, I now include the beginnings of a full Python 2.6 > language. Does anybody bother with LR(k) parsers any more? -- https://mail.python.org

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread Gregory Ewing
Robin Becker wrote: "Python was conceived in the late 1980s[1] and its implementation was started in December 1989[2] by Guido van Rossum at CWI in the Netherlands" so that Aycocks's paper must have been at the -1st Python Conference When the time machine was invented, Guido thought it would

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread rocky
On Wednesday, June 8, 2016 at 12:50:57 PM UTC-4, Robin Becker wrote: > On 08/06/2016 11:38, rocky wrote: > ... > > [1] https://pypi.python.org/pypi/spark_parser/1.3.0 > ... > the page above shows one can implement a time travel machine as it boldly > states > > "The original version o

Re: Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread Robin Becker
On 08/06/2016 11:38, rocky wrote: ... [1] https://pypi.python.org/pypi/spark_parser/1.3.0 ... the page above shows one can implement a time travel machine as it boldly states "The original version of this was written by John Aycock and was described in his 1988 paper: “Compiling Li

Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

2016-06-08 Thread rocky
For those who are interested in experimenting with parser systems in Python, there has been one around for a long while. But in my opinion it was a bit lacking in graded example demonstrating how to use it. So in the recently in spark_parser 1.3.0 [1], I've beefed up the examples a littl

Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-12 Thread victor . hooi
ireCount: { > > w: 1 } } } > > > >This won't parse with json.loads() - the main issues is the missing > >quotation marks (") around the strings. > > > >My question, is there a more lenient, or relaxed JSON parser available for > >Python, that

Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-12 Thread Laura Creighton
t;) around the strings. > >My question, is there a more lenient, or relaxed JSON parser available for >Python, that will try to do a best-efforts parsing of non-spec JSON? > >Cheers, >Victor >-- >https://mail.python.org/mailman/listinfo/python-list Won't this http:

Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread Random832
Victor Hooi writes: > My question, is there a more lenient, or relaxed JSON parser available > for Python, that will try to do a best-efforts parsing of non-spec > JSON? In an answer to a similar question on StackExchange, using YAML was suggested. http://stackoverflow.com/question

Re: Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread MRAB
abase: { acquireCount: { w: 2 } }, Collection: { acquireCount: { w: 1 } }, oplog: { acquireCount: { w: 1 } } } This won't parse with json.loads() - the main issues is the missing quotation marks (") around the strings. My question, is there a more lenient, or relaxed JSON parser availa

Relaxed, or best-efforts JSON parser for Python?

2015-10-11 Thread Victor Hooi
ction: { acquireCount: { w: 1 } }, oplog: { acquireCount: { w: 1 } } } This won't parse with json.loads() - the main issues is the missing quotation marks (") around the strings. My question, is there a more lenient, or relaxed JSON parser available for Python, that will try to do a best-

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

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# co

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 p

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 almo

Re: Parser needed.

2015-06-08 Thread Skybuck Flying
. Anyway... I am trying a more robust parser... because my own parser right now didn't work out for new inputs. It almost worked except for first item... don't know what problem was maybe just this... But I'll try and do it the usually way. "Tokenize", "P

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 d

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

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 m

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
ing parsed pass def NewLine(self, line, lineNumber): # Is called by the parser when it has fetched a new line # "line" Content of the line # "lineNumber" Current line number (0 index) pass def HasAllInformation(self): # Is called before each line is read. When you ret

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.py

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

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

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

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

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

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
estion you need help with? " All of my postings contain things I run into. Missing documentation, python limitations, and other problems. Algo design considerations etc. What I need help with is a parser for the file mentioned in the link. So far it looks bad for python. I may give the p

Re: Parser needed.

2015-06-01 Thread Skybuck Flying
python for some reason. I am starting to have serious doubts for python as a parser platform: This simple piece of code already takes 10 seconds for just 120 characters ? HOLYSHIT ?! Bad sign. BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic Studios\\Star Trek Online\

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
written a python library for reading it. " It's from a game called Star Trek Online, I think there is a C# parser for it. The ammount of data I need from this file is very limited. I don't want to spent too much time on a solution. I have perhaps today to try and get a solution

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 S

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

  1   2   3   4   5   6   7   8   9   >