lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

  Since I just uploaded a bunch of new modules based upon LPeg, I thought I
would mentioned them all in one announcement instead of a bunch of
announcements as they're somewhat releated.

  First off, there's org.conman.parsers.ip 1.0.2, which fixes a bug related
to parsing IPv6 addresses.

  And now, the new modules:


		Parses IPv4 and IPv6 addresses, but returns the address as
		text (instead of binary in network byte order as
		org.conman.parsers.ip does).


		Parses URLs, just like it says in the label.  


		Parses "gopher:" URLs.  These are different enough from the
		standard URL to warrant its own module.

		Parses "tel:" URIs.  Addmittedly this is a niche URI type,
		but I tend to work with them a lot so they get their own


		Parses "sip:" URIs.  Again, a niche URI type that I tend to
		work with a lot so I included this as well.

  The URL parsing modules can be combinded (since they're pretty much LPeg
expressions) much like:

		local gopher = require "org.conman.parsers.url.gopher"
		local sip    = require "org.conman.parsers.url.sip"
		local tel    = require ""
		local url    = require "org.conman.parsers.url.url"

		url = gopher + sip + + url -- [1]

		a = url:match "gopher://";
		b = url:match "sip:+1-(555)-555-1212;;user=phone"
		c = url:match "tel:+1-(555)-555-1212;ext=1234"
		d = url:match "";
		e = url:match "";
		f = url:match "";

  All are available via LuaRocks [2].


[1]	The module returns a table and not an
	LPeg expression because most of it is reused in the
	org.conman.parsers.sip module, due that you can embed tel: URIs in a
	sip: URI.

[2]	Except there is no LuaRocks for "org.conman.parsers.url".  I'm not
	sure if you can have a LuaRocks made up of *just* dependencies and
	no actual code.  I don't want to push things.