parsing

[PHP] How to pass array as multiple parameters to function?

I have a parameters array: $params[1] = 'param1'; $params[2] = 'param2'; $params[3] = 'param3'; ... $params[N] = 'paramN'; I have a caller to various functions: $method->$function( $params ); How can I parse the $params array, so multiple (and unlimited) parameters can be passed to any function: $method->$function( $params[1], $pa...

How exactly is a PHP script executed?

I was just thinking to myself "How exactly is a PHP script executed?" I thought it was parsed first for syntax errors etc, and then interpreted and executed. However, I don't know why I believe that is correct. I'm probably wrong. So, how exactly is a PHP file interpreted and executed? What stages does this involve? How do included fil...

Coco/R vs. ANTLR

I'm evaluating using Coco/R vs. ANTLR for use in a C# project as part of what's essentially a scriptable mail-merge functionality. To parse the (simple) scripts, I'll need a parser. I've focussed on Coco/R and ANTLR because both seem fairly mature and well-maintained and capable of generating decent C# parsers. Neither seem to be tr...

writing a fast parser in python

I've written a hands-on recursive pure python parser for a some file format (ARFF) we use in one lecture. Now running my exercise submission is awfully slow. Turns out by far the most time is spent in my parser. It's consuming a lot of CPU time, the HD is not the bottleneck. I wonder what performant ways are there to write a parser in p...

identifier token keyword antlr parser

How to handle the case where the token 'for' is used in two different situations in the language to parse? Such as statement and as a "parameter" as the following example: echo for print example for i in {0..10..2} do echo "Welcome $i times" done Output: for print example Welcome 0 times Welcome 2 times Welcome 4 times Welcom...

SnakeYAML: How to disable underscore stripping when parsing?

Here's my problem. I have YAML doc that contains the following pair: run_ID: 2010_03_31_101 When this get's parsed at org.yaml.snakeyaml.constructor.SafeConstructor.ConstructYamlInt:159 underscores get stripped and Constructor returns Long 20100331101 instead of unmodified String "2010_03_31_101" that I really need. QUESTION: How ca...

Non PHP site generates PHP errors

Hello. I have this error appearing: Parse error: syntax error, unexpected T_STRING in /home/ondesign/public_html/ywamleicester.org/index.html on line 1 Which I think is a PHP error. However, the site in question is an out of the box iweb design with no PHP in it. I have no idea what could be doing it. ...

What is the recommended way of parsing an XML feed with multiple namespaces with ActionScript 3.0?

I have seen the following methods to be used in several online examples, but haven't found any documentation on the recommended way of parsing an XML feed. Method 1: protected function xmlResponseHandler(event:ResultEvent):void { var atom:Namespace = new Namespace("http://www.w3.org/2005/Atom"); var microsoftData:Namespace = ne...

ruby parseexecel gem - array not implemented

I am trying to work with two worksheets at the same time. So I have code require 'parseexcel' #Open the excel file passed in from the commandline workbook = Spreadsheet::ParseExcel.parse(ARGV[0]) workbook2 = Spreadsheet::ParseExcel.parse(ARGV[1]) #Get the first worksheet worksheet = workbook.worksheet(0) worksheet2 = workbook2.worksh...

parsing local xml file using Sax in android

Hello, Can anyone tell me how to parse a local xml file stored in the system using SAX ,with an example code.please also tell me where can i find information on that ...

extract part of html using tidy in php

hi, I want to extract particular part of HTML using tidy in php. the html page has table in it and i just want to fetch that table from html page. please help and post the solution.... Thanks ...

Is there an equivallent for NSXMLParserDelegate in the cocoa touch framework?

Like the title says, I want to parse XML in my iPhone application, but there is no NSXMLParserDelegate protocol like there is in the System Foundation framework. Can I just add a reference to the /System/Library/Frameworks/Foundation.framework in my iPhone application? ...

Dealing with infinite loops when constructing states for LR(1) parsing

I'm currently constructing LR(1) states from the following grammar. S->AS S->c A->aA A->b where A,S are nonterminals and a,b,c are terminals. This is the construction of I0 I0: S' -> .S, epsilon --------------- S -> .AS, epsilon S -> .c, epsilon --------------- S -> .AS, a S -> .c, c A -> .aA, a A -> ...

How to handle unknown initializer functions in lua?

I want to load data written in a variant of lua (eyeonScript). However, the data is peppered with references to initialization functions that are not in plain lua: Redden = BrightnessContrast { Inputs = { Red = Input { Value = 0, }, }, } Standard lua gives "attempt to call a nil value" or "unexpecte...

String array logic question with java I/O.

Hello, I have problem. I need to read a line like this from a file: 5 Chair 12.49 EDIT: I want to be able to have more lines of data. I need to separate each word/number into different data types. First one is an int, second is a String, third is a double. Then I need to have them formatted like this: Item: Chair Price: $12.49 Quantit...

JavaCC: Please give me links to "real" examples.

Hello, everyone! I know that there are many examples of JavaCC parsers here, but they all do nothing. They just accept a string, or produce parsing errors. What I need is a few examples of real parsers, which actually do something during parsing. (Such as building a DOM tree during parsing an XML string). Please help! ;) ...

How to switch a view after i parse data?

OK my problem is this, i parse a document and after the document is parsed then i want to load to the next view sounds simple but ive been here for like 4 hours playing with code and id appreciete any help u can give me atm. k heres my parserDidEndDocumentCode - (void)parserDidEndDocument:(NSXMLParser *)parser{ IpadSlideShowViewContro...

Haskell - Parsec Parsing <p> element

I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input like this: This is the first paragraph example\n with two lines\n \n And this is the second paragraph\n And my output should be: <p>This is the first paragraph example\n with two lines\n</p> <p>And this is the second paragraph\n</p> I defined: line= d...

CSS Parser - Insert mtimes

What command line tool can I use to automatically insert mtimes into urls in my css files for the purposes of breaking the cache? /* before */ .example { background: url(example.jpg); } /* after */ .example { background: url(example.jpg?1271298451); } Also, I would like this tool to spit out the latest mtime as the css files mtime. (...

Parsing String to Time makes 01:00:00

When I do the following: String start = request.getParameter("startp"); SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); long ms=0; try { ms = sdf.parse(start).getTime(); } catch (ParseException e1) { e1.printStackTrace(); } Time ts = new Time(ms); it is inserted with this value 01:00:00 witch is not the correct one ...