|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
|
|
|
|
|
Pure Lua Version written by: William A Adams
|
|
|
|
|
Dramatic Speed Improvements by: Robert G Jakabosky
|
|
|
|
|
https://github.com/Wiladams/LAPHLibs/blob/master/laphlibs/luxl.lua
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
|
|
|
|
@ -20,10 +21,15 @@ local ffi = require "ffi"
|
|
|
|
|
local bit = require "bit"
|
|
|
|
|
local band = bit.band
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[
|
|
|
|
|
Types of characters; 0 is not valid, 1 is letters, 2 are digits
|
|
|
|
|
(including '.') and 3 whitespace.
|
|
|
|
|
Types of characters;
|
|
|
|
|
0 is not valid
|
|
|
|
|
1 is letters,
|
|
|
|
|
2 are digits (including '.')
|
|
|
|
|
3 whitespace
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
|
|
local char_type = ffi.new("const int[256]", {
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 3, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
@ -43,6 +49,8 @@ local char_type = ffi.new("const int[256]", {
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Internal states that the parser can be in at any given time.
|
|
|
|
|
local ST_START = 0; -- starting base state; default state
|
|
|
|
|
local ST_TEXT =1; -- text state
|
|
|
|
@ -198,6 +206,7 @@ struct parse_state {
|
|
|
|
|
int i;
|
|
|
|
|
int ix; /* index into buffer */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
local cclass_match = {
|
|
|
|
|