I've started working on a simple XML pull-parser, and as I've just defuzzed my mind on what's correct syntax in XML with regards to certain characters/sequences, ignorable whitespace and such (thank you, http://www.w3schools.com/xml/xml_elements.asp), I realized that I still don't know squat about what can be sketched up as the following...
Consider the following site:
http://maps.google.com
It has a main text input, where the user can type business, countries, provinces, cities, addresses and zip codes. I wonder which is the best way to implement a search like this. I realize that probably Google Maps uses a full text search with all kinds of data in the same table, and ...
I have a date of the form specified by RFC 2822 -- say Fri, 15 May 2009 17:58:28 +0000, as a string. Is there a quick and/or standard way to get it as a datetime object in Python 2.5? I tried to produce a strptime format string, but the +0000 timezone specifier confuses the parser.
...
I'm writing a grammar for a moderately sized language, and I'm trying to implement time literals of the form hh:mm:ss.
However, whenever I try to parse, for example, 12:34:56 as a timeLiteral, I get mismatched token exceptions on the digits. Does anyone know what I might be doing wrong?
Here are the relevant rules as currently defined:...
Is anyone aware of tutorials for walking ANTLR-generated ASTs in C#? The closest I was able to find is this, but it's not terribly helpful.
My goal is to walk through trees that I'm generating based on a domain-specific language that I'm working on, and to use the trees to output generated C# code.
A Java-based tutorial would be helpfu...
I'm writing a custom flex file to generate a lexer for use with JSyntaxpane.
The custom language I need to lex has different states that can be embedded into each other in a kind of stack.
I.E you could be writing an expression that has a single quoted string in it and then embed another expression within the string using a special tok...
I'm writing a grammar in YACC (actually Bison), and I'm having a shift/reduce problem. It results from including the postfix increment and decrement operators. Here is a trimmed down version of the grammar:
%token NUMBER ID INC DEC
%left '+' '-'
%left '*' '/'
%right PREINC
%left POSTINC
%%
expr: NUMBER
| ID
| ...
Hi,
I am reading in a text file using FileInputStream that puts the file contents into a byte array. I then convert the byte array into a String using new String(byte). Once I have the string I'm using String.split("\n") to split the file into a String array and then taking that string array and parsing it by doing a String.split(",...
Hey everyone,
I started using Visual Studio for writing my XUL, because it gives me intellisense and validation, as I use a special XUL xml-schema.
There are still some problems with this approach, that I want to fix to make VS a more usable XUL-IDE.
VS doesn't know anything about the chrome-protocol and gives me an error ("The URI pr...
I am trying to write a simple sql parser to break a sql statement into its basic parts. However, I'm having a problem with nested queries. An example illustrates best:
sql = "select * from Customers where id in (select customer_id from Orders where 1=1)"
Set re = New RegExp
re.IgnoreCase = True
re.Pattern = "^(.*)\swhere\s(.*)$"
re.Gl...
I have 9 different grammars. One of these will be loaded depending on what the first line of txt is on the file it is parsing.
I was thinking about deriving the lexer/parser spawning into sep. classes and then instantiating them as soon as I get a match -- not sure whether that would slow me down or not though. I guess some benchmarkin...
hi
if I have this strings:
"abc" = false
"123" = true
"ab2" = false
Is there any command like IsNumeric or something else that can identify if string has numbers?
thank's in advance
...
I am creating a type converter for use in a in-house library that should be able to convert from any type returned by a database (long, DBNull, bool, string, etc...) to any compatible type.
This all works fin and dandy for items that can either be casted:
try { return (T)value } catch(InvalidCaseException) { }
Or can be parsed:
see ...
Assume I have the following string:
<script language="javascript">
var league = new Array(
"Soccer","Germany - 2. Bundesliga","38542195","102","24 May 2009 14:00","24 May 2009 14:00","1X2","1","0"
);
var matches = new Array(
"125","1.FC Nurnberg - TSV 1860 Munich","24 May 2009 14:00","Sun, 24.05.09 14:00","1|...
I want to parse a list of (whitespace separated) pairs in the form of
name1=value1 name2=value2 ...
where:
NAME can contain anything except whitespace and equal sign
VALUE can contain anything except whitespace (including equal signs!)
The problem is getting the parser to match input like
name1=value1
as separate 'NAME EQUAL...
I'm looking to tokenize Java/Javascript-like expressions in javascript code. My input will be a string containing the expression, and the output needs to be an array of tokens.
What's the best practice for doing something like this? Do I need to iterate the string or is there a regular expression that will do this for me?
I need this t...
I would like to parse a string like this:
-o 1 --long "Some long string"
into this:
["-o", "1", "--long", 'Some long string']
or similar.
This is different than either getopt, or optparse, which start with sys.argv parsed input (like the output I have above). Is there a standard way to do this? Basically, this is "splitting" wh...
I wonder why a lot of programmers claim that Lua is faster then any other scripting language?
What did they do that is more efficient then other languages?
Is there something completely different in their approach?
What makes their code run faster then Python for example?
...
I'm attempting to do a simple bubble sort code to get familiar with list/string manip & method use, but for some reason, when I attempt to iterate through each value in the list to remove white space and values that are non ints, it skips some. I haven't even gotten to the bubble sorting part..
#test data: 45,5j, f,e,s , , , 45,q,
...
Hello all, I am using DOM Simple HTML Parser, and return this error:
Warning: file_get_contents(h**p://info.xxxx.org/eng/txt_detail.jsp?cid=2_8&channelid=3&primarykeyvalue=132234142&libid=2&doctype=1) [function.file-get-contents]: failed to open stream: Redirection limit reached
Somebody please help.
...