parsing

Can I use python ast module for this?

I'd like to write a program that modify python programs in this way: change "some literal string %" % SOMETHING to functioncall("some literal string %") % SOMETHING Thanks, ...

Unrecognised XML Characters when parsing in Classic ASP

Hey I am having issues parsing XML file, Theres seems an unrecognised symbol after each new line. When im parsing this is Classic ASP and print out to screen it is appearing as "?" but when i do I.e replace(text,"?","LOL") its not replacing so its not a normal "?" I think. How can I capture and filter out this symbol ? Note this is do...

C++ JSON parser

Dear reader, I'm working on a twitter client which uses the twitter streaming json api. Twitter advices JSON as XML version is deprecated. I'm looking for a good JSON parser which can parse the json data below. I'm receiving this JSON which I want to be able to read/parse using a JSON parser. { "in_reply_to_status_id": null, "text": "...

How can I parse through a texutre in DirectX? (IDirect3DTexture9*)

I've been trying to figure out how to parse textures in directx for two reasons: to write my own texture format and to manipulate data in existing IDirect3DTexture9 type textures. I've been looking at the IDirect3DTexture9::LockRect() function but I'm unsure how it works, are the void* pBits I get out of it in D3DLOCKED_RECT the data in...

Choosing a Haskell parser

There are many open sourced parser implementations available to us in Haskell. Parsec seems to be the standard for text parsing and attoparsec seems to be a popular choice for binary parsing but I don't know much beyond that. Is there a particular decision tree that you follow for choosing a parser implementation? Have you learned anythi...

How to get this regular expression to match </span>

This is the sort of HTML string I will be performing matches on: <span class="q1">+12 Spell Power and +10 Hit Rating</span> I want to get +12 Spell Power and +10 Hit Rating out of the above HTML. This is the code I wrote: preg_match('/<span class="q1">(.*)<\/span>/', $gem, $match); But due to <\/span> it's escaping the / in </span>...

Parsing a grammar with Boost Spirit

I am trying to parse a C-function like tree expressions like the following (using the Spirit Parser Framework): F( A() , B( GREAT( SOME , NOT ) ) , C( YES ) ) For this I am trying to use the three rules on the following grammar: template< typename Iterator , typename ExpressionAST > struct InputGrammar : qi::grammar<Iterator, Express...

Is there an open-source eMail message (headers, attachments, etc.) parser?

Is there a free open-source solution taking raw e-mail message (as a piece of text) and returning each header field, each attachment and the message body as separate fields? ...

Open source mathematical expression parser?

I googled and came up blank - so it's time to test the good folks at SO again! :) Can anyone recommend an open source library (pref for .NET) that parses and calculates mathematical expressions? e.g. input expression = "2+(n-1)*4", parameter key/value n=2, output = 6. ...

Parsing Text file - C#

I have a text file that looks like this: 1,Smith, 249.24, 6/10/2010 2,Johnson, 1332.23, 6/11/2010 3,Woods, 2214.22, 6/11/2010 1,Smith, 219.24, 6/11/2010 I need to be able to find the balance for a client on a given date. I'm wondering if I should: A. Start from the end and read each line into an Array, one at a time. Check the la...

How to parse e-mail into database?

Hello. Still sometime I'm desperately searching for some community of developers which is dealing with the parsing of incoming email and storing its structure in the database. Quoting Mail2db developers: Different from traditional mail archive, the Mail2db engine can convert email into real database records stored within a RDM...

How exactly does the JavaScript expression [1 [{}]] parse?

Can you explain how the JavaScript expression: [1 [{}]] parses/evaluates? In Firefox, Chrome, Konqueror, and rhino, it seems to create an array with a single element, undefined. However, I don't understand why. In Firefox: [1 [{}]].toSource() produces [(void 0)] Replacing 1 with other JavaScript values seems to yield the sam...

What can be used for parser/lexer in silverlight, M Programming or ANTLR?

I am trying to create a simple parser/lexer, my problem is I have to use this in silverlight, so I need a parser/lexer that requires no runtime, it needs to have pure C# code without any dependency on any runtime. I know there used to be lex/yacc tool, but cant find it anymore for C#, I did study Sql Modelling M language, but to my under...

Looking for any good(and free) cross-platform CLI parsing library for a command line utility

I am currently working on a CLI utility which I feel can be improved a lot by adding a framework. Basically the utility revolves around lots of command line syntax AND parsing the output. Currently the code is scattered all around with lots of individual inhouse run() and readFromRunOutput() calls with hardcoded CLI arguments. For exa...

HTML PARSER in java

Possible Duplicate: HTML/XML Parser for Java Can any one suggest me good HTML parser?I need the following qualities in it: -Accuracy : Sould be able to parse affectively -Auto Correction : shold be able to auto parse eveen if the html page is not wellformed.(i.e even if some tags are not closed properly) -Speed I am looki...

Passing string to twitter fails after ampersand

Good morning, I am trying to pass a string to twitter, using the following code // The message you want to send $message = "http://www.smartphonesoft.com/index.php?option=com_mtree&amp;task=viewlink&amp;link_id=" .$link_id . " " ."Android Software" . " " .$link_name . " " . $metadesc; // The twitter API address $url = 'http://twitter....

Finite State Machine parser

I would like to parse a self-designed file format with a FSM-like parser in C++ (this is a teach-myself-c++-the-hard-way-by-doing-something-big-and-difficult kind of project :)). I have a tokenized string with newlines signifying the end of a euh... line. See here for an input example. All the comments will and junk is filtered out, so I...

How to extract data from an irregularly formatted data file in python

I need to extract certain data from a file, but this file is formatted to be read by humans, and is therefore irregular. First off there is a large amount of text before any of the data actually begins: DL_POLY Version 2.20 Running on 10 nodes ****** DLPOLY: LiN...

Consensus on Uri.parse("content://sms");

What is the consensus on parsing the Uri of sms messages for use with a cursor. There has to be a cross phone compatible way of getting access to sms messages. There's nothing in the sdk for something like this? What about this as a Uri string: ("vnd.android-dir/mms-sms"); ...

How to print out the line after the line found in re.compile()

Using this code import re file = open('FilePath/OUTPUT.01') lines = file.read() file.close() for match in re.finditer(r"(?m)^\s*-+\s+\S+\s+(\S+)", lines): eng = match.group(1) open('Tmp.txt', 'w').writelines(eng) print match.group(1) I get a column of data that looks like this: -1.1266E+05 -1.1265E+05 -1.1265E+05 -1.1265E+...