parsing

How to count identifiers, no. of inputs and outputs in a Java program

I want to take a program as input and I want to find out: No. of identifiers No. of unique lines containing identifiers No. of identifiers in the set of unique lines No. of inputs and outputs According to control structures in the program I want to assign a value to control structures If I calculate this I can do my project. This is ...

Producing Expressions from This Grammar with Recursive Descent

I've got a simple grammar. Actually, the grammar I'm using is more complex, but this is the smallest subset that illustrates my question. Expr ::= Value Suffix | "(" Expr ")" Suffix Suffix ::= "->" Expr | "<-" Expr | Expr | epsilon Value matches identifiers, strings, numbers, et cetera. The Suffix ru...

separating names

Im trying to Separate Last name, First Name and Middle Initial. File is csv format, here is an example: A0001,3,Y,13,LU, A0001,3,Y,13,CLARK P, A0001,3,Y,13,SMITH JOHN, A0001,3,Y,13,BEAL KRISS J, A0001,3,Y,13,THOMAS A CLIFF C, A0001,3,Y,13,DEW III ROBERT H, Output fields : Last name First name I...

jquery issue with numbers starting wth zero

At the top of my script I have created a variable out of todays date: <?php $today = date('dmy'); ?> I then have a table and each table row has a class either of "nodate" or of a six digit number, this number represents a date. eg 230910 (yesterday). I am trying to write some jquery that hides the table row if the class (six digits) ...

Why does my JavaCC parser not parse tokens smaller than 2 characters?

I'm working on a JavaCC parser that should parse BBcodes. My Javacc source code: patebin.com (Junit test: here) The source code kind off works, but it does not want to accept tokens with a single character, only multi character strings are recognized. It does parse this string: "test[b]bold[/b]nothing[b]bold[/b]after" But not: "t[b...

Bash: Split text-file into words with non-alphanumeric characters as delimiters

Lets say "textfile" contains the following: lorem$ipsum-is9simply the.dummy text%of-printing and that you want to print each word on a separate line. However, words should be defined not only by spaces, but by all non-alphanumeric characters. So the results should look like: lorem ipsum is9simply the dummy text of ...

Parse js arrays in ruby

Hi All, i've js file that holds Array objects and data assigns var A_1_val = new Array(7); var B_1_txt = new Array(7); A_1_val[0] = '111'; B_1_txt[0] = 'utf8_content'; A_1_val[1] = '222'; B_1_txt[1] = 'bar'; etc.. need to get these arrays in ruby. found http://github.com/jbarnette/johnson, but it can't correctly return a...

Javascript parses in some way the string parameters of functions?

When I try to pass a string to a function like so i="file:///bla/bla/bla"; Fade(i); i get Uncaught SyntaxError: Unexpected token : so i tried passing a literal in the function like f("img1.jpg"); and i got Uncaught ReferenceError: img1 is not defined (anonymous function) What is going on? (note that i am kind of new in js) In pa...

Parse very large xml files with PHP

Hey guys, I'm working on a PHP project, and I need to parse large XML file (>240MB) from URL I used xmlReader it works in localhost but not working on shared hosting (BlueHost) it shows 404 error! http://webmashing.com/meilleures-des/cronjob?type=sejours Is this action need a dedicated server? if yes please give me suggestion. by the ...

How can I parse different structures with Boost.Spirit.Qi?

In this example, employee structs are parsed in the form "employee{int, string, string, double}". I would like to know whether it is possible to modify this example to also parse different types of structs, like "intern{int, string, string}". Specifically, I would like to then pass the structure to a function overloaded on the structur...

Python tool for incorporating imported items

Is there a tool in python to rewrite some code which imports things such that it no longer has to import anything? Take a library that draws a box called box.py def box(text='Hello, World!') draw the box magic return Now in another program (we'll call it warning.py) it says: from box import box box('Warning, water found in ...

How can I use regular expressions and javascript to split the following command into tokens:

filter -n ""function(file) { return file.owner == "john"; }"" should be parsed into the following array: [ 'filter', '-n', 'function(file) { return file.owner == "john"; }' ] ...

Stanford parser - typed dependencies

The typed dependencies given by stanford parser online http://nlp.stanford.edu:8080/parser/ and the dependencies generated by the sourcecode given aren't same The versions of source codes available in stanford website does not generate abbrev,possesive and poss tags. Which version of stanford parser to use for generating these tags? ...

How does an LL parser evaluate this expression?

Considering this expression: 3 + 2 + 2 * 2 = ? Would it be 14? ...

Best language to do text parsing in?

I frequently find myself writing small programs to parse text files (typically CSV files) and find that I always fall back on writing these parsers in Java simply because that's the language I'm most familiar with. But since this sort of task keeps coming up, what language would people recommend I use for this kind of task? I'm happy to...

scala: parser help

I'm learning to write a simple parser-combinator. I'm writing the rules from bottom up and write unit-tests to verify as I go. However, I'm blocked at using repsep() with whitespace as the separator. object MyParser extends RegexParsers { lazy val listVal:Parser[List[String]]=elem('{')<~repsep("""\d+""".r,"""\s+""".r)~>elem('}') } T...

C# Parsing hidden fields with the HTML Agility Pack

I need to write an application for a friends site which parses hidden fields. I've downloaded the Html Agility Pack library, but I'm kinda confused because there are not really any examples. The HTML field looks like this: <input type = "hidden" autocomplete="off" value="randomvalue" name="foo"> How would I go about getting the value ...

Difference between typecasting and parsing?

What is the big difference between parsing and typecasting? I try to use type casting to a string and it gives me error. Something like this: string str = "10"; int i = (int) str; ...

How to write a parser for haml-like languages?

I want to write a parser and converter of haml-like languages, to parse them, and convert them into html content. I found people usually use regular-expression to do this, but we have to write a lot of difficult regular expressions, which is not easy. Is there any tools or libraries to do it? I hope it in java and easy to use. And, is ...

Iterating Over Regexp Matches with Sed and Bash?

How can I iterate over multi-line regexp matches using sed and bash? I'm trying to generate some quick docs from comments in a file, like so: /** * @name myFun * @return {int} */ I can extract every comment block using sed -n -e '/\/\*\*$/,/\*\/$/p', but now I'd like to stuff each match into a bash array so I can parse the details ...