parsing

Fast string parsing in C#

What's the fastest way to parse strings in C#? Currently I'm just using string indexing (string[index]) and the code runs reasonably, but I can't help but think that the continuous range checking that the index accessor does must be adding something. So, I'm wondering what techniques I should consider to give it a boost. These are m...

ASP.NET C# Read in JavasScript File and Parse Method Names with Certain Signature?

I'm wondering the best way to approach this. I have a JavaScript file in my web app that has a bunch of different methods all with the same signature. What I want to do is read in the JS file server side and parse out all the method names of only the methods that have that certain signature. Let's say my JS file looked like below: fu...

PHP Error, syntax error T_STRING!

Hi, I get the following error; Parse error: syntax error, unexpected T_STRING in D:\XAMPP\xampp\htdocs\site\register.php on line 95 Line 95 is; if (strstr($email, "@") && strstr($email, ".") strlen($email) >=6)) Please help, I don't know what's wrong :/ It all looks fine to me. Thanks In Advance! ...

Alternative parsing methods

I know something about regular expressions, parse trees and abstract syntax trees. But once I read there is still another parsing technique that, as far as I remember, people from SO used to re-implement its markdown parser. What I don't recall is the name of this method, or how it did work. Do you? If not, what it could be? ...

Parsing with Boost Spirit, getting extra items

This is long with a lot of code, so I hope Stack Overflow can cope with it. :P I'm trying to write an SVG parser with Boost Spirit. I have a grammar that populates a vector with "Contours," which are vectors of "BezierPoints," which may represent either regular points or points with bezier controls. So far I have this (not handling re...

what next after pyparsing?

I have a huge grammar developed for pyparsing as part of a large, pure python application. I have reached the limit of performance tweaking and I'm at the point where the diminishing returns make me start to look elsewhere. Yes, I think I know most of the tips and tricks and I've profiled my grammar and my application to dust. What next...

C# Create Instance of Color from any supported Format (Win.Forms Properties -> Color)

Hello What is the best way to instantiate a new Color from any supported value, like for example "FF00FF11" or "Gray" or "234,255,65"? I need to generalize maximum as possible this implementation, but can't find a way to do it. With System.Reflaction I can get the value for enumerator KnownColor, but how can I distinct this "FF00FF11"...

detect and use html code when parsing an xml rss feed for iphone

i have been using and adapting an open source xml parser called MWFeedParser found here: http://github.com/mwaterfall/MWFeedParser the problem i am having is that it does not load images or hold the original html formatting. As in, no bold, no italics, no links, not even paragraph line breaks. Does anyone think they could help me get...

Does zend framework have html parser like simple html dom?

Hi, Does zend framework have html parser like simple html dom? Thanks ...

How to parsing JSON object in iPhone SDK (XCode) using JSON-Framework

Hello All, I have JSON object like this : { "data": {"array": ["2", {"array": [ {"clientId":"1","clientName":"Andy","job":"developer"}, {"clientId":"2","clientName":"Peter","job":"carpenter"} ] } ] }, "message":"MSG0001:Success", "status":"OK" } I want to get t...

Find PHP with REGEX

I need a REGEX that can find blocks of PHP code in a file. For example: <? print '<?xml version="1.0" encoding="UTF-8"?>';?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <?php echo...

A little help with perl HTML parsing

I am working on a small perl program that will open a site and search for the words Hail Reports and give me back the information. I am very new to perl so some of this might be simple to fix. First my code says I am using an unitialized value. Here is what I have #!/usr/bin/perl -w use LWP::Simple; my $html = get("http://www.spc.noaa....

Python fast string parsing, manipulation

I am using python to parse the incoming comma separated string. I want to do some calculation afterwards on the data. The length of the string is: 800 characters with 120 comma separated fields. There such 1.2 million strings to process. for v in item.values(): l.extend(get_fields(v.split(','))) #process l get_fields use...

Python parsing files

I need to know the best approach for the following scenario lets say we have some huge file which logs the output of the compilation and there are couple of error patterns which I want to test against this file, for eg. error patterns could be - : error: - : error [A-Z]*[\d ]* - [A-Z]*[\d]* [E\e|rror: - " Cannot open include file ...

Need help parsing JSON on iPhone using json-framework

I'm currently using json-framework and need some help though parsing some JSON i'm getting from my server. Here is how the JSON looks: Like I said I already have the json-framework installed but I can't figure out how to actually parse it. Can someone please show me? Thanks! [ { "id":"0", "name":"name", "info":"This...

Parser expression for comma-separated function call parameters

Im writing a parser than can parse expressions like myfunc1(), myfunc2(param1) and myfunc3(param1, param2) (with an unknown amount of parameters). Now I'm trying to get my parse expressions right. I'm using the Lemon Parser Generator. Here is what I've come up with: application(res) ::= APPLICATIONNAME(a) BRACE_OPEN params BRACE_CLOSE. ...

How to Store Entire WebPages for Later Parsing?

I've been doing a lot of parsing of webpages lately and my process usually looks something like this: Obtain list of links to Parse Import list into database Download Entire Webpage for each link and store into mysql Add Index for each scraping session Scrape relevant sections (content, metas, whatever) Steps 4,5 -- Rinse/Repeat -- as ...

Splitting words in running text using Python?

I am writing a piece of code which will extract words from running text. This text can contain delimiters like \r,\n etc. which might be there in text. I want to discard all these delimiters and only extract full words. How can I do this with Python? any library available for crunching text in python? ...

trouble parsing yahoo API json with jquery

I'm having trouble parsing the following link. I'd like to be able to extract a few of the object characteristics from each object in the array using $.getJSON(). Does anyone have a clue how I can do this? Thanks! http://search.yahooapis.com/NewsSearchService/V1/newsSearch?appid=YahooDemo&amp;query=market&amp;results=2&amp;language=en...

Ruby String parsing like how rails parses routes (with :symbols)

I'm trying to parse out some log files with ruby. I have plenty of experience with regexes but the other day I was using rails routes and thought that might be a really neat way to parse out these log files because it would be incredibly easy to understand the parser. Regex, on the other hand, takes several minutes for most people to d...