ID:152291
 
Okay. I allow functions to be defined in this language. I look for functions by searching function, and the entire function will be mapped into an associative list for easy recall. However, while findText'ing function, how do I know it's not in a string or function?

Well, I thought of searching the brackets. If the left bracket had a lower findtext position than the function tag was found AND the right bracket had a higher findtext position than the function tag, it'd be inside a function. However, what if they simply forgot the last bracket on another procedure? Then how do I do this?

I could search for quote characters, but I'd never know how to. You can find quotes all over. Please helpx0rz/
http://www.unix.org.ua/orelly/java/langref/ch02_01.htm

In short, Lexical Analysis is how most multi-pass Interpreters and compilers do it. Basically, you match text to regular expressions, the first match (If you're being greedy, which may be easiest) is the one you assume it is, produce a relevant symbol to demonstrate what you found, add it to a stack and eat the text you matched. This technique strips out unwanted formating (Like whitespace) and clears up certain problems, including the one you stated.

I haven't the foggiest how easy or difficult this would be in DM, but you may find Lummox JR's regex library useful.
In response to Stephen001 (#1)
I'll look that up then, thank you. That link you posted is dead. I checked the main site, but I don't read those types of characters.

[Edit]
I've actually been taking that approach since last night when Popisfizzy so kindly shared the idea with me on his scripting language (which will be much more universal than mine--mine is specifically built for one game).

I've just been trying to figure out how I can take function blocks out of a script file and store them in a list for easier recall. I'm probably going to scrap this idea and just process code line by line, which are to be denoted by semicolons (except for block-creators (for lack of a better term) such as function and if statements). Each block of code will have an end statement that notifies the parser to escape the statement.

function dude(var/list/l, var/R) 
l = null;
R = "COOL";
if(!l)
world<<"Awesome";
end
end


All whitespace is ignored. If newline is reached before the semicolon or ending quote or bracket, an error is output. This is going to take some some time, but it'll be worth it. After Exscript in Console which doesn't allow users to create functions, is very messy, and hard to maintain, I think this will be seen as a great addition to the Console game. If you guys didn't know, I'm attempting to remake it.

http://consolebyond.blogspot.com