parsing

Grammar/own-written parser?

Hello all, I'm doing some small projects which involve having different syntaxes for something, however sometimes these syntaxes are so easy that using a parser generator might be overkill. Now, when should I use a hand-made parser, and when should I use a parser generator? Thanks, William van Doorn ...

Parsec Haskell Lists

I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input and get a HTML output. If my input is: * First item, First level ** First item, Second level ** Second item, Second level * Second item, First level My output should be: <ul><li>First item, First level <ul><li>First item, Second level </li><li>...

Parse all RSS item into c# class

What's the best way of parsing the folowing rss feed item into a C# class. <item> <fh:FlightHistory FlightHistoryId="189895136" > <fh:Airline AirlineCode="EI" Name="Aer Lingus" /> </fh:FlightHistory> </item> ...

strip action code from bison grammar file

Hi Is there any existing tool to strip all the action code from bison grammar files, leaving only the {} around it? ...

Haskell Parse Paragraph and em element with Parsec

I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input like this: this is the beginning of the paragraph --this is an emphasized text-- and this is the end\n And my output should be: <p>this is the beginning of the paragraph <em>this is an emphasized text</em> and this is the end\n</p> This code parses and returns a...

Java: remove-common-words-method in the API?

Related: Forum post Before reinventing the wheel, I need to know whether such method exists. Stripping words according to a list such as list does not sound challenging but there are linguistic aspects, such as which words to stress the most in stripping, how about context? ...

string parsing and substring in c

I'm trying to parse the string below in a good way so I can get the sub-string stringI-wantToGet: const char *str = "Hello \"FOO stringI-wantToGet BAR some other extra text"; str will vary in length but always same pattern - FOO and BAR What I had in mind was something like: const char *str = "Hello \"FOO stringI-wantToGet BAR some ...

Easiest Way to Parse data from twitter with Cocoa

Hello, I've followed the tutorial from here: Twitter Client Tutorial to make a little twitter app. Now I need to find out how to parse the XML twitter gives you when you make a request. I've looked at tons of tutorials on phrasing xml on the iPhone but none have made much sense because Im still new to cocoa. Twitter stores the text of t...

ANTLR AST rules fail with RewriteEmptyStreamException

I have a simple grammar: grammar sample; options { output = AST; } assignment : IDENT ':=' expr ';' ; expr : factor ('*' factor)* ; factor : primary ('+' primary)* ; primary : NUM | '(' expr ')' ; IDENT : ('a'..'z')+ ; NUM : ('0'..'9')+ ; WS : (' '|'\n'|'\t'|'\r')+ {$channel=HIDDEN;} ; Now ...

Parsing plain text to some structured object

I am working on parsing plain text and converting it to key-value pairs. For example, plain text: some_uninteresting_thing key1 valueA, some_uninteresting_thing valueB key2 valueD key3 some_uninteresting_thing valueE key4 valueG(valueH, valueI) key5 some_uninteresting_thing And possible mappings: Map( key1 ->(valueA, valueB,va...

Parasing HTML to find specific links (Without Keywords)

I posted about this sort of earlier, but I am not sure how to post back to my original question as I can only comment or answer my own question. Anyways, I need to get 4 links from a website, the latest stable build links for windows and linux, and the latest development build links for windows and linux (4 links total) within my C++ ap...

Ruby/python Script to convert html text to plain text in csv file

Hi all: So i have a large(ish) file in a csv format, that contains a column that has html and i need to transform that to plain text (ie readable by people ,ie with no script tags) I dont have much experience with ruby, but it seems like the perfect language to do this The File should still be in a cv format after the parsing ( ie, o...

Path parsing in rails

Hi! I am looking for method for parsing route path like this: ActionController::Routing.new("post_path").parse #=> {:controller => "posts", :action => "index"} It should be opposite to url_for Upd I've found out: http://stackoverflow.com/questions/2222522/what-is-the-opposite-of-url-for-in-rails-a-function-that-takes-a-path-and-gener...

Parse Exception: At line 1, column 0: no element found

Hi everyone, I have a weird issue. I receive the following error that causes a force-close: org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: no element found at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:508) at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:467) ...

problem Keyword token antlr

If the 'for' is used both as a command and as "the English word": for_statement: 'for' ... id: 'for' | ID ; ID: ... right? My problem is how to differentiate the two cases. For example for_statement is only possible beginning of a line (only if preceded by ' ' or '\t'). For example: echo for print example for i in {0..10..2} ...

Java Html Parser and Closing Tags

How do I handle closing tags (ex: </h1>) with the Java HTML Parser Library? For example, if I have the following: public class MyFilter implements NodeFilter { public boolean accept(Node node) { if (node instanceof TagNode) { TagNode theNode = (TagNode) node; if (theNode.getRawTagName().equals("h1")) { return true; } e...

Parse <li> list with C++

I have webpage I downloaded with C++ to a string, and it is basically a massive <li> list of links. I need to find the last 2 elements of the list. Can anyone help me on how to do this? ...

running Sax parser

Am new to using SAX parser .Can anyone tell me how to run it .and what all are required to run it (jdk )..Can i have a sax parser that can parse both android xml and a normal xml ...

Using Qt's XML library for simple operation

I basically want to use the XML parser from Qt in my existing project. I have only used Qt once before, and that was with Qt Designer, and I am not having much luck finding anything on Google about how to just use the XML library. I have downloaded a web page that has one large list, and I want to parse it and add each list item to a c+...

int.Parse of "8" fails. int.Parse always requires CultureInfo.InvariantCulture?

We develop an established software which works fine on all known computers except one. The problem is to parse strings that begin with "8". It seems like "8" in the beginning of a string is a reserved character. Parsing: int.Parse("8") -> Exception message: Input string was not in a correct format. int.Parse("80") -> 0 int.Parse("88") ...