I need to quickly build a parser for a very simplified version of a html-like markup language in Java. In python, I would use pyparsing library to do this. Is there something similar for Java? Please, don't suggest libraries already out there for html parsing, my application is a school assignment which will demonstrate walking a tree of...
The software base I am developing for uses a signficant amount of yacc which I don't need to deal with. Some times I think it would be helpful in understanding some problems I find but most of the time I can get away with my complete ignorance of yacc.
My question are there enough new projects out there that still use yacc to warrant th...
I'm looking for an Earley parser generator that is able to generate Java output code,
i.e. that generates Java code for the lexer and parser, and allows to include actions
(realised as Java code) that are performed for the grammar rules.
I looked at two Earley parser generators that generate Java code (Pep and PEN)
but none of them seem...
I've been trying to deal with some delimited text files that have non standard delimiters (not comma/quote or tab delimited). The delimiters are random ASCII characters that don't show up often between the delimiters. After searching around, I've seem to have only found no solutions in .NET will suit my needs and the custom libraries t...
Hi.
I have a problem creating regular expression for the following task:
Suppose we have HTML-like text of the kind:
<x>...<y>a</y>...<y>b</y>...</x>
I want to get a collection of values inside "y" tags located inside given "x" tag, so the result of the above example would be a collection of two elements ["a","b"].
additionaly we k...
I have this code:
if (file.exists()) {
Document doc = builder.parse(file);
NodeList list = doc.getElementsByTagName("property");
System.out.println("XML Elements: ");
for (int ii = 0; ii < list.getLength(); ii++) {
line 2 gives following exception
E:\workspace\test\testDomain\src\com\test\ins\nxg\maps\Right.hbm.xml
...***jav...
I would like to be able to submit a form in an HTML source (string). In other words I need at least the ability to generate POST parameters from a string containing HTML source of the form. This is needed in unit tests for a Django project. I would like a solution that possibly;
Uses only standard Python library and Django.
Allows para...
Hi could you please help me parse the following in bash.
i have a file that has one entry per line, and each line has the following format.
"group:permissions:users"
where permissions and users could have more than one value separated by comas... like this
"grp1:create,delete:yo,el,ella"
what i want is to return the following
...
I have redirected some valuable information into a text file. How can I execute each line of that text file in a loop?
What im thinking is to double space my text file, then to use a loop to execute each line invidually. I'm hoping that when i double space the text file every string of commands will have their own line.
For example, t...
I am working on a compiler implementation and wish to check if the end of file has been reached?
I know that this can be done using the yywrap() function in the lex file, but the requirement is that we want if the EOF is explicitly defined as in the hex value 0x1a, then how do we reference that.
Example:
main()
{
printf("Check EO...
typedef union
{
uint ui[4];
} md5hash;
void main(void)
{
int opt;
while ((opt = getopt(argc, argv, "c:t:s:h:")) != -1) {
switch (opt) {
case 'h':
hash = optarg;
break;
default: /* '?' */
exit(EXIT_FAILURE);
}
}
md5hash hash;
sscanf(hash, "%x%x...
So here's what I'm looking to achieve. I would like to give my users a single google-like textbox where they can type their queries. And I would like them to be able to express semi-natural language such as
"view all between 1/1/2008 and 1/2/2008"
it's ok if the syntax has to be fairly structured and limited to this specific domain ...
I have a web service which returns tab delimited data (see sample below).
I need to parse this into an array or similar so I can create a navigation view of it.
I've managed to perform the web request and could parse an XML file, but my knowledge of Objective-C is small.
433 Eat
502 Not Fussed
442 British
443 Chinese
4...
I have an html table
<table border="0" width="100%">
<tr class="headerbg">
<th width="5%">
No
</th>
<th width="30%">
Name
</th>
<th width="20%">
Department or Division
</th>
<th width="25%">
...
I have an app that lets the user search over a number of fields for a string, When they view the detail record, they would like all occurrences of the string to be highlighted.
The detail form is made up of Labels and ListViews, most of which live inside of TabPanels (from the AJAX Control Toolkit). I'd like to avoid the use of brute fo...
Background
I want to be able to parse Javascript source in a Delphi Application. I need to be able to identify variables and functions within the source for the purpose of making changes to the code through later code. I understand that I probably need to use a lexer for this purpose but have not had much luck using the lexer which I fo...
Rails' ActiveSupport module extends the builtin ruby Time class with a number of methods.
Notably, there is the to_formatted_s method, which lets you write Time.now.to_formatted_s(:db) to get a string in Database format, rather than having to write ugly strftime format-strings everywhere.
My question is, is there a way to go backwards?...
How would you define your parser and lexer rules to parse a language that uses indentation for defining scope.
I have already googled and found a clever approach for parsing it by generating INDENT and DEDENT tokens in the lexer.
I will go deeper on this problem and post an answer if I come to something interesting, but I would like to...
It seems that the choice to use string parsing vs. regular expressions comes up on a regular basis for me anytime a situation arises that I need part of a string, information about said string, etc.
The reason that this comes up is that we're evaluating a soap header's action, after it has been parsed into something manageable via the O...
I am using a third party application and would like to change one of its files. The file is stored in XML but with an invalid doctype.
When I try to read use a it errors out becuase the doctype contains "file:///ReportWiz.dtd"
(as shown, with quotes) and I get an exception for cannot find file. Is there a way to tell the docbuilder to i...