!752
lib 1004739 // (latest?) aibo
import org.luaj.vm2.parser.LuaParserTokenManager;
import org.luaj.vm2.parser.LuaParserConstants;
import org.luaj.vm2.parser.Token;
import org.luaj.vm2.parser.SimpleCharStream;
p {
S lua = [[
function entry0 (o)
N=N + 1
local title = o.title or '(no title)'
fwrite('
%s\n', N, title)
end
]];
SimpleCharStream scs = new SimpleCharStream(new StringReader(lua));
LuaParserTokenManager tm = new LuaParserTokenManager(scs);
Token t;
while (licensed() && (t = tm.getNextToken()).kind != LuaParserConstants.EOF) {
S kindName = get(LuaParserConstants.tokenImage, t.kind);
print("Token: " + quote(t.image) + " (kind: " + t.kind + " / " + kindName + ")");
}
}