 +				while (lua_next(L, -2)) { // properties table
 +					const char *prop = lua_tostring(L, -2);
 +					if (streq(prop, "font"))
-+						SS(SCI_STYLESETFONT, reinterpret_cast<long>(lua_tostring(L, -1)));
++						SSS(SCI_STYLESETFONT, reinterpret_cast<long>(lua_tostring(L, -1)));
 +					else if (streq(prop, "size"))
-+						SS(SCI_STYLESETSIZE, static_cast<int>(lua_tointeger(L, -1)));
++						SSS(SCI_STYLESETSIZE, static_cast<int>(lua_tointeger(L, -1)));
 +					else if (streq(prop, "bold"))
-+						SS(SCI_STYLESETBOLD, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETBOLD, lua_toboolean(L, -1));
 +					else if (streq(prop, "italic"))
-+						SS(SCI_STYLESETITALIC, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETITALIC, lua_toboolean(L, -1));
 +					else if (streq(prop, "underline"))
-+						SS(SCI_STYLESETUNDERLINE, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETUNDERLINE, lua_toboolean(L, -1));
 +					else if (streq(prop, "fore"))
-+						SS(SCI_STYLESETFORE, static_cast<int>(lua_tointeger(L, -1)));
++						SSS(SCI_STYLESETFORE, static_cast<int>(lua_tointeger(L, -1)));
 +					else if (streq(prop, "back"))
-+						SS(SCI_STYLESETBACK, static_cast<int>(lua_tointeger(L, -1)));
++						SSS(SCI_STYLESETBACK, static_cast<int>(lua_tointeger(L, -1)));
 +					else if (streq(prop, "eolfilled"))
-+						SS(SCI_STYLESETEOLFILLED, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETEOLFILLED, lua_toboolean(L, -1));
 +					else if (streq(prop, "characterset"))
-+						SS(SCI_STYLESETCHARACTERSET,
-+						   static_cast<int>(lua_tointeger(L, -1)));
++						SSS(SCI_STYLESETCHARACTERSET,
++						    static_cast<int>(lua_tointeger(L, -1)));
 +					else if (streq(prop, "case"))
-+						SS(SCI_STYLESETCASE, static_cast<int>(lua_tointeger(L, -1)));
++						SSS(SCI_STYLESETCASE, static_cast<int>(lua_tointeger(L, -1)));
 +					else if (streq(prop, "visible"))
-+						SS(SCI_STYLESETVISIBLE, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETVISIBLE, lua_toboolean(L, -1));
 +					else if (streq(prop, "changeable"))
-+						SS(SCI_STYLESETCHANGEABLE, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETCHANGEABLE, lua_toboolean(L, -1));
 +					else if (streq(prop, "hotspot"))
-+						SS(SCI_STYLESETHOTSPOT, lua_toboolean(L, -1));
++						SSS(SCI_STYLESETHOTSPOT, lua_toboolean(L, -1));
 +					lua_pop(L, 1); // value
 +				}
 +				if (style_num == 32 && !cleared) {
 +					// Set all styles to style_default before loading individual ones.
-+					Platform::SendScintilla(wid, SCI_STYLECLEARALL);
++					SS(sci, SCI_STYLECLEARALL, 0, 0);
 +					cleared = true;
 +					lua_pushnil(L);
 +					lua_replace(L, -3);

+LexerModule lmLPeg(SCLEX_LPEG, LexerLPeg::LexerFactoryLPeg, "llpeg");
diff -r ffde119d297e src/Catalogue.cxx
--- scintilla/src/Catalogue.cxx	Wed Jul 28 17:54:24 2010 +1000
+++ scintilla/src/Catalogue.cxx	Tue Aug 17 22:27:08 2010 -0400
@@ -79,6 +79,8 @@
 
 //++Autogenerated -- run src/LexGen.py to regenerate

 
diff -r ffde119d297e src/ScintillaBase.cxx
--- scintilla/src/ScintillaBase.cxx	Wed Jul 28 17:54:24 2010 +1000
+++ scintilla/src/ScintillaBase.cxx	Fri Aug 20 22:26:52 2010 -0400
@@ -517,7 +517,12 @@
 	if (!pdoc->pli) {
 		pdoc->pli = new LexState(pdoc);
 	}
-	return static_cast<LexState *>(pdoc->pli);
+	// modified by Mitchell
+	LexState *state = static_cast<LexState *>(pdoc->pli);
+	state->PrivateCall(SCI_GETDIRECTFUNCTION, reinterpret_cast<void *>(WndProc(SCI_GETDIRECTFUNCTION, 0, 0)));
+	state->PrivateCall(SCI_SETDOCPOINTER, reinterpret_cast<void *>(WndProc(SCI_GETDIRECTPOINTER, 0, 0)));
+	return state;
+	// end modified by Mitchell
 }
 
 void LexState::SetLexerModule(const LexerModule *lex) {
@@ -534,7 +539,7 @@
 }
 
 void LexState::SetLexer(uptr_t wParam) {
-	lexLanguage = wParam;
+	lexLanguage = SCLEX_LPEG; // modified by Mitchell
 	if (lexLanguage == SCLEX_CONTAINER) {
 		SetLexerModule(0);
 	} else {
@@ -546,12 +551,13 @@
 }
 
 void LexState::SetLexerLanguage(const char *languageName) {
