parsing

Getting started with a parser in Java code

I am new to parsers. I like to fetch specific data from a website. I need to use parsers for that. How to get started with parsers? What do I need to download? What would the code be to fetch the data from a website using parsers in Java? ...

Extracting function declarations from a PHP file

I'm looking to create an on-site API reference for my framework and application. Basically, say I have a class file model.class.php: class Model extends Object { ... code here ... // Separates results into pages. // Returns Paginator object. final public function paginate($perpage = 10) { ... more code here ...

replace double quotes to parse JSON in PHP

hi, i have following json format { "status": "ACTIVE", "result": false, "isworking": false, "margin": 1, "employee": { "111": { "val1": 5.7000000000000002, "val2": "9/2", "val3": 5.7000000000000002 }, "222": { "val1": 31.550000000000001, ...

PHP Regex to match lines with all-caps with occaisional hyphens.

I'm trying to to convert an existing PHP Regular Expression match case to apply to a slightly different style of document. Here's the original style of the document: **FOODS - TYPE A** ___________________________________ **PRODUCT** 1) Mi Pueblito Queso Fresco Authentic Mexican Style Fresh Cheese; 2) La Fe String Cheese **CODE** ...

What is the difference between LR, SLR, and LALR parsers?

What is the actual difference between LR, SLR, and LALR parsers? I know that SLR and LALR are types of LR parsers, but what is the actual difference as far as their parsing tables are concerned? And how to show whether a grammar is LR, SLR, or LALR? For an LL grammar we just have to show that any cell of the parsing table should not con...

How to parse malformed HTML in python, using standard libraries

There are so many html and xml libraries built into python, that it's hard to believe there's no support for real-world HTML parsing. I've found plenty of great third-party libraries for this task, but this question is about the python standard library. Requirements: Use only Python standard library components (any 2.x version) DOM s...

tool for adding parentheses to equations?

Is there an online tool for adding parentheses to simple math equations? For example, a + b * c into a + (b * c) Those who paid more attention in math class might be able to tackle order of operations for huge equations in their head, but I could often use some help (and verification of my thinking). I often encounter other peo...

parser in C# for zone file used by named/bind

Hi, I'm looking for a bind/named zone file parser in .NET C#. If there is anything I could import/convert I would be interested too. Unfortunately there's not much, or I'm having troubles finding it. My goal is to make sure a zone file is syntax-errors-free before I push it to the server. I'd appreciate any help or hints. Thanks ...

Is this grammar SLR?

E -> A | B A -> a | c B -> b | c My answer is no because it has a reduce/reduce conflict, can anyone else verify this? Also I gained my answer through constructing the transition diagram, is there a simpler way of finding this out? Thanks for the help! P.S Would a Recursive Descent be able to parse this? ...

NSXMLDocument replacement on iPhone?

I have an seen how NSXMLDocument can parse and html document, and provide easy methods for returning parts of the html structure. Is there a similar method that can be used for the iPhone, as NSXMLDocument is not available? ...

DateTime: Require the user to enter a time component

Checking if a user input is a valid date or a valid "date + time" is easy: .NET provides DateTime.TryParse (and, in addition, VB.NET provides IsDate). Now, I want to check if the user entered a date including a time component. So, when using a German locale, 31.12.2010 00:00 should be OK, but 31.12.2010 shouldn't. I know I could use Da...

Parsing through email in Ruby using Action Mailer

I retrieve mail using net/pop , but I also need to parse through the email to obtain subject,from address and email body. Any ideas with Action Mailer? I'm supposed to use 3rd party gems.(No,not even Tmail) require 'rubygems' require 'net/pop' require 'pop_ssl' Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE) def pull_mail Net::PO...

Obtaining the lookahead token in LR(1)

I'm having a bit of trouble understanding how to obtain the lookahead token for LR(1). I'm hoping that someone can post a small example, and explain it to me. Thanks for the help! ...

What is this XML Parse Error?

I am using the following script to generate a RSS feed for my site: <?php class RSS { public function RSS() { $root = $_SERVER['DOCUMENT_ROOT']; require_once ("../connect.php"); } public function GetFeed() { return $this->getDetails() . $this->getItems(); } private function dbCo...

Lookahead Token in LR(1)

P-> Q | ε Q-> m | m Q S0: S' ->.P, $ P -> .Q, $ P -> ., $ Q -> .m, $ Q -> .mQ, $ < Arrow from S0 to S2 moving with m> S2: Q-> m., $ Q-> m.Q, $ Q-> .m, $ Q-> .mQ, $ < Arrow from S2 to S3 moving with Q> S3: Q-> mQ., $/m Can someone explain how why the lookahead token "m" is in S3? Thanks a lot for the help! ...

How do I get yacc/bison and/or lex/flex to restart scanning after something like token substitution?

Is there a way to force bison and/or flex to restart scanning after I replace some token with something else? My particular example would be with replacement for a specific word/string. If I want a word of hello to be replaced by echo hello, how can I get flex or bison to replace hello and then start parsing again (to pick up 2 words i...

How to parse out html links from a huge string with html links and other text (Java).

Hello, my question is how would i be able to go through a string and take out only the links and erase all the rest? I thought about using some type of delimiter, but wouldn't know how to go about using it in Java. an example of what i am trying to do: this is my String: String myString = "The file is http: // www. .com/hello.txt a...

Parsing C# code to evaluate expressions (basically, implementing Intellisense)

I'm trying to evaluate C# code as it gets typed, think of it as if I'm trying to write an IDE. So a person types code, I want to find out what code did he just write: String x = ""; I want to now register that x is a type of String. And now everytime the user types x again, and I want to show him all the things he can do with x, basic...

how can i make a good errror handler for my parsing which sends mail only when a page couldnot be opened???

Iam doing parsing and for that i need an error handler that should send mail only when a page is not opening up or is going on not found or is forbidden or something. What iam using currently is this :- function customError($errno, $errstr, $errFile, $errLine) { switch ($errno) { case E_ERROR:error_log("ERROR:in $errFile...

what is the best approach to parse xml data to make it as generic as possible in Qt

Hello all. I'm trying to find a good and effective way to parse an XML data structure that different API calls are returning. The problem is that each time I need different data and each time I'm getting a different XML structure. Which is better: to use the SAX approach or The DOM approach? Does QT 4.6 recommend or work better with o...