Skip to content

Instantly share code, notes, and snippets.

@ErisianArchitect
Created October 22, 2011 19:20
Show Gist options
  • Save ErisianArchitect/1306386 to your computer and use it in GitHub Desktop.
Save ErisianArchitect/1306386 to your computer and use it in GitHub Desktop.
Read config
//Also note, this is pseudo-code, when passing the index to a function, you want to pass it as a reference so that you can modify the index.
void Tokenize(string src)
{
int ind = 0;
string configName = empty;
while(ind < src.Length)
{
char c = src[ind];
if(c == '#')
{
configName = ReadIdentifier(src,ind);
}
else if(c == '"')
{
ReadQuotes(src,ind);
}
else if(IsWhiteSpace(c))
{
SkipWhiteSpace(src,ind);
}
else
Error();
}
}
@exallium
Copy link

error: i undefined

@ErisianArchitect
Copy link
Author

Oops, it's supposed to be "ind". I'll fix that right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment