parsing

What is an appropriate data structure or algorithm for producing an immutable concrete syntax tree in a functionally pure manner?

Given a LL(1) grammar what is an appropriate data structure or algorithm for producing an immutable concrete syntax tree in a functionally pure manner? Please feel free to write example code in whatever language you prefer. My Idea symbol : either a token or a node result : success or failure token : a lexical token from source text...

Parsing nested structures in PHP with preg_match

Hello I want to make something like a meta language which gets parsed and cached to be more performant. So I need to be able to parse the meta code into objects or arrays. Startidentifier: { Endidentifier: } You can navigate through objects with a dot(.) but you can also do arithmetic/logic/relational operations. Here is an example o...

Strange problem with context free grammar

I begin with an otherwise well formed (and well working) grammar for a language. Variables, binary operators, function calls, lists, loops, conditionals, etc. To this grammar I'd like to add what I'm calling the object construct: object : object_name ARROW more_objects ; more_objects : object_name | object_name ARROW more_ob...

Use StAX parse RPC style soap response

Dear all, I have a soap response which is RPC style, so it has 'multiref's. The response was passed to me as a String. Can I use StAX parser to parse it? Can StaX resolve mutirefs automatically? Thanks, Sarah ...

Problem with strptime() - %p is not taken into account

I am trying to convert a date in a particular format using strptime, and i realized that the information about AM/PM is lost. Not sure why. Here is the code. struct tm t; strptime("Wed 4/18/2007 4:28:22 PM", "%a %m/%d/%Y %H:%M:%S %p", &t); std::cout<<t.tm_hour<<endl; strptime("Wed 4/18/2007 4:28:22 AM", "%a %m/%d/%Y %H:%M:%S %p", &t); ...

How do I parse data in a table using Biopython?

Hello, I want to screen a particular column in a table using biopython. I want to parse the table and retain only entries not having "empty spaces" in a particular column. Please any ideas? ...

parsing assembly code in perl.

0000000000033a1b subq $0x28,%rsp I am having trouble extracting 0x28 from the above line. I am able to extract subq from a big list of assembly code but i only want 0x28 since this gives me the stack size. I was thinking of using substr() function buy there are variations to it, another one could look like this: 0000000000...

Running into an issue trying to extract the text from a snippet of HTML

i am using the HTML Agility pack to convert <font size="1">This is a test</font> to This is a test using this code: HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); string stripped = doc.DocumentNode.InnerText; but i ran into an issue where i have this: <font size="1">This is a test &amp; this is a joke</font> ...

Parsing XML in another Thread / simultaneously

Hey there, I have got an application, that is getting data via XML-files. During the parsing-part the data is written/inserted to the local sqlite3-database on the device. So, if the data is syncronized, there does a loading-screen appear (performed in background) and is telling the user, that the data is syncronized. This is working q...

create a WIKI like "diff" between two strings

i am generating a report showing the different between fields before and after. I have it working but some of the fields are pretty long and the changes are quite subtle. I want some visualization to highlight what has changed. Similar to what you see in: Stackoverflow if you look at question edits One of the text file diff tools wh...

What is the best library for reliably dealing with attachments from email?

I have an application and need to write a program that is able to figure out attachments from all kinds of email senders (and MUAs) reliably. PHP doesn't seem to have a great MIME parser so I was hoping some other languages might. I've seen the PHP Mail Mime Parser but it's not robust at all and I know (and have confirmed) it doesn't w...

Writing a Parser (for a markup language): Theory & Practice

I'd like to write an idiomatic parser for a markup language like Markdown. My version will be slightly different, but I perceive at least a minor need for something like this in Clojure, and I'd like to get on it. I don't want to use a mess of RegExes (though I realize some will probably be needed), and I'd like to make something both...

Easiest parser in Java for xml to generate code for newcomer in xml.

Guys I'm new to xml in Java. I have the following task. I need to parse some xml files (specificallyh xcb-proto [X11]) to generate the equivalent request protocol in java. There is already a well defined xsd and the respective xml for the protocol. What is the best and easiest approach/parser to solve this? Example of existant xml cont...

How could I group duplicates from a collection?

I'm creating a program that parses a log file for a user's name and its GUID (Global unique identifier) using regular expressions. So far, my program extracts the data properly, and stores it in a two-column DataTable. Outputting its content with this code: foreach (DataRow dr in guids.Select("","guid")) { Console.WriteLine(...

Is there a utility which given an ANTLR grammar will produce matching strings?

I have an ANTLR grammar and I would like to fuzz my parser. ...

android html data parsing

Hi guys suddenly I have no experience with java and html parsing and I really need it...(possibly from http://www.uefa.com/teamsandplayers/teams/club=52280/domestic/index.html) I want a simple way to convert an html website to xml document(fetch,convert,parse) or an easy alternative way to do it... ps:if you know any alternative FREE r...

Parsing command line arguments in R scripts

Is there any convenient way to automatically parse command line arguments passed to R scripts? Something like perl's Getopt::Long? ...

RegEx / Parsing Linq - List.Where(xyz).Sum(value)

I have a linq like syntax: MyListName.Where(Lots of stuff can() "be" in "Diff(" here).Sum(value) I am wondering whether to use a RegEx or my own parsing function? I need to return: List = MyListName and WhereCondition = Lots of stuff can() "be" in "Diff(" here Function = Sum FunctionParameter = value e.g. the where brackets must matc...

Ignore Parse Errors HTMLAgilityPack?

Is it possible to ignore parse errors when using HTMLAgilityPack? ...

Parser Error & Server Error in '/' Application :(

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The module was expected to contain a...