mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates to lauch files, add Utils with 7-Zip and lua
Known bug : .lauch file Generate doc doesn't work, it needs an update to luadocumentor.bat
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
--*-lua-*-
|
||||
package = "checks"
|
||||
version = "1.0-1"
|
||||
source = {
|
||||
url = "https://github.com/fab13n/checks/raw/master/checks-1.0-1.tar.gz",
|
||||
dir = "checks",
|
||||
}
|
||||
|
||||
description = {
|
||||
summary = "Easy, terse, readable and fast function arguments type checking",
|
||||
detailed = [[
|
||||
This library declares a `checks()` function and a
|
||||
`checkers` table, which allow to check the parameters
|
||||
passed to a Lua function in a fast and unobtrusive way.
|
||||
|
||||
Althought provided here as a standalone library, it is
|
||||
part of Sierra Wireless' Aleos Applicaion Framework,
|
||||
available under the Eclipse Public License, currently at:
|
||||
|
||||
https://github.com/SierraWireless/luasched
|
||||
|
||||
]],
|
||||
homepage = "https://github.com/SierraWireless/luasched",
|
||||
license = "Eclipse public license"
|
||||
}
|
||||
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
|
||||
build = {
|
||||
type = 'builtin',
|
||||
modules = {
|
||||
checks = 'checks.c'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
rock_manifest = {
|
||||
["checks-1.0-1.rockspec"] = "70af2f5dd173774a16b9e7cfdfd12ecd",
|
||||
lib = {
|
||||
["checks.dll"] = "5342726d76176ca95ebe25c7b07ca6ac"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
Eclipse Public License - v 1.0
|
||||
|
||||
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
|
||||
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
|
||||
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
||||
|
||||
1. DEFINITIONS
|
||||
|
||||
"Contribution" means:
|
||||
|
||||
a) in the case of the initial Contributor, the initial code and documentation
|
||||
distributed under this Agreement, and
|
||||
b) in the case of each subsequent Contributor:
|
||||
i) changes to the Program, and
|
||||
ii) additions to the Program;
|
||||
|
||||
where such changes and/or additions to the Program originate from and are
|
||||
distributed by that particular Contributor. A Contribution 'originates' from
|
||||
a Contributor if it was added to the Program by such Contributor itself or
|
||||
anyone acting on such Contributor's behalf. Contributions do not include
|
||||
additions to the Program which: (i) are separate modules of software
|
||||
distributed in conjunction with the Program under their own license
|
||||
agreement, and (ii) are not derivative works of the Program.
|
||||
|
||||
"Contributor" means any person or entity that distributes the Program.
|
||||
|
||||
"Licensed Patents" mean patent claims licensable by a Contributor which are
|
||||
necessarily infringed by the use or sale of its Contribution alone or when
|
||||
combined with the Program.
|
||||
|
||||
"Program" means the Contributions distributed in accordance with this Agreement.
|
||||
|
||||
"Recipient" means anyone who receives the Program under this Agreement,
|
||||
including all Contributors.
|
||||
|
||||
2. GRANT OF RIGHTS
|
||||
a) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free copyright license to
|
||||
reproduce, prepare derivative works of, publicly display, publicly perform,
|
||||
distribute and sublicense the Contribution of such Contributor, if any, and
|
||||
such derivative works, in source code and object code form.
|
||||
b) Subject to the terms of this Agreement, each Contributor hereby grants
|
||||
Recipient a non-exclusive, worldwide, royalty-free patent license under
|
||||
Licensed Patents to make, use, sell, offer to sell, import and otherwise
|
||||
transfer the Contribution of such Contributor, if any, in source code and
|
||||
object code form. This patent license shall apply to the combination of the
|
||||
Contribution and the Program if, at the time the Contribution is added by
|
||||
the Contributor, such addition of the Contribution causes such combination
|
||||
to be covered by the Licensed Patents. The patent license shall not apply
|
||||
to any other combinations which include the Contribution. No hardware per
|
||||
se is licensed hereunder.
|
||||
c) Recipient understands that although each Contributor grants the licenses to
|
||||
its Contributions set forth herein, no assurances are provided by any
|
||||
Contributor that the Program does not infringe the patent or other
|
||||
intellectual property rights of any other entity. Each Contributor
|
||||
disclaims any liability to Recipient for claims brought by any other entity
|
||||
based on infringement of intellectual property rights or otherwise. As a
|
||||
condition to exercising the rights and licenses granted hereunder, each
|
||||
Recipient hereby assumes sole responsibility to secure any other
|
||||
intellectual property rights needed, if any. For example, if a third party
|
||||
patent license is required to allow Recipient to distribute the Program, it
|
||||
is Recipient's responsibility to acquire that license before distributing
|
||||
the Program.
|
||||
d) Each Contributor represents that to its knowledge it has sufficient
|
||||
copyright rights in its Contribution, if any, to grant the copyright
|
||||
license set forth in this Agreement.
|
||||
|
||||
3. REQUIREMENTS
|
||||
|
||||
A Contributor may choose to distribute the Program in object code form under its
|
||||
own license agreement, provided that:
|
||||
|
||||
a) it complies with the terms and conditions of this Agreement; and
|
||||
b) its license agreement:
|
||||
i) effectively disclaims on behalf of all Contributors all warranties and
|
||||
conditions, express and implied, including warranties or conditions of
|
||||
title and non-infringement, and implied warranties or conditions of
|
||||
merchantability and fitness for a particular purpose;
|
||||
ii) effectively excludes on behalf of all Contributors all liability for
|
||||
damages, including direct, indirect, special, incidental and
|
||||
consequential damages, such as lost profits;
|
||||
iii) states that any provisions which differ from this Agreement are offered
|
||||
by that Contributor alone and not by any other party; and
|
||||
iv) states that source code for the Program is available from such
|
||||
Contributor, and informs licensees how to obtain it in a reasonable
|
||||
manner on or through a medium customarily used for software exchange.
|
||||
|
||||
When the Program is made available in source code form:
|
||||
|
||||
a) it must be made available under this Agreement; and
|
||||
b) a copy of this Agreement must be included with each copy of the Program.
|
||||
Contributors may not remove or alter any copyright notices contained within
|
||||
the Program.
|
||||
|
||||
Each Contributor must identify itself as the originator of its Contribution, if
|
||||
any, in a manner that reasonably allows subsequent Recipients to identify the
|
||||
originator of the Contribution.
|
||||
|
||||
4. COMMERCIAL DISTRIBUTION
|
||||
|
||||
Commercial distributors of software may accept certain responsibilities with
|
||||
respect to end users, business partners and the like. While this license is
|
||||
intended to facilitate the commercial use of the Program, the Contributor who
|
||||
includes the Program in a commercial product offering should do so in a manner
|
||||
which does not create potential liability for other Contributors. Therefore, if
|
||||
a Contributor includes the Program in a commercial product offering, such
|
||||
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
|
||||
every other Contributor ("Indemnified Contributor") against any losses, damages
|
||||
and costs (collectively "Losses") arising from claims, lawsuits and other legal
|
||||
actions brought by a third party against the Indemnified Contributor to the
|
||||
extent caused by the acts or omissions of such Commercial Contributor in
|
||||
connection with its distribution of the Program in a commercial product
|
||||
offering. The obligations in this section do not apply to any claims or Losses
|
||||
relating to any actual or alleged intellectual property infringement. In order
|
||||
to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
|
||||
Contributor in writing of such claim, and b) allow the Commercial Contributor to
|
||||
control, and cooperate with the Commercial Contributor in, the defense and any
|
||||
related settlement negotiations. The Indemnified Contributor may participate in
|
||||
any such claim at its own expense.
|
||||
|
||||
For example, a Contributor might include the Program in a commercial product
|
||||
offering, Product X. That Contributor is then a Commercial Contributor. If that
|
||||
Commercial Contributor then makes performance claims, or offers warranties
|
||||
related to Product X, those performance claims and warranties are such
|
||||
Commercial Contributor's responsibility alone. Under this section, the
|
||||
Commercial Contributor would have to defend claims against the other
|
||||
Contributors related to those performance claims and warranties, and if a court
|
||||
requires any other Contributor to pay any damages as a result, the Commercial
|
||||
Contributor must pay those damages.
|
||||
|
||||
5. NO WARRANTY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
|
||||
IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
|
||||
Recipient is solely responsible for determining the appropriateness of using and
|
||||
distributing the Program and assumes all risks associated with its exercise of
|
||||
rights under this Agreement , including but not limited to the risks and costs
|
||||
of program errors, compliance with applicable laws, damage to or loss of data,
|
||||
programs or equipment, and unavailability or interruption of operations.
|
||||
|
||||
6. DISCLAIMER OF LIABILITY
|
||||
|
||||
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
|
||||
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
|
||||
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
|
||||
GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. GENERAL
|
||||
|
||||
If any provision of this Agreement is invalid or unenforceable under applicable
|
||||
law, it shall not affect the validity or enforceability of the remainder of the
|
||||
terms of this Agreement, and without further action by the parties hereto, such
|
||||
provision shall be reformed to the minimum extent necessary to make such
|
||||
provision valid and enforceable.
|
||||
|
||||
If Recipient institutes patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
|
||||
(excluding combinations of the Program with other software or hardware)
|
||||
infringes such Recipient's patent(s), then such Recipient's rights granted under
|
||||
Section 2(b) shall terminate as of the date such litigation is filed.
|
||||
|
||||
All Recipient's rights under this Agreement shall terminate if it fails to
|
||||
comply with any of the material terms or conditions of this Agreement and does
|
||||
not cure such failure in a reasonable period of time after becoming aware of
|
||||
such noncompliance. If all Recipient's rights under this Agreement terminate,
|
||||
Recipient agrees to cease use and distribution of the Program as soon as
|
||||
reasonably practicable. However, Recipient's obligations under this Agreement
|
||||
and any licenses granted by Recipient relating to the Program shall continue and
|
||||
survive.
|
||||
|
||||
Everyone is permitted to copy and distribute copies of this Agreement, but in
|
||||
order to avoid inconsistency the Agreement is copyrighted and may only be
|
||||
modified in the following manner. The Agreement Steward reserves the right to
|
||||
publish new versions (including revisions) of this Agreement from time to time.
|
||||
No one other than the Agreement Steward has the right to modify this Agreement.
|
||||
The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation
|
||||
may assign the responsibility to serve as the Agreement Steward to a suitable
|
||||
separate entity. Each new version of the Agreement will be given a
|
||||
distinguishing version number. The Program (including Contributions) may always
|
||||
be distributed subject to the version of the Agreement under which it was
|
||||
received. In addition, after a new version of the Agreement is published,
|
||||
Contributor may elect to distribute the Program (including its Contributions)
|
||||
under the new version. Except as expressly stated in Sections 2(a) and 2(b)
|
||||
above, Recipient receives no rights or licenses to the intellectual property of
|
||||
any Contributor under this Agreement, whether expressly, by implication,
|
||||
estoppel or otherwise. All rights in the Program not expressly granted under
|
||||
this Agreement are reserved.
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the
|
||||
intellectual property laws of the United States of America. No party to this
|
||||
Agreement will bring a legal action under this Agreement more than one year
|
||||
after the cause of action arose. Each party waives its rights to a jury trial in
|
||||
any resulting litigation.
|
||||
@@ -0,0 +1,7 @@
|
||||
# Lua Documentor
|
||||
|
||||
LuaDocumentor allow users to generate HTML and API files from code documented
|
||||
using Lua documentation language.
|
||||
|
||||
Documentation is
|
||||
[available here](http://wiki.eclipse.org/Koneki/LDT/User_Area/LuaDocumentor).
|
||||
@@ -0,0 +1,57 @@
|
||||
package = 'LuaDocumentor'
|
||||
version = '0.1.5-1'
|
||||
description = {
|
||||
summary = 'LuaDocumentor allow users to generate HTML and API files from code documented using Lua documentation language.',
|
||||
detailed = [[
|
||||
This is an example for the LuaRocks tutorial.
|
||||
Here we would put a detailed, typically
|
||||
paragraph-long description.
|
||||
]],
|
||||
homepage = 'http://wiki.eclipse.org/Koneki/LDT/User_Area/LuaDocumentor',
|
||||
license = 'EPL'
|
||||
}
|
||||
source = {
|
||||
url = 'git://github.com/LuaDevelopmentTools/luadocumentor.git',
|
||||
tag = 'v0.1.5-1'
|
||||
}
|
||||
dependencies = {
|
||||
'lua ~> 5.1',
|
||||
'luafilesystem ~> 1.6',
|
||||
'markdown ~> 0.32',
|
||||
'metalua-compiler ~> 0.7',
|
||||
'penlight ~> 0.9'
|
||||
}
|
||||
build = {
|
||||
type = 'builtin',
|
||||
install = {
|
||||
bin = {
|
||||
luadocumentor = 'luadocumentor.lua'
|
||||
},
|
||||
lua = {
|
||||
['models.internalmodelbuilder'] = 'models/internalmodelbuilder.mlua'
|
||||
}
|
||||
},
|
||||
modules = {
|
||||
defaultcss = 'defaultcss.lua',
|
||||
docgenerator = 'docgenerator.lua',
|
||||
extractors = 'extractors.lua',
|
||||
lddextractor = 'lddextractor.lua',
|
||||
templateengine = 'templateengine.lua',
|
||||
|
||||
['fs.lfs'] = 'fs/lfs.lua',
|
||||
|
||||
['models.apimodel'] = 'models/apimodel.lua',
|
||||
['models.apimodelbuilder'] = 'models/apimodelbuilder.lua',
|
||||
['models.internalmodel'] = 'models/internalmodel.lua',
|
||||
['models.ldparser'] = 'models/ldparser.lua',
|
||||
|
||||
['template.file'] = 'template/file.lua',
|
||||
['template.index'] = 'template/index.lua',
|
||||
['template.index.recordtypedef'] = 'template/index/recordtypedef.lua',
|
||||
['template.item'] = 'template/item.lua',
|
||||
['template.page'] = 'template/page.lua',
|
||||
['template.recordtypedef'] = 'template/recordtypedef.lua',
|
||||
['template.usage'] = 'template/usage.lua',
|
||||
['template.utils'] = 'template/utils.lua',
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
rock_manifest = {
|
||||
bin = {
|
||||
luadocumentor = "bc5cc07f56db2cf1dbe80f0827332873"
|
||||
},
|
||||
doc = {
|
||||
LICENSE = "52a21f73ac77fd790dc40dc5acda0fc2",
|
||||
["README.md"] = "fcef1f43c69f3559b347d854b2626deb"
|
||||
},
|
||||
lua = {
|
||||
["defaultcss.lua"] = "dd9b2b89e5080972bbb52056247c0c65",
|
||||
["docgenerator.lua"] = "92d0a3947d88226340014d2f033be37f",
|
||||
["extractors.lua"] = "74191695e5217706ee355925e5ca40fa",
|
||||
fs = {
|
||||
["lfs.lua"] = "4d00f9bc942b02a86ccea16544d3e85d"
|
||||
},
|
||||
["lddextractor.lua"] = "56edde775a5d57818aa0a07b4f723536",
|
||||
models = {
|
||||
["apimodel.lua"] = "3c401de18691b1222b0ad253958260ee",
|
||||
["apimodelbuilder.lua"] = "4c4a3c0b48b404973542dd99f994eb2c",
|
||||
["internalmodel.lua"] = "a1a21e50af8db0f0a0b9d164ccc08853",
|
||||
["internalmodelbuilder.mlua"] = "ff95dfca573ccc1c19a79434e96a492d",
|
||||
["ldparser.lua"] = "538904a3adbfff4ff83deda029847323"
|
||||
},
|
||||
template = {
|
||||
["file.lua"] = "41f095bc049ef161060d8e3b4ac9de63",
|
||||
index = {
|
||||
["recordtypedef.lua"] = "0977ff0048a837389c2ac10285eb1ce1"
|
||||
},
|
||||
["index.lua"] = "5a3b3cface3b1fd9cb2d56f1edd5487b",
|
||||
["item.lua"] = "5d5a6d9bffd8935c4ed283105ede331b",
|
||||
["page.lua"] = "351f4a7215272f7e448faeece4945bc0",
|
||||
["recordtypedef.lua"] = "69938e1d60e94eed7f95b0999f1386ca",
|
||||
["usage.lua"] = "979503deb84877cb221130a5be7c1535",
|
||||
["utils.lua"] = "ad97fb4e3de9fb6480b25cdd877b50d9"
|
||||
},
|
||||
["templateengine.lua"] = "09bfc6350e14f4ab509d14fb0fb295c0"
|
||||
},
|
||||
["luadocumentor-0.1.5-1.rockspec"] = "4ba1b88898dce89e7fd8fb6a700496a4"
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
body {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: arial, helvetica, geneva, sans-serif;
|
||||
background-color:#ffffff; margin:0px;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
tt {
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
body, td, th { font-size: 11pt; }
|
||||
|
||||
h1, h2, h3, h4 { margin-left: 0em; }
|
||||
|
||||
textarea, pre, tt { font-size:10pt; }
|
||||
body, td, th { color:#000000; }
|
||||
small { font-size:0.85em; }
|
||||
h1 { font-size:1.5em; }
|
||||
h2 { font-size:1.25em; }
|
||||
h3 { font-size:1.15em; }
|
||||
h4 { font-size:1.06em; }
|
||||
|
||||
a:link { font-weight:bold; color: #004080; text-decoration: none; }
|
||||
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
|
||||
a:link:hover { text-decoration:underline; }
|
||||
hr { color:#cccccc }
|
||||
img { border-width: 0px; }
|
||||
|
||||
h3 { padding-top: 1em; }
|
||||
|
||||
p { margin-left: 1em; }
|
||||
|
||||
p.name {
|
||||
font-family: "Andale Mono", monospace;
|
||||
padding-top: 1em;
|
||||
margin-left: 0em;
|
||||
}
|
||||
|
||||
blockquote { margin-left: 3em; }
|
||||
|
||||
.example {
|
||||
background-color: rgb(245, 245, 245);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-right-style: solid;
|
||||
border-bottom-style: solid;
|
||||
border-left-style: solid;
|
||||
border-top-color: silver;
|
||||
border-right-color: silver;
|
||||
border-bottom-color: silver;
|
||||
border-left-color: silver;
|
||||
padding: 1em;
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin-left: 0em;
|
||||
background: #00007f;
|
||||
border: 0px;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
|
||||
table.index { border: 1px #00007f; }
|
||||
table.index td { text-align: left; vertical-align: top; }
|
||||
table.index ul { padding-top: 0em; margin-top: 0em; }
|
||||
|
||||
table {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
th {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
padding: 0.5em;
|
||||
}
|
||||
div.header, div.footer { margin-left: 0em; }
|
||||
|
||||
#container {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#product {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#product big {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#product_logo {
|
||||
}
|
||||
|
||||
#product_name {
|
||||
}
|
||||
|
||||
#product_description {
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #f0f0f0;
|
||||
border-left: 2px solid #cccccc;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
float: left;
|
||||
width: 12em;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
background-color: #f0f0f0;
|
||||
overflow:visible;
|
||||
}
|
||||
|
||||
#navigation h1 {
|
||||
background-color:#e7e7e7;
|
||||
font-size:1.1em;
|
||||
color:#000000;
|
||||
text-align:left;
|
||||
margin:0px;
|
||||
padding:0.2em;
|
||||
border-top:1px solid #dddddd;
|
||||
border-bottom:1px solid #dddddd;
|
||||
}
|
||||
|
||||
#navigation ul {
|
||||
font-size:1em;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
#navigation li {
|
||||
text-indent: -1em;
|
||||
margin: 0em 0em 0em 0.5em;
|
||||
display: block;
|
||||
padding: 3px 0px 0px 12px;
|
||||
}
|
||||
|
||||
#navigation li li a {
|
||||
padding: 0px 3px 0px -1em;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 12em;
|
||||
padding: 1em;
|
||||
border-left: 2px solid #cccccc;
|
||||
border-right: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#about {
|
||||
clear: both;
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
border-top: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font: 10pt "Times New Roman", "TimeNR", Times, serif;
|
||||
}
|
||||
a {
|
||||
font-weight:bold; color: #004080; text-decoration: underline;
|
||||
}
|
||||
#main {
|
||||
background-color: #ffffff; border-left: 0px;
|
||||
}
|
||||
#container {
|
||||
margin-left: 2%; margin-right: 2%; background-color: #ffffff;
|
||||
}
|
||||
#content {
|
||||
margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff;
|
||||
}
|
||||
#navigation {
|
||||
display: none;
|
||||
}
|
||||
#product_logo {
|
||||
display: none;
|
||||
}
|
||||
#about img {
|
||||
display: none;
|
||||
}
|
||||
.example {
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: 8pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>LuaFileSystem</title>
|
||||
<link rel="stylesheet" href="doc.css" type="text/css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo">
|
||||
<a href="http://www.keplerproject.org">
|
||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<div id="product_name"><big><strong>LuaFileSystem</strong></big></div>
|
||||
<div id="product_description">File System Library for the Lua Programming Language</div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="navigation">
|
||||
<h1>LuaFileSystem</h1>
|
||||
<ul>
|
||||
<li><a href="index.html">Home</a>
|
||||
<ul>
|
||||
<li><a href="index.html#overview">Overview</a></li>
|
||||
<li><a href="index.html#status">Status</a></li>
|
||||
<li><a href="index.html#download">Download</a></li>
|
||||
<li><a href="index.html#history">History</a></li>
|
||||
<li><a href="index.html#credits">Credits</a></li>
|
||||
<li><a href="index.html#contact">Contact us</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="manual.html">Manual</a>
|
||||
<ul>
|
||||
<li><a href="manual.html#introduction">Introduction</a></li>
|
||||
<li><a href="manual.html#building">Building</a></li>
|
||||
<li><a href="manual.html#installation">Installation</a></li>
|
||||
<li><a href="manual.html#reference">Reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Examples</strong></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
||||
<ul>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="license.html">License</a></li>
|
||||
</ul>
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h2><a name="example"></a>Examples</h2>
|
||||
|
||||
<h3>Directory iterator</h3>
|
||||
|
||||
<p>The following example iterates over a directory and recursively lists the
|
||||
attributes for each file inside it.</p>
|
||||
|
||||
<pre class="example">
|
||||
local lfs = require"lfs"
|
||||
|
||||
function attrdir (path)
|
||||
for file in lfs.dir(path) do
|
||||
if file ~= "." and file ~= ".." then
|
||||
local f = path..'/'..file
|
||||
print ("\t "..f)
|
||||
local attr = lfs.attributes (f)
|
||||
assert (type(attr) == "table")
|
||||
if attr.mode == "directory" then
|
||||
attrdir (f)
|
||||
else
|
||||
for name, value in pairs(attr) do
|
||||
print (name, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
attrdir (".")
|
||||
</pre>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
|
||||
</div> <!-- id="main" -->
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||
<p><small>$Id: examples.html,v 1.8 2007/12/14 15:28:04 carregal Exp $</small></p>
|
||||
</div> <!-- id="about" -->
|
||||
|
||||
</div> <!-- id="container" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,218 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>LuaFileSystem</title>
|
||||
<link rel="stylesheet" href="doc.css" type="text/css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo">
|
||||
<a href="http://www.keplerproject.org">
|
||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<div id="product_name"><big><strong>LuaFileSystem</strong></big></div>
|
||||
<div id="product_description">File System Library for the Lua Programming Language</div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="navigation">
|
||||
<h1>LuaFileSystem</h1>
|
||||
<ul>
|
||||
<li><strong>Home</strong>
|
||||
<ul>
|
||||
<li><a href="index.html#overview">Overview</a></li>
|
||||
<li><a href="index.html#status">Status</a></li>
|
||||
<li><a href="index.html#download">Download</a></li>
|
||||
<li><a href="index.html#history">History</a></li>
|
||||
<li><a href="index.html#credits">Credits</a></li>
|
||||
<li><a href="index.html#contact">Contact us</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="manual.html">Manual</a>
|
||||
<ul>
|
||||
<li><a href="manual.html#introduction">Introduction</a></li>
|
||||
<li><a href="manual.html#building">Building</a></li>
|
||||
<li><a href="manual.html#installation">Installation</a></li>
|
||||
<li><a href="manual.html#reference">Reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="examples.html">Examples</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
||||
<ul>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="license.html">License</a></li>
|
||||
</ul>
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h2><a name="overview"></a>Overview</h2>
|
||||
|
||||
<p>LuaFileSystem is a <a href="http://www.lua.org">Lua</a> library
|
||||
developed to complement the set of functions related to file
|
||||
systems offered by the standard Lua distribution.</p>
|
||||
|
||||
<p>LuaFileSystem offers a portable way to access
|
||||
the underlying directory structure and file attributes.</p>
|
||||
|
||||
<p>LuaFileSystem is free software and uses the same
|
||||
<a href="license.html">license</a> as Lua 5.1.</p>
|
||||
|
||||
<h2><a name="status"></a>Status</h2>
|
||||
|
||||
<p>Current version is 1.6.3. It works with Lua 5.1, 5.2 and 5.3.</p>
|
||||
|
||||
<h2><a name="download"></a>Download</h2>
|
||||
|
||||
<p>LuaFileSystem source can be downloaded from its
|
||||
<a href="http://github.com/keplerproject/luafilesystem">Github</a>
|
||||
page.</p>
|
||||
|
||||
<h2><a name="history"></a>History</h2>
|
||||
|
||||
<dl class="history">
|
||||
<dt><strong>Version 1.6.3</strong> [15/Jan/2015]</dt>
|
||||
<dd><ul>
|
||||
<li>Lua 5.3 support.</li>
|
||||
<li>Assorted bugfixes.</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt><strong>Version 1.6.2</strong> [??/Oct/2012]</dt>
|
||||
<dd><ul>
|
||||
<li>Full Lua 5.2 compatibility (with Lua 5.1 fallbacks)</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt><strong>Version 1.6.1</strong> [01/Oct/2012]</dt>
|
||||
<dd><ul>
|
||||
<li>fix build for Lua 5.2</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt><strong>Version 1.6.0</strong> [26/Sep/2012]</dt>
|
||||
<dd><ul>
|
||||
<li>getcwd fix for Android</li>
|
||||
<li>support for Lua 5.2</li>
|
||||
<li>add lfs.link</li>
|
||||
<li>other bug fixes</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt><strong>Version 1.5.0</strong> [20/Oct/2009]</dt>
|
||||
<dd><ul>
|
||||
<li>Added explicit next and close methods to second return value of lfs.dir
|
||||
(the directory object), for explicit iteration or explicit closing.</li>
|
||||
<li>Added directory locking via lfs.lock_dir function (see the <a href="manual.html">manual</a>).</li>
|
||||
</ul></dd>
|
||||
<dt><strong>Version 1.4.2</strong> [03/Feb/2009]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>fixed bug [<a href="http://luaforge.net/tracker/?func=detail&group_id=66&aid=13198&atid=356">#13198</a>]
|
||||
lfs.attributes(filename, 'size') overflow on files > 2 Gb again (bug report and patch by KUBO Takehiro).</li>
|
||||
<li>fixed bug [<a href="http://luaforge.net/tracker/?group_id=66&atid=356&func=detail&aid=39794">#39794</a>]
|
||||
Compile error on Solaris 10 (bug report and patch by Aaron B).</li>
|
||||
<li>fixed compilation problems with Borland C.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.4.1</strong> [07/May/2008]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>documentation review</li>
|
||||
<li>fixed Windows compilation issues</li>
|
||||
<li>fixed bug in the Windows tests (patch by Shmuel Zeigerman)</li>
|
||||
<li>fixed bug [<a href="http://luaforge.net/tracker/?func=detail&group_id=66&aid=2185&atid=356">#2185</a>]
|
||||
<code>lfs.attributes(filename, 'size')</code> overflow on files > 2 Gb
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.4.0</strong> [13/Feb/2008]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>added function
|
||||
<a href="manual.html#setmode"><code>lfs.setmode</code></a>
|
||||
(works only in Windows systems).</li>
|
||||
<li><a href="manual.html#attributes"><code>lfs.attributes</code></a>
|
||||
raises an error if attribute does not exist</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.3.0</strong> [26/Oct/2007]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>added function
|
||||
<a href="manual.html#symlinkattributes"><code>lfs.symlinkattributes</code></a>
|
||||
(works only in non Windows systems).</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.2.1</strong> [08/May/2007]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>compatible only with Lua 5.1 (Lua 5.0 support was dropped)</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.2</strong> [15/Mar/2006]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>added optional argument to
|
||||
<a href="manual.html#attributes"><code>lfs.attributes</code></a></li>
|
||||
<li>added function
|
||||
<a href="manual.html#rmdir"><code>lfs.rmdir</code></a></li>
|
||||
<li>bug correction on <a href="manual.html#dir"><code>lfs.dir</code></a></li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.1</strong> [30/May/2005]</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<li>added function <a href="manual.html#touch"><code>lfs.touch</code></a>.</li>
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
<dt><strong>Version 1.0</strong> [21/Jan/2005]</dt>
|
||||
<dd />
|
||||
|
||||
<dt><strong>Version 1.0 Beta</strong> [10/Nov/2004]</dt>
|
||||
<dd />
|
||||
</dl>
|
||||
|
||||
<h2><a name="credits"></a>Credits</h2>
|
||||
|
||||
<p>LuaFileSystem was designed by Roberto Ierusalimschy,
|
||||
André Carregal and Tomás Guisasola as part of the
|
||||
<a href="http://www.keplerproject.org">Kepler Project</a>,
|
||||
which holds its copyright. LuaFileSystem is currently maintained by Fábio Mascarenhas.</p>
|
||||
|
||||
<h2><a name="contact"></a>Contact us</h2>
|
||||
|
||||
<p>For more information please
|
||||
<a href="mailto:info-NO-SPAM-THANKS@keplerproject.org">contact us</a>.
|
||||
Comments are welcome!</p>
|
||||
|
||||
<p>You can also reach other Kepler developers and users on the Kepler Project
|
||||
<a href="http://luaforge.net/mail/?group_id=104">mailing list</a>.</p>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
|
||||
</div> <!-- id="main" -->
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||
<p><small>$Id: index.html,v 1.44 2009/02/04 21:21:33 carregal Exp $</small></p>
|
||||
</div> <!-- id="about" -->
|
||||
|
||||
</div> <!-- id="container" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,122 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>LuaFileSystem</title>
|
||||
<link rel="stylesheet" href="doc.css" type="text/css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo">
|
||||
<a href="http://www.keplerproject.org">
|
||||
<img alt="LuaFileSystem" src="luafilesystem.png"/>
|
||||
</a>
|
||||
</div>
|
||||
<div id="product_name"><big><strong>LuaFileSystem</strong></big></div>
|
||||
<div id="product_description">File System Library for the Lua Programming Language</div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="navigation">
|
||||
<h1>LuaFileSystem</h1>
|
||||
<ul>
|
||||
<li><a href="index.html">Home</a>
|
||||
<ul>
|
||||
<li><a href="index.html#overview">Overview</a></li>
|
||||
<li><a href="index.html#status">Status</a></li>
|
||||
<li><a href="index.html#download">Download</a></li>
|
||||
<li><a href="index.html#history">History</a></li>
|
||||
<li><a href="index.html#credits">Credits</a></li>
|
||||
<li><a href="index.html#contact">Contact us</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="manual.html">Manual</a>
|
||||
<ul>
|
||||
<li><a href="manual.html#introduction">Introduction</a></li>
|
||||
<li><a href="manual.html#building">Building</a></li>
|
||||
<li><a href="manual.html#installation">Installation</a></li>
|
||||
<li><a href="manual.html#reference">Reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="examples.html">Examples</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
||||
<ul>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues/">Bug Tracker</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>License</strong></li>
|
||||
</ul>
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>License</h1>
|
||||
|
||||
<p>
|
||||
LuaFileSystem is free software: it can be used for both academic
|
||||
and commercial purposes at absolutely no cost. There are no
|
||||
royalties or GNU-like "copyleft" restrictions. LuaFileSystem
|
||||
qualifies as
|
||||
<a href="http://www.opensource.org/docs/definition.html">Open Source</a>
|
||||
software.
|
||||
Its licenses are compatible with
|
||||
<a href="http://www.gnu.org/licenses/gpl.html">GPL</a>.
|
||||
LuaFileSystem is not in the public domain and the
|
||||
<a href="http://www.keplerproject.org">Kepler Project</a>
|
||||
keep its copyright.
|
||||
The legal details are below.
|
||||
</p>
|
||||
|
||||
<p>The spirit of the license is that you are free to use
|
||||
LuaFileSystem for any purpose at no cost without having to ask us.
|
||||
The only requirement is that if you do use LuaFileSystem, then you
|
||||
should give us credit by including the appropriate copyright notice
|
||||
somewhere in your product or its documentation.</p>
|
||||
|
||||
<p>The LuaFileSystem library is designed and implemented by Roberto
|
||||
Ierusalimschy, André Carregal and Tomás Guisasola.
|
||||
The implementation is not derived from licensed software.</p>
|
||||
|
||||
<hr/>
|
||||
<p>Copyright © 2003 Kepler Project.</p>
|
||||
|
||||
<p>Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy,
|
||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:</p>
|
||||
|
||||
<p>The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.</p>
|
||||
|
||||
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.</p>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
|
||||
</div> <!-- id="main" -->
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||
<p><small>$Id: license.html,v 1.13 2008/02/11 22:42:21 carregal Exp $</small></p>
|
||||
</div><!-- id="about" -->
|
||||
|
||||
</div><!-- id="container" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
@@ -0,0 +1,280 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>LuaFileSystem</title>
|
||||
<link rel="stylesheet" href="doc.css" type="text/css"/>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo">
|
||||
<a href="http://www.keplerproject.org"><img alt="LuaFileSystem" src="luafilesystem.png"/></a>
|
||||
</div>
|
||||
<div id="product_name"><big><strong>LuaFileSystem</strong></big></div>
|
||||
<div id="product_description">File System Library for the Lua Programming Language</div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="navigation">
|
||||
<h1>LuaFileSystem</h1>
|
||||
<ul>
|
||||
<li><a href="index.html">Home</a>
|
||||
<ul>
|
||||
<li><a href="index.html#overview">Overview</a></li>
|
||||
<li><a href="index.html#status">Status</a></li>
|
||||
<li><a href="index.html#download">Download</a></li>
|
||||
<li><a href="index.html#history">History</a></li>
|
||||
<li><a href="index.html#credits">Credits</a></li>
|
||||
<li><a href="index.html#contact">Contact us</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Manual</strong>
|
||||
<ul>
|
||||
<li><a href="manual.html#introduction">Introduction</a></li>
|
||||
<li><a href="manual.html#building">Building</a></li>
|
||||
<li><a href="manual.html#installation">Installation</a></li>
|
||||
<li><a href="manual.html#reference">Reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="examples.html">Examples</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Project</a>
|
||||
<ul>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem/issues">Bug Tracker</a></li>
|
||||
<li><a href="https://github.com/keplerproject/luafilesystem">Git</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="license.html">License</a></li>
|
||||
</ul>
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h2><a name="introduction"></a>Introduction</h2>
|
||||
|
||||
<p>LuaFileSystem is a <a href="http://www.lua.org">Lua</a> library
|
||||
developed to complement the set of functions related to file
|
||||
systems offered by the standard Lua distribution.</p>
|
||||
|
||||
<p>LuaFileSystem offers a portable way to access
|
||||
the underlying directory structure and file attributes.</p>
|
||||
|
||||
<h2><a name="building"></a>Building</h2>
|
||||
|
||||
<p>
|
||||
LuaFileSystem should be built with Lua 5.1 so the language library
|
||||
and header files for the target version must be installed properly.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
LuaFileSystem offers a Makefile and a separate configuration file,
|
||||
<code>config</code>,
|
||||
which should be edited to suit your installation before running
|
||||
<code>make</code>.
|
||||
The file has some definitions like paths to the external libraries,
|
||||
compiler options and the like.
|
||||
</p>
|
||||
|
||||
<p>On Windows, the C runtime used to compile LuaFileSystem must be the same
|
||||
runtime that Lua uses, or some LuaFileSystem functions will not work.</p>
|
||||
|
||||
<h2><a name="installation"></a>Installation</h2>
|
||||
|
||||
<p>The easiest way to install LuaFileSystem is to use LuaRocks:</p>
|
||||
|
||||
<pre class="example">
|
||||
luarocks install luafilesystem
|
||||
</pre>
|
||||
|
||||
<p>If you prefer to install LuaFileSystem manually, the compiled binary should be copied to a directory in your
|
||||
<a href="http://www.lua.org/manual/5.1/manual.html#pdf-package.cpath">C path</a>.</p>
|
||||
|
||||
<h2><a name="reference"></a>Reference</h2>
|
||||
|
||||
<p>
|
||||
LuaFileSystem offers the following functions:
|
||||
</p>
|
||||
|
||||
<dl class="reference">
|
||||
<dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, aname])</code></strong></dt>
|
||||
<dd>Returns a table with the file attributes corresponding to
|
||||
<code>filepath</code> (or <code>nil</code> followed by an error message
|
||||
in case of error).
|
||||
If the second optional argument is given, then only the value of the
|
||||
named attribute is returned (this use is equivalent to
|
||||
<code>lfs.attributes(filepath).aname</code>, but the table is not created
|
||||
and only one attribute is retrieved from the O.S.).
|
||||
The attributes are described as follows;
|
||||
attribute <code>mode</code> is a string, all the others are numbers,
|
||||
and the time related attributes use the same time reference of
|
||||
<a href="http://www.lua.org/manual/5.1/manual.html#pdf-os.time"><code>os.time</code></a>:
|
||||
<dl>
|
||||
<dt><strong><code>dev</code></strong></dt>
|
||||
<dd>on Unix systems, this represents the device that the inode resides on. On Windows systems,
|
||||
represents the drive number of the disk containing the file</dd>
|
||||
|
||||
<dt><strong><code>ino</code></strong></dt>
|
||||
<dd>on Unix systems, this represents the inode number. On Windows systems this has no meaning</dd>
|
||||
|
||||
<dt><strong><code>mode</code></strong></dt>
|
||||
<dd>string representing the associated protection mode (the values could be
|
||||
<code>file</code>, <code>directory</code>, <code>link</code>, <code>socket</code>,
|
||||
<code>named pipe</code>, <code>char device</code>, <code>block device</code> or
|
||||
<code>other</code>)</dd>
|
||||
|
||||
<dt><strong><code>nlink</code></strong></dt>
|
||||
<dd>number of hard links to the file</dd>
|
||||
|
||||
<dt><strong><code>uid</code></strong></dt>
|
||||
<dd>user-id of owner (Unix only, always 0 on Windows)</dd>
|
||||
|
||||
<dt><strong><code>gid</code></strong></dt>
|
||||
<dd>group-id of owner (Unix only, always 0 on Windows)</dd>
|
||||
|
||||
<dt><strong><code>rdev</code></strong></dt>
|
||||
<dd>on Unix systems, represents the device type, for special file inodes.
|
||||
On Windows systems represents the same as <code>dev</code></dd>
|
||||
|
||||
<dt><strong><code>access</code></strong></dt>
|
||||
<dd>time of last access</dd>
|
||||
|
||||
<dt><strong><code>modification</code></strong></dt>
|
||||
<dd>time of last data modification</dd>
|
||||
|
||||
<dt><strong><code>change</code></strong></dt>
|
||||
<dd>time of last file status change</dd>
|
||||
|
||||
<dt><strong><code>size</code></strong></dt>
|
||||
<dd>file size, in bytes</dd>
|
||||
|
||||
<dt><strong><code>blocks</code></strong></dt>
|
||||
<dd>block allocated for file; (Unix only)</dd>
|
||||
|
||||
<dt><strong><code>blksize</code></strong></dt>
|
||||
<dd>optimal file system I/O blocksize; (Unix only)</dd>
|
||||
</dl>
|
||||
This function uses <code>stat</code> internally thus if the given
|
||||
<code>filepath</code> is a symbolic link, it is followed (if it points to
|
||||
another link the chain is followed recursively) and the information
|
||||
is about the file it refers to.
|
||||
To obtain information about the link itself, see function
|
||||
<a href="#symlinkattributes">lfs.symlinkattributes</a>.
|
||||
</dd>
|
||||
|
||||
<dt><a name="chdir"></a><strong><code>lfs.chdir (path)</code></strong></dt>
|
||||
<dd>Changes the current working directory to the given
|
||||
<code>path</code>.<br />
|
||||
Returns <code>true</code> in case of success or <code>nil</code> plus an
|
||||
error string.</dd>
|
||||
|
||||
<dt><a name="chdir"></a><strong><code>lfs.lock_dir(path, [seconds_stale])</code></strong></dt>
|
||||
<dd>Creates a lockfile (called lockfile.lfs) in <code>path</code> if it does not
|
||||
exist and returns the lock. If the lock already exists checks if
|
||||
it's stale, using the second parameter (default for the second
|
||||
parameter is <code>INT_MAX</code>, which in practice means the lock will never
|
||||
be stale. To free the the lock call <code>lock:free()</code>. <br/>
|
||||
In case of any errors it returns nil and the error message. In
|
||||
particular, if the lock exists and is not stale it returns the
|
||||
"File exists" message.</dd>
|
||||
|
||||
<dt><a name="getcwd"></a><strong><code>lfs.currentdir ()</code></strong></dt>
|
||||
<dd>Returns a string with the current working directory or <code>nil</code>
|
||||
plus an error string.</dd>
|
||||
|
||||
<dt><a name="dir"></a><strong><code>iter, dir_obj = lfs.dir (path)</code></strong></dt>
|
||||
<dd>
|
||||
Lua iterator over the entries of a given directory.
|
||||
Each time the iterator is called with <code>dir_obj</code> it returns a directory entry's name as a string, or
|
||||
<code>nil</code> if there are no more entries. You can also iterate by calling <code>dir_obj:next()</code>, and
|
||||
explicitly close the directory before the iteration finished with <code>dir_obj:close()</code>.
|
||||
Raises an error if <code>path</code> is not a directory.
|
||||
</dd>
|
||||
|
||||
<dt><a name="lock"></a><strong><code>lfs.lock (filehandle, mode[, start[, length]])</code></strong></dt>
|
||||
<dd>Locks a file or a part of it. This function works on <em>open files</em>; the
|
||||
file handle should be specified as the first argument.
|
||||
The string <code>mode</code> could be either
|
||||
<code>r</code> (for a read/shared lock) or <code>w</code> (for a
|
||||
write/exclusive lock). The optional arguments <code>start</code>
|
||||
and <code>length</code> can be used to specify a starting point and
|
||||
its length; both should be numbers.<br />
|
||||
Returns <code>true</code> if the operation was successful; in
|
||||
case of error, it returns <code>nil</code> plus an error string.
|
||||
</dd>
|
||||
|
||||
<dt><a name="link"></a><strong><code>lfs.link (old, new[, symlink])</code></strong></dt>
|
||||
<dd>Creates a link. The first argument is the object to link to
|
||||
and the second is the name of the link. If the optional third
|
||||
argument is true, the link will by a symbolic link (by default, a
|
||||
hard link is created).
|
||||
</dd>
|
||||
|
||||
<dt><a name="mkdir"></a><strong><code>lfs.mkdir (dirname)</code></strong></dt>
|
||||
<dd>Creates a new directory. The argument is the name of the new
|
||||
directory.<br />
|
||||
Returns <code>true</code> if the operation was successful;
|
||||
in case of error, it returns <code>nil</code> plus an error string.
|
||||
</dd>
|
||||
|
||||
<dt><a name="rmdir"></a><strong><code>lfs.rmdir (dirname)</code></strong></dt>
|
||||
<dd>Removes an existing directory. The argument is the name of the directory.<br />
|
||||
Returns <code>true</code> if the operation was successful;
|
||||
in case of error, it returns <code>nil</code> plus an error string.</dd>
|
||||
|
||||
<dt><a name="setmode"></a><strong><code>lfs.setmode (file, mode)</code></strong></dt>
|
||||
<dd>Sets the writing mode for a file. The mode string can be either <code>"binary"</code> or <code>"text"</code>.
|
||||
Returns <code>true</code> followed the previous mode string for the file, or
|
||||
<code>nil</code> followed by an error string in case of errors.
|
||||
On non-Windows platforms, where the two modes are identical,
|
||||
setting the mode has no effect, and the mode is always returned as <code>binary</code>.
|
||||
</dd>
|
||||
|
||||
<dt><a name="symlinkattributes"></a><strong><code>lfs.symlinkattributes (filepath [, aname])</code></strong></dt>
|
||||
<dd>Identical to <a href="#attributes">lfs.attributes</a> except that
|
||||
it obtains information about the link itself (not the file it refers to).
|
||||
On Windows this function does not yet support links, and is identical to
|
||||
<code>lfs.attributes</code>.
|
||||
</dd>
|
||||
|
||||
<dt><a name="touch"></a><strong><code>lfs.touch (filepath [, atime [, mtime]])</code></strong></dt>
|
||||
<dd>Set access and modification times of a file. This function is
|
||||
a bind to <code>utime</code> function. The first argument is the
|
||||
filename, the second argument (<code>atime</code>) is the access time,
|
||||
and the third argument (<code>mtime</code>) is the modification time.
|
||||
Both times are provided in seconds (which should be generated with
|
||||
Lua standard function <code>os.time</code>).
|
||||
If the modification time is omitted, the access time provided is used;
|
||||
if both times are omitted, the current time is used.<br />
|
||||
Returns <code>true</code> if the operation was successful;
|
||||
in case of error, it returns <code>nil</code> plus an error string.
|
||||
</dd>
|
||||
|
||||
<dt><a name="unlock"></a><strong><code>lfs.unlock (filehandle[, start[, length]])</code></strong></dt>
|
||||
<dd>Unlocks a file or a part of it. This function works on
|
||||
<em>open files</em>; the file handle should be specified as the first
|
||||
argument. The optional arguments <code>start</code> and
|
||||
<code>length</code> can be used to specify a starting point and its
|
||||
length; both should be numbers.<br />
|
||||
Returns <code>true</code> if the operation was successful;
|
||||
in case of error, it returns <code>nil</code> plus an error string.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
|
||||
</div> <!-- id="main" -->
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0!</a></p>
|
||||
<p><small>$Id: manual.html,v 1.45 2009/06/03 20:53:55 mascarenhas Exp $</small></p>
|
||||
</div> <!-- id="about" -->
|
||||
|
||||
</div> <!-- id="container" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,29 @@
|
||||
package = "LuaFileSystem"
|
||||
version = "1.6.3-2"
|
||||
source = {
|
||||
url = "git://github.com/keplerproject/luafilesystem",
|
||||
tag = "v_1_6_3"
|
||||
}
|
||||
description = {
|
||||
summary = "File System Library for the Lua Programming Language",
|
||||
detailed = [[
|
||||
LuaFileSystem is a Lua library developed to complement the set of
|
||||
functions related to file systems offered by the standard Lua
|
||||
distribution. LuaFileSystem offers a portable way to access the
|
||||
underlying directory structure and file attributes.
|
||||
]],
|
||||
homepage = "http://keplerproject.github.io/luafilesystem",
|
||||
license = "MIT/X11"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
lfs = "src/lfs.c"
|
||||
},
|
||||
copy_directories = {
|
||||
"doc", "tests"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
us = {
|
||||
["doc.css"] = "d0a913514fb190240b3b4033d105cbc0",
|
||||
["examples.html"] = "5832f72021728374cf57b621d62ce0ff",
|
||||
["index.html"] = "96885bdda963939f0a363b5fa6b16b59",
|
||||
["license.html"] = "e3a756835cb7c8ae277d5e513c8e32ee",
|
||||
["luafilesystem.png"] = "81e923e976e99f894ea0aa8b52baff29",
|
||||
["manual.html"] = "d6473799b73ce486c3ea436586cb3b34"
|
||||
}
|
||||
},
|
||||
lib = {
|
||||
["lfs.dll"] = "165694685cffa6014be4ca8cbb7d920b"
|
||||
},
|
||||
["luafilesystem-1.6.3-2.rockspec"] = "eb0ef7c190516892eb8357af799eea5f",
|
||||
tests = {
|
||||
["test.lua"] = "7b4ddb5bdb7e0b1b1ed0150d473535c9"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
#!/usr/bin/env lua5.1
|
||||
|
||||
local tmp = "/tmp"
|
||||
local sep = string.match (package.config, "[^\n]+")
|
||||
local upper = ".."
|
||||
|
||||
local lfs = require"lfs"
|
||||
print (lfs._VERSION)
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
function attrdir (path)
|
||||
for file in lfs.dir(path) do
|
||||
if file ~= "." and file ~= ".." then
|
||||
local f = path..sep..file
|
||||
print ("\t=> "..f.." <=")
|
||||
local attr = lfs.attributes (f)
|
||||
assert (type(attr) == "table")
|
||||
if attr.mode == "directory" then
|
||||
attrdir (f)
|
||||
else
|
||||
for name, value in pairs(attr) do
|
||||
print (name, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Checking changing directories
|
||||
local current = assert (lfs.currentdir())
|
||||
local reldir = string.gsub (current, "^.*%"..sep.."([^"..sep.."])$", "%1")
|
||||
assert (lfs.chdir (upper), "could not change to upper directory")
|
||||
assert (lfs.chdir (reldir), "could not change back to current directory")
|
||||
assert (lfs.currentdir() == current, "error trying to change directories")
|
||||
assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory")
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Changing creating and removing directories
|
||||
local tmpdir = current..sep.."lfs_tmp_dir"
|
||||
local tmpfile = tmpdir..sep.."tmp_file"
|
||||
-- Test for existence of a previous lfs_tmp_dir
|
||||
-- that may have resulted from an interrupted test execution and remove it
|
||||
if lfs.chdir (tmpdir) then
|
||||
assert (lfs.chdir (upper), "could not change to upper directory")
|
||||
assert (os.remove (tmpfile), "could not remove file from previous test")
|
||||
assert (lfs.rmdir (tmpdir), "could not remove directory from previous test")
|
||||
end
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- tries to create a directory
|
||||
assert (lfs.mkdir (tmpdir), "could not make a new directory")
|
||||
local attrib, errmsg = lfs.attributes (tmpdir)
|
||||
if not attrib then
|
||||
error ("could not get attributes of file `"..tmpdir.."':\n"..errmsg)
|
||||
end
|
||||
local f = io.open(tmpfile, "w")
|
||||
f:close()
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Change access time
|
||||
local testdate = os.time({ year = 2007, day = 10, month = 2, hour=0})
|
||||
assert (lfs.touch (tmpfile, testdate))
|
||||
local new_att = assert (lfs.attributes (tmpfile))
|
||||
assert (new_att.access == testdate, "could not set access time")
|
||||
assert (new_att.modification == testdate, "could not set modification time")
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Change access and modification time
|
||||
local testdate1 = os.time({ year = 2007, day = 10, month = 2, hour=0})
|
||||
local testdate2 = os.time({ year = 2007, day = 11, month = 2, hour=0})
|
||||
|
||||
assert (lfs.touch (tmpfile, testdate2, testdate1))
|
||||
local new_att = assert (lfs.attributes (tmpfile))
|
||||
assert (new_att.access == testdate2, "could not set access time")
|
||||
assert (new_att.modification == testdate1, "could not set modification time")
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Checking link (does not work on Windows)
|
||||
if lfs.link (tmpfile, "_a_link_for_test_", true) then
|
||||
assert (lfs.attributes"_a_link_for_test_".mode == "file")
|
||||
assert (lfs.symlinkattributes"_a_link_for_test_".mode == "link")
|
||||
assert (lfs.link (tmpfile, "_a_hard_link_for_test_"))
|
||||
assert (lfs.attributes (tmpfile, "nlink") == 2)
|
||||
assert (os.remove"_a_link_for_test_")
|
||||
assert (os.remove"_a_hard_link_for_test_")
|
||||
end
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Checking text/binary modes (only has an effect in Windows)
|
||||
local f = io.open(tmpfile, "w")
|
||||
local result, mode = lfs.setmode(f, "binary")
|
||||
assert(result) -- on non-Windows platforms, mode is always returned as "binary"
|
||||
result, mode = lfs.setmode(f, "text")
|
||||
assert(result and mode == "binary")
|
||||
f:close()
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Restore access time to current value
|
||||
assert (lfs.touch (tmpfile, attrib.access, attrib.modification))
|
||||
new_att = assert (lfs.attributes (tmpfile))
|
||||
assert (new_att.access == attrib.access)
|
||||
assert (new_att.modification == attrib.modification)
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Check consistency of lfs.attributes values
|
||||
local attr = lfs.attributes (tmpfile)
|
||||
for key, value in pairs(attr) do
|
||||
assert (value == lfs.attributes (tmpfile, key),
|
||||
"lfs.attributes values not consistent")
|
||||
end
|
||||
|
||||
-- Remove new file and directory
|
||||
assert (os.remove (tmpfile), "could not remove new file")
|
||||
assert (lfs.rmdir (tmpdir), "could not remove new directory")
|
||||
assert (lfs.mkdir (tmpdir..sep.."lfs_tmp_dir") == nil, "could create a directory inside a non-existent one")
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Trying to get attributes of a non-existent file
|
||||
assert (lfs.attributes ("this couldn't be an actual file") == nil, "could get attributes of a non-existent file")
|
||||
assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory")
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Stressing directory iterator
|
||||
count = 0
|
||||
for i = 1, 4000 do
|
||||
for file in lfs.dir (tmp) do
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- Stressing directory iterator, explicit version
|
||||
count = 0
|
||||
for i = 1, 4000 do
|
||||
local iter, dir = lfs.dir(tmp)
|
||||
local file = dir:next()
|
||||
while file do
|
||||
count = count + 1
|
||||
file = dir:next()
|
||||
end
|
||||
assert(not pcall(dir.next, dir))
|
||||
end
|
||||
|
||||
io.write(".")
|
||||
io.flush()
|
||||
|
||||
-- directory explicit close
|
||||
local iter, dir = lfs.dir(tmp)
|
||||
dir:close()
|
||||
assert(not pcall(dir.next, dir))
|
||||
print"Ok!"
|
||||
599
Utils/lua/5.1/lib/luarocks/rocks/manifest
Normal file
599
Utils/lua/5.1/lib/luarocks/rocks/manifest
Normal file
@@ -0,0 +1,599 @@
|
||||
commands = {
|
||||
luadocumentor = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
}
|
||||
}
|
||||
dependencies = {
|
||||
checks = {
|
||||
["1.0-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
},
|
||||
luadocumentor = {
|
||||
["0.1.5-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
1, 6, string = "1.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "luafilesystem"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
0, 32, string = "0.32"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "markdown"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
0, 7, string = "0.7"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "metalua-compiler"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
0, 9, string = "0.9"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "penlight"
|
||||
}
|
||||
}
|
||||
},
|
||||
luafilesystem = {
|
||||
["1.6.3-2"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
},
|
||||
markdown = {
|
||||
["0.32-2"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
},
|
||||
["metalua-compiler"] = {
|
||||
["0.7.3-1"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = "~>",
|
||||
version = {
|
||||
1, 6, string = "1.6"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "luafilesystem"
|
||||
}, {
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
0, 7, 3, string = "0.7.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "metalua-parser"
|
||||
}
|
||||
}
|
||||
},
|
||||
["metalua-parser"] = {
|
||||
["0.7.3-2"] = {
|
||||
{
|
||||
constraints = {
|
||||
{
|
||||
op = ">=",
|
||||
version = {
|
||||
5, 1, string = "5.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
name = "lua"
|
||||
}
|
||||
}
|
||||
},
|
||||
penlight = {
|
||||
["0.9.8-1"] = {
|
||||
{
|
||||
constraints = {},
|
||||
name = "luafilesystem"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
modules = {
|
||||
checks = {
|
||||
"checks/1.0-1"
|
||||
},
|
||||
defaultcss = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
docgenerator = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
extractors = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["fs.lfs"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
lddextractor = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
lfs = {
|
||||
"luafilesystem/1.6.3-2"
|
||||
},
|
||||
markdown = {
|
||||
"markdown/0.32-2"
|
||||
},
|
||||
["metalua.compiler"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.bytecode"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.bytecode.compile"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.bytecode.lcode"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.bytecode.ldump"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.bytecode.lopcodes"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.globals"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.compiler.parser"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.annot.generator"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.annot.grammar"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.expr"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.ext"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.lexer"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.meta"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.misc"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.stat"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.compiler.parser.table"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.grammar.generator"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.grammar.lexer"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua.loader"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua.pprint"] = {
|
||||
"metalua-parser/0.7.3-2"
|
||||
},
|
||||
["metalua/compiler/ast_to_src.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua/extension/comprehension.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua/extension/match.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua/repl.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua/treequery.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["metalua/treequery/walk.mlua"] = {
|
||||
"metalua-compiler/0.7.3-1"
|
||||
},
|
||||
["models.apimodel"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["models.apimodelbuilder"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["models.internalmodel"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["models.ldparser"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["models/internalmodelbuilder.mlua"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
pl = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.Date"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.List"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.Map"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.MultiMap"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.OrderedMap"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.Set"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.app"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.array2d"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.class"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.comprehension"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.config"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.data"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.dir"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.file"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.func"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.input"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.lapp"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.lexer"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.luabalanced"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.operator"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.path"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.permute"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.platf.luajava"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.pretty"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.seq"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.sip"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.strict"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.stringio"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.stringx"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.tablex"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.template"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.test"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.text"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.utils"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["pl.xml"] = {
|
||||
"penlight/0.9.8-1"
|
||||
},
|
||||
["template.file"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.index"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.index.recordtypedef"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.item"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.page"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.recordtypedef"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.usage"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
["template.utils"] = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
},
|
||||
templateengine = {
|
||||
"luadocumentor/0.1.5-1"
|
||||
}
|
||||
}
|
||||
repository = {
|
||||
checks = {
|
||||
["1.0-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
checks = "checks.dll"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
luadocumentor = {
|
||||
["0.1.5-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {
|
||||
luadocumentor = "luadocumentor"
|
||||
},
|
||||
dependencies = {
|
||||
luafilesystem = "1.6.3-2",
|
||||
markdown = "0.32-2",
|
||||
["metalua-compiler"] = "0.7.3-1",
|
||||
["metalua-parser"] = "0.7.3-2",
|
||||
penlight = "0.9.8-1"
|
||||
},
|
||||
modules = {
|
||||
defaultcss = "defaultcss.lua",
|
||||
docgenerator = "docgenerator.lua",
|
||||
extractors = "extractors.lua",
|
||||
["fs.lfs"] = "fs/lfs.lua",
|
||||
lddextractor = "lddextractor.lua",
|
||||
["models.apimodel"] = "models/apimodel.lua",
|
||||
["models.apimodelbuilder"] = "models/apimodelbuilder.lua",
|
||||
["models.internalmodel"] = "models/internalmodel.lua",
|
||||
["models.ldparser"] = "models/ldparser.lua",
|
||||
["models/internalmodelbuilder.mlua"] = "models/internalmodelbuilder.mlua",
|
||||
["template.file"] = "template/file.lua",
|
||||
["template.index"] = "template/index.lua",
|
||||
["template.index.recordtypedef"] = "template/index/recordtypedef.lua",
|
||||
["template.item"] = "template/item.lua",
|
||||
["template.page"] = "template/page.lua",
|
||||
["template.recordtypedef"] = "template/recordtypedef.lua",
|
||||
["template.usage"] = "template/usage.lua",
|
||||
["template.utils"] = "template/utils.lua",
|
||||
templateengine = "templateengine.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
luafilesystem = {
|
||||
["1.6.3-2"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
lfs = "lfs.dll"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
markdown = {
|
||||
["0.32-2"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
markdown = "markdown.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
["metalua-compiler"] = {
|
||||
["0.7.3-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {
|
||||
luafilesystem = "1.6.3-2",
|
||||
["metalua-parser"] = "0.7.3-2"
|
||||
},
|
||||
modules = {
|
||||
["metalua.compiler.bytecode"] = "metalua/compiler/bytecode.lua",
|
||||
["metalua.compiler.bytecode.compile"] = "metalua/compiler/bytecode/compile.lua",
|
||||
["metalua.compiler.bytecode.lcode"] = "metalua/compiler/bytecode/lcode.lua",
|
||||
["metalua.compiler.bytecode.ldump"] = "metalua/compiler/bytecode/ldump.lua",
|
||||
["metalua.compiler.bytecode.lopcodes"] = "metalua/compiler/bytecode/lopcodes.lua",
|
||||
["metalua.compiler.globals"] = "metalua/compiler/globals.lua",
|
||||
["metalua.loader"] = "metalua/loader.lua",
|
||||
["metalua/compiler/ast_to_src.mlua"] = "metalua/compiler/ast_to_src.mlua",
|
||||
["metalua/extension/comprehension.mlua"] = "metalua/extension/comprehension.mlua",
|
||||
["metalua/extension/match.mlua"] = "metalua/extension/match.mlua",
|
||||
["metalua/repl.mlua"] = "metalua/repl.mlua",
|
||||
["metalua/treequery.mlua"] = "metalua/treequery.mlua",
|
||||
["metalua/treequery/walk.mlua"] = "metalua/treequery/walk.mlua"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
["metalua-parser"] = {
|
||||
["0.7.3-2"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {},
|
||||
modules = {
|
||||
["metalua.compiler"] = "metalua/compiler.lua",
|
||||
["metalua.compiler.parser"] = "metalua/compiler/parser.lua",
|
||||
["metalua.compiler.parser.annot.generator"] = "metalua/compiler/parser/annot/generator.lua",
|
||||
["metalua.compiler.parser.annot.grammar"] = "metalua/compiler/parser/annot/grammar.lua",
|
||||
["metalua.compiler.parser.expr"] = "metalua/compiler/parser/expr.lua",
|
||||
["metalua.compiler.parser.ext"] = "metalua/compiler/parser/ext.lua",
|
||||
["metalua.compiler.parser.lexer"] = "metalua/compiler/parser/lexer.lua",
|
||||
["metalua.compiler.parser.meta"] = "metalua/compiler/parser/meta.lua",
|
||||
["metalua.compiler.parser.misc"] = "metalua/compiler/parser/misc.lua",
|
||||
["metalua.compiler.parser.stat"] = "metalua/compiler/parser/stat.lua",
|
||||
["metalua.compiler.parser.table"] = "metalua/compiler/parser/table.lua",
|
||||
["metalua.grammar.generator"] = "metalua/grammar/generator.lua",
|
||||
["metalua.grammar.lexer"] = "metalua/grammar/lexer.lua",
|
||||
["metalua.pprint"] = "metalua/pprint.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
penlight = {
|
||||
["0.9.8-1"] = {
|
||||
{
|
||||
arch = "installed",
|
||||
commands = {},
|
||||
dependencies = {
|
||||
luafilesystem = "1.6.3-2"
|
||||
},
|
||||
modules = {
|
||||
pl = "pl/init.lua",
|
||||
["pl.Date"] = "pl/Date.lua",
|
||||
["pl.List"] = "pl/List.lua",
|
||||
["pl.Map"] = "pl/Map.lua",
|
||||
["pl.MultiMap"] = "pl/MultiMap.lua",
|
||||
["pl.OrderedMap"] = "pl/OrderedMap.lua",
|
||||
["pl.Set"] = "pl/Set.lua",
|
||||
["pl.app"] = "pl/app.lua",
|
||||
["pl.array2d"] = "pl/array2d.lua",
|
||||
["pl.class"] = "pl/class.lua",
|
||||
["pl.comprehension"] = "pl/comprehension.lua",
|
||||
["pl.config"] = "pl/config.lua",
|
||||
["pl.data"] = "pl/data.lua",
|
||||
["pl.dir"] = "pl/dir.lua",
|
||||
["pl.file"] = "pl/file.lua",
|
||||
["pl.func"] = "pl/func.lua",
|
||||
["pl.input"] = "pl/input.lua",
|
||||
["pl.lapp"] = "pl/lapp.lua",
|
||||
["pl.lexer"] = "pl/lexer.lua",
|
||||
["pl.luabalanced"] = "pl/luabalanced.lua",
|
||||
["pl.operator"] = "pl/operator.lua",
|
||||
["pl.path"] = "pl/path.lua",
|
||||
["pl.permute"] = "pl/permute.lua",
|
||||
["pl.platf.luajava"] = "pl/platf/luajava.lua",
|
||||
["pl.pretty"] = "pl/pretty.lua",
|
||||
["pl.seq"] = "pl/seq.lua",
|
||||
["pl.sip"] = "pl/sip.lua",
|
||||
["pl.strict"] = "pl/strict.lua",
|
||||
["pl.stringio"] = "pl/stringio.lua",
|
||||
["pl.stringx"] = "pl/stringx.lua",
|
||||
["pl.tablex"] = "pl/tablex.lua",
|
||||
["pl.template"] = "pl/template.lua",
|
||||
["pl.test"] = "pl/test.lua",
|
||||
["pl.text"] = "pl/text.lua",
|
||||
["pl.utils"] = "pl/utils.lua",
|
||||
["pl.xml"] = "pl/xml.lua"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package = "Markdown"
|
||||
version = "0.32-2"
|
||||
source = {
|
||||
url = "http://www.frykholm.se/files/markdown-0.32.tar.gz",
|
||||
dir = "."
|
||||
}
|
||||
description = {
|
||||
summary = "Markdown text-to-html markup system.",
|
||||
detailed = [[
|
||||
A pure-lua implementation of the Markdown text-to-html markup system.
|
||||
]],
|
||||
license = "MIT",
|
||||
homepage = "http://www.frykholm.se/files/markdown.lua"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1",
|
||||
}
|
||||
build = {
|
||||
type = "none",
|
||||
install = {
|
||||
lua = { "markdown.lua" },
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
rock_manifest = {
|
||||
lua = {
|
||||
["markdown.lua"] = "0ea5f9d6d22a6c9aa4fdf63cf1d7d066"
|
||||
},
|
||||
["markdown-0.32-2.rockspec"] = "83f0335058d8fbd078d4f2c1ce941df0"
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
Metalua Compiler
|
||||
================
|
||||
|
||||
## Metalua compiler
|
||||
|
||||
This module `metalua-compiler` depends on `metalua-parser`. Its main
|
||||
feature is to compile ASTs into Lua 5.1 bytecode, allowing to convert
|
||||
them into bytecode files and executable functions. This opens the
|
||||
following possibilities:
|
||||
|
||||
* compiler objects generated with `require 'metalua.compiler'.new()`
|
||||
support methods `:xxx_to_function()` and `:xxx_to_bytecode()`;
|
||||
|
||||
* Compile-time meta-programming: use of `-{...}` splices in source
|
||||
code, to generate code during compilation;
|
||||
|
||||
* Some syntax extensions, such as structural pattern matching and
|
||||
lists by comprehension;
|
||||
|
||||
* Some AST manipulation facilities such as `treequery`, which are
|
||||
implemented with Metalua syntax extensions.
|
||||
|
||||
## What's new in Metalua 0.7
|
||||
|
||||
This is a major overhaul of the compiler's architecture. Some of the
|
||||
most noteworthy changes are:
|
||||
|
||||
* No more installation or bootstrap script. Some Metalua source files
|
||||
have been rewritten in plain Lua, and module sources have been
|
||||
refactored, so that if you just drop the `metalua` folder somewhere
|
||||
in your `LUA_PATH`, it works.
|
||||
|
||||
* The compiler can be cut in two parts:
|
||||
|
||||
* a parser which generates ASTs out of Lua sources, and should be
|
||||
either portable or easily ported to Lua 5.2;
|
||||
|
||||
* a compiler, which can turn sources and AST into executable
|
||||
Lua 5.1 bytecode and run it. It also supports compile-time
|
||||
meta-programming, i.e. code included between `-{ ... }` is
|
||||
executed during compilation, and the ASTs it produces are
|
||||
included in the resulting bytecode.
|
||||
|
||||
* Both parts are packaged as separate LuaRocks, `metalua-parser` and
|
||||
`metalua-compiler` respectively, so that you can install the former
|
||||
without the latter.
|
||||
|
||||
* The parser is not a unique object anymore. Instead,
|
||||
`require "metalua.compiler".new()` returns a different compiler
|
||||
instance every time it's called. Compiler instances can be reused on
|
||||
as many source files as wanted, but extending one instance's grammar
|
||||
doesn't affect other compiler instances.
|
||||
|
||||
* Included standard library has been shed. There are too many standard
|
||||
libs in Lua, and none of them is standard enough, offering
|
||||
yet-another-one, coupled with a specific compiler can only add to
|
||||
confusion.
|
||||
|
||||
* Many syntax extensions, which either were arguably more code samples
|
||||
than actual production-ready tools, or relied too heavily on the
|
||||
removed runtime standard libraries, have been removed.
|
||||
|
||||
* The remaining libraries and samples are:
|
||||
|
||||
* `metalua.compiler` converts sources into ASTs, bytecode,
|
||||
functions, and ASTs back into sources.
|
||||
|
||||
* `metalua` compiles and/or executes files from the command line,
|
||||
can start an interactive REPL session.
|
||||
|
||||
* `metalua.loader` adds a package loader which allows to use modules
|
||||
written in Metalua, even from a plain Lua program.
|
||||
|
||||
* `metalua.treequery` is an advanced DSL allowing to search ASTs in
|
||||
a smart way, e.g. "_search `return` statements which return a
|
||||
`local` variable but aren't in a nested `function`_".
|
||||
|
||||
* `metalua.extension.comprehension` is a language extension which
|
||||
supports lists by comprehension
|
||||
(`even = { i for i=1, 100 if i%2==0 }`) and improved loops
|
||||
(`for i=1, 10 for j=1,10 if i~=j do print(i,j) end`).
|
||||
|
||||
* `metalua.extension.match` is a language extension which offers
|
||||
Haskell/ML structural pattern matching
|
||||
(``match AST with `Function{ args, body } -> ... | `Number{ 0 } -> ...end``)
|
||||
|
||||
* **TODO Move basic extensions in a separate module.**
|
||||
|
||||
* To remove the compilation speed penalty associated with
|
||||
metaprogramming, when environment variable `LUA_MCACHE` or Lua
|
||||
variable `package.mcache` is defined and LuaFileSystem is available,
|
||||
the results of Metalua source compilations is cached. Unless the
|
||||
source file is more recent than the latest cached bytecode file, the
|
||||
latter is loaded instead of the former.
|
||||
|
||||
* The Luarock install for the full compiler lists dependencies towards
|
||||
Readline, LuaFileSytem, and Alt-Getopts. Those projects are
|
||||
optional, but having them automatically installed by LuaRocks offers
|
||||
a better user experience.
|
||||
|
||||
* The license has changed from MIT to double license MIT + EPL. This
|
||||
has been done in order to provide the IP guarantees expected by the
|
||||
Eclipse Foundation, to include Metalua in Eclipse's
|
||||
[Lua Development Tools](http://www.eclipse.org/koneki/ldt/).
|
||||
@@ -0,0 +1,177 @@
|
||||
Metalua Parser
|
||||
==============
|
||||
|
||||
`metalua-parser` is a subset of the Metalua compiler, which turns
|
||||
valid Lua source files and strings into abstract syntax trees
|
||||
(AST). This README includes a description of this AST format. People
|
||||
interested by Lua code analysis and generation are encouraged to
|
||||
produce and/or consume this format to represent ASTs.
|
||||
|
||||
It has been designed for Lua 5.1. It hasn't been tested against
|
||||
Lua 5.2, but should be easily ported.
|
||||
|
||||
## Usage
|
||||
|
||||
Module `metalua.compiler` has a `new()` function, which returns a
|
||||
compiler instance. This instance has a set of methods of the form
|
||||
`:xxx_to_yyy(input)`, where `xxx` and `yyy` must be one of the
|
||||
following:
|
||||
|
||||
* `srcfile` the name of a Lua source file;
|
||||
* `src` a string containing the Lua sources of a list of statements;
|
||||
* `lexstream` a lexical tokens stream;
|
||||
* `ast` an abstract syntax tree;
|
||||
* `bytecode` a chunk of Lua bytecode that can be loaded in a Lua 5.1
|
||||
VM (not available if you only installed the parser);
|
||||
* `function` an executable Lua function.
|
||||
|
||||
Compiling into bytecode or executable functions requires the whole
|
||||
Metalua compiler, not only the parser. The most frequently used
|
||||
functions are `:src_to_ast(source_string)` and
|
||||
`:srcfile_to_ast("path/to/source/file.lua")`.
|
||||
|
||||
mlc = require 'metalua.compiler'.new()
|
||||
ast = mlc :src_to_ast[[ return 123 ]]
|
||||
|
||||
A compiler instance can be reused as much as you want; it's only
|
||||
interesting to work with more than one compiler instance when you
|
||||
start extending their grammars.
|
||||
|
||||
## Abstract Syntax Trees definition
|
||||
|
||||
### Notation
|
||||
|
||||
Trees are written below with some Metalua syntax sugar, which
|
||||
increases their readability. the backquote symbol introduces a `tag`,
|
||||
i.e. a string stored in the `"tag"` field of a table:
|
||||
|
||||
* `` `Foo{ 1, 2, 3 }`` is a shortcut for `{tag="Foo", 1, 2, 3}`;
|
||||
* `` `Foo`` is a shortcut for `{tag="Foo"}`;
|
||||
* `` `Foo 123`` is a shortcut for `` `Foo{ 123 }``, and therefore
|
||||
`{tag="Foo", 123 }`; the expression after the tag must be a literal
|
||||
number or string.
|
||||
|
||||
When using a Metalua interpreter or compiler, the backtick syntax is
|
||||
supported and can be used directly. Metalua's pretty-printing helpers
|
||||
also try to use backtick syntax whenever applicable.
|
||||
|
||||
### Tree elements
|
||||
|
||||
Tree elements are mainly categorized into statements `stat`,
|
||||
expressions `expr` and lists of statements `block`. Auxiliary
|
||||
definitions include function applications/method invocation `apply`,
|
||||
are both valid statements and expressions, expressions admissible on
|
||||
the left-hand-side of an assignment statement `lhs`.
|
||||
|
||||
block: { stat* }
|
||||
|
||||
stat:
|
||||
`Do{ stat* }
|
||||
| `Set{ {lhs+} {expr+} } -- lhs1, lhs2... = e1, e2...
|
||||
| `While{ expr block } -- while e do b end
|
||||
| `Repeat{ block expr } -- repeat b until e
|
||||
| `If{ (expr block)+ block? } -- if e1 then b1 [elseif e2 then b2] ... [else bn] end
|
||||
| `Fornum{ ident expr expr expr? block } -- for ident = e, e[, e] do b end
|
||||
| `Forin{ {ident+} {expr+} block } -- for i1, i2... in e1, e2... do b end
|
||||
| `Local{ {ident+} {expr+}? } -- local i1, i2... = e1, e2...
|
||||
| `Localrec{ ident expr } -- only used for 'local function'
|
||||
| `Goto{ <string> } -- goto str
|
||||
| `Label{ <string> } -- ::str::
|
||||
| `Return{ <expr*> } -- return e1, e2...
|
||||
| `Break -- break
|
||||
| apply
|
||||
|
||||
expr:
|
||||
`Nil | `Dots | `True | `False
|
||||
| `Number{ <number> }
|
||||
| `String{ <string> }
|
||||
| `Function{ { ident* `Dots? } block }
|
||||
| `Table{ ( `Pair{ expr expr } | expr )* }
|
||||
| `Op{ opid expr expr? }
|
||||
| `Paren{ expr } -- significant to cut multiple values returns
|
||||
| apply
|
||||
| lhs
|
||||
|
||||
apply:
|
||||
`Call{ expr expr* }
|
||||
| `Invoke{ expr `String{ <string> } expr* }
|
||||
|
||||
ident: `Id{ <string> }
|
||||
|
||||
lhs: ident | `Index{ expr expr }
|
||||
|
||||
opid: 'add' | 'sub' | 'mul' | 'div'
|
||||
| 'mod' | 'pow' | 'concat'| 'eq'
|
||||
| 'lt' | 'le' | 'and' | 'or'
|
||||
| 'not' | 'len'
|
||||
|
||||
### Meta-data (lineinfo)
|
||||
|
||||
|
||||
ASTs also embed some metadata, allowing to map them to their source
|
||||
representation. Those informations are stored in a `"lineinfo"` field
|
||||
in each tree node, which points to the range of characters in the
|
||||
source string which represents it, and to the content of any comment
|
||||
that would appear immediately before or after that node.
|
||||
|
||||
Lineinfo objects have two fields, `"first"` and `"last"`, describing
|
||||
respectively the beginning and the end of the subtree in the
|
||||
sources. For instance, the sub-node ``Number{123}` produced by parsing
|
||||
`[[return 123]]` will have `lineinfo.first` describing offset 8, and
|
||||
`lineinfo.last` describing offset 10:
|
||||
|
||||
|
||||
> mlc = require 'metalua.compiler'.new()
|
||||
> ast = mlc :src_to_ast "return 123 -- comment"
|
||||
> print(ast[1][1].lineinfo)
|
||||
<?|L1|C8-10|K8-10|C>
|
||||
>
|
||||
|
||||
A lineinfo keeps track of character offsets relative to the beginning
|
||||
of the source string/file ("K8-10" above), line numbers (L1 above; a
|
||||
lineinfo spanning on several lines would read something like "L1-10"),
|
||||
columns i.e. offset within the line ("C8-10" above), and a filename if
|
||||
available (the "?" mark above indicating that we have no file name, as
|
||||
the AST comes from a string). The final "|C>" indicates that there's a
|
||||
comment immediately after the node; an initial "<C|" would have meant
|
||||
that there was a comment immediately before the node.
|
||||
|
||||
Positions represent either the end of a token and the beginning of an
|
||||
inter-token space (`"last"` fields) or the beginning of a token, and
|
||||
the end of an inter-token space (`"first"` fields). Inter-token spaces
|
||||
might be empty. They can also contain comments, which might be useful
|
||||
to link with surrounding tokens and AST subtrees.
|
||||
|
||||
Positions are chained with their "dual" one: a position at the
|
||||
beginning of and inter-token space keeps a refernce to the position at
|
||||
the end of that inter-token space in its `"facing"` field, and
|
||||
conversly, end-of-inter-token positions keep track of the inter-token
|
||||
space beginning, also in `"facing"`. An inter-token space can be
|
||||
empty, e.g. in `"2+2"`, in which case `lineinfo==lineinfo.facing`.
|
||||
|
||||
Comments are also kept in the `"comments"` field. If present, this
|
||||
field contains a list of comments, with a `"lineinfo"` field
|
||||
describing the span between the first and last comment. Each comment
|
||||
is represented by a list of one string, with a `"lineinfo"` describing
|
||||
the span of this comment only. Consecutive lines of `--` comments are
|
||||
considered as one comment: `"-- foo\n-- bar\n"` parses as one comment
|
||||
whose text is `"foo\nbar"`, whereas `"-- foo\n\n-- bar\n"` parses as
|
||||
two comments `"foo"` and `"bar"`.
|
||||
|
||||
So for instance, if `f` is the AST of a function and I want to
|
||||
retrieve the comment before the function, I'd do:
|
||||
|
||||
f_comment = f.lineinfo.first.comments[1][1]
|
||||
|
||||
The informations in lineinfo positions, i.e. in each `"first"` and
|
||||
`"last"` field, are held in the following fields:
|
||||
|
||||
* `"source"` the filename (optional);
|
||||
* `"offset"` the 1-based offset relative to the beginning of the string/file;
|
||||
* `"line"` the 1-based line number;
|
||||
* `"column"` the 1-based offset within the line;
|
||||
* `"facing"` the position at the opposite end of the inter-token space.
|
||||
* `"comments"` the comments in the associated inter-token space (optional).
|
||||
* `"id"` an arbitrary number, which uniquely identifies an inter-token
|
||||
space within a given tokens stream.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Metalua
|
||||
=======
|
||||
|
||||
Metalua is a Lua code analysis tool, as well as a compiler for a
|
||||
superset of Lua 5.1 supporting Compile-Time Meta-Programming. It's
|
||||
separated into two LuaRocks, `metalua-parser` and
|
||||
`metalua-compiler`. The documentation of each rock can be found in
|
||||
`README-parser.md` and `README-compiler.md`.
|
||||
|
||||
All the code in Metalue is released under dual lincenses:
|
||||
|
||||
* MIT public license (same as Lua);
|
||||
* EPL public license (same as Eclipse).
|
||||
@@ -0,0 +1,47 @@
|
||||
--*-lua-*--
|
||||
package = "metalua-compiler"
|
||||
version = "0.7.3-1"
|
||||
source = {
|
||||
url = "http://git.eclipse.org/c/koneki/org.eclipse.koneki.metalua.git/snapshot/org.eclipse.koneki.metalua-v0.7.3.tar.gz"
|
||||
}
|
||||
|
||||
description = {
|
||||
summary = "Metalua's compiler: converting (Meta)lua source strings and files into executable Lua 5.1 bytecode",
|
||||
detailed = [[
|
||||
This is the Metalua copmiler, packaged as a rock, depending
|
||||
on the spearate metalua-parser AST generating library. It
|
||||
compiles a superset of Lua 5.1 into bytecode, which can
|
||||
then be loaded and executed by a Lua 5.1 VM. It also allows
|
||||
to dump ASTs back into Lua source files.
|
||||
]],
|
||||
homepage = "http://git.eclipse.org/c/koneki/org.eclipse.koneki.metalua.git",
|
||||
license = "EPL + MIT"
|
||||
}
|
||||
dependencies = {
|
||||
"lua ~> 5.1", -- Lua 5.2 bytecode not supported
|
||||
"luafilesystem ~> 1.6", -- Cached compilation based on file timestamps
|
||||
"metalua-parser >= 0.7.3", -- AST production
|
||||
}
|
||||
|
||||
build = {
|
||||
type="builtin",
|
||||
modules={
|
||||
["metalua.compiler.bytecode"] = "metalua/compiler/bytecode.lua",
|
||||
["metalua.compiler.globals"] = "metalua/compiler/globals.lua",
|
||||
["metalua.compiler.bytecode.compile"] = "metalua/compiler/bytecode/compile.lua",
|
||||
["metalua.compiler.bytecode.lcode"] = "metalua/compiler/bytecode/lcode.lua",
|
||||
["metalua.compiler.bytecode.lopcodes"] = "metalua/compiler/bytecode/lopcodes.lua",
|
||||
["metalua.compiler.bytecode.ldump"] = "metalua/compiler/bytecode/ldump.lua",
|
||||
["metalua.loader"] = "metalua/loader.lua",
|
||||
},
|
||||
install={
|
||||
lua={
|
||||
["metalua.treequery"] = "metalua/treequery.mlua",
|
||||
["metalua.compiler.ast_to_src"] = "metalua/compiler/ast_to_src.mlua",
|
||||
["metalua.treequery.walk"] = "metalua/treequery/walk.mlua",
|
||||
["metalua.extension.match"] = "metalua/extension/match.mlua",
|
||||
["metalua.extension.comprehension"] = "metalua/extension/comprehension.mlua",
|
||||
["metalua.repl"] = "metalua/repl.mlua",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["README-compiler.md"] = "292523d759247d210d32fb2f6153e0f4",
|
||||
["README-parser.md"] = "b44e3673d96dd296f2c0e92a6c87ee18",
|
||||
["README.md"] = "20bfb490cddef9e101e44688791abcda"
|
||||
},
|
||||
lua = {
|
||||
metalua = {
|
||||
compiler = {
|
||||
["ast_to_src.mlua"] = "1309f76df37585ef8e1f67f748b07b22",
|
||||
bytecode = {
|
||||
["compile.lua"] = "430e4a6fac8b64b5ebb3ae585ebae75a",
|
||||
["lcode.lua"] = "3ad8755ebe8ea8eca6b1d2846eec92c4",
|
||||
["ldump.lua"] = "295e1d9657fb0126ce3471b3366da694",
|
||||
["lopcodes.lua"] = "a0f15cfc93b026b0a868466d066f1d21"
|
||||
},
|
||||
["bytecode.lua"] = "1032e5233455fd4e504daf5d2893527b",
|
||||
["globals.lua"] = "80ae19c6e640de0746348c91633c4c55"
|
||||
},
|
||||
extension = {
|
||||
["comprehension.mlua"] = "426f5856896bda4c3763bd5f61410685",
|
||||
["match.mlua"] = "79960265331e8b2f46199c2411a103de"
|
||||
},
|
||||
["loader.lua"] = "1cdbf6cdf6ca97c55540d068474f1d8a",
|
||||
["repl.mlua"] = "729456f3a8cc073788acee564a0495f0",
|
||||
treequery = {
|
||||
["walk.mlua"] = "5159aaddbec55936f91ea4236f6451d3"
|
||||
},
|
||||
["treequery.mlua"] = "97ffcee0825ac3bc776d01566767b2e8"
|
||||
}
|
||||
},
|
||||
["metalua-compiler-0.7.3-1.rockspec"] = "b3883b25641d862db6828300bb755d51"
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
Metalua Compiler
|
||||
================
|
||||
|
||||
## Metalua compiler
|
||||
|
||||
This module `metalua-compiler` depends on `metalua-parser`. Its main
|
||||
feature is to compile ASTs into Lua 5.1 bytecode, allowing to convert
|
||||
them into bytecode files and executable functions. This opens the
|
||||
following possibilities:
|
||||
|
||||
* compiler objects generated with `require 'metalua.compiler'.new()`
|
||||
support methods `:xxx_to_function()` and `:xxx_to_bytecode()`;
|
||||
|
||||
* Compile-time meta-programming: use of `-{...}` splices in source
|
||||
code, to generate code during compilation;
|
||||
|
||||
* Some syntax extensions, such as structural pattern matching and
|
||||
lists by comprehension;
|
||||
|
||||
* Some AST manipulation facilities such as `treequery`, which are
|
||||
implemented with Metalua syntax extensions.
|
||||
|
||||
## What's new in Metalua 0.7
|
||||
|
||||
This is a major overhaul of the compiler's architecture. Some of the
|
||||
most noteworthy changes are:
|
||||
|
||||
* No more installation or bootstrap script. Some Metalua source files
|
||||
have been rewritten in plain Lua, and module sources have been
|
||||
refactored, so that if you just drop the `metalua` folder somewhere
|
||||
in your `LUA_PATH`, it works.
|
||||
|
||||
* The compiler can be cut in two parts:
|
||||
|
||||
* a parser which generates ASTs out of Lua sources, and should be
|
||||
either portable or easily ported to Lua 5.2;
|
||||
|
||||
* a compiler, which can turn sources and AST into executable
|
||||
Lua 5.1 bytecode and run it. It also supports compile-time
|
||||
meta-programming, i.e. code included between `-{ ... }` is
|
||||
executed during compilation, and the ASTs it produces are
|
||||
included in the resulting bytecode.
|
||||
|
||||
* Both parts are packaged as separate LuaRocks, `metalua-parser` and
|
||||
`metalua-compiler` respectively, so that you can install the former
|
||||
without the latter.
|
||||
|
||||
* The parser is not a unique object anymore. Instead,
|
||||
`require "metalua.compiler".new()` returns a different compiler
|
||||
instance every time it's called. Compiler instances can be reused on
|
||||
as many source files as wanted, but extending one instance's grammar
|
||||
doesn't affect other compiler instances.
|
||||
|
||||
* Included standard library has been shed. There are too many standard
|
||||
libs in Lua, and none of them is standard enough, offering
|
||||
yet-another-one, coupled with a specific compiler can only add to
|
||||
confusion.
|
||||
|
||||
* Many syntax extensions, which either were arguably more code samples
|
||||
than actual production-ready tools, or relied too heavily on the
|
||||
removed runtime standard libraries, have been removed.
|
||||
|
||||
* The remaining libraries and samples are:
|
||||
|
||||
* `metalua.compiler` converts sources into ASTs, bytecode,
|
||||
functions, and ASTs back into sources.
|
||||
|
||||
* `metalua` compiles and/or executes files from the command line,
|
||||
can start an interactive REPL session.
|
||||
|
||||
* `metalua.loader` adds a package loader which allows to use modules
|
||||
written in Metalua, even from a plain Lua program.
|
||||
|
||||
* `metalua.treequery` is an advanced DSL allowing to search ASTs in
|
||||
a smart way, e.g. "_search `return` statements which return a
|
||||
`local` variable but aren't in a nested `function`_".
|
||||
|
||||
* `metalua.extension.comprehension` is a language extension which
|
||||
supports lists by comprehension
|
||||
(`even = { i for i=1, 100 if i%2==0 }`) and improved loops
|
||||
(`for i=1, 10 for j=1,10 if i~=j do print(i,j) end`).
|
||||
|
||||
* `metalua.extension.match` is a language extension which offers
|
||||
Haskell/ML structural pattern matching
|
||||
(``match AST with `Function{ args, body } -> ... | `Number{ 0 } -> ...end``)
|
||||
|
||||
* **TODO Move basic extensions in a separate module.**
|
||||
|
||||
* To remove the compilation speed penalty associated with
|
||||
metaprogramming, when environment variable `LUA_MCACHE` or Lua
|
||||
variable `package.mcache` is defined and LuaFileSystem is available,
|
||||
the results of Metalua source compilations is cached. Unless the
|
||||
source file is more recent than the latest cached bytecode file, the
|
||||
latter is loaded instead of the former.
|
||||
|
||||
* The Luarock install for the full compiler lists dependencies towards
|
||||
Readline, LuaFileSytem, and Alt-Getopts. Those projects are
|
||||
optional, but having them automatically installed by LuaRocks offers
|
||||
a better user experience.
|
||||
|
||||
* The license has changed from MIT to double license MIT + EPL. This
|
||||
has been done in order to provide the IP guarantees expected by the
|
||||
Eclipse Foundation, to include Metalua in Eclipse's
|
||||
[Lua Development Tools](http://www.eclipse.org/koneki/ldt/).
|
||||
@@ -0,0 +1,177 @@
|
||||
Metalua Parser
|
||||
==============
|
||||
|
||||
`metalua-parser` is a subset of the Metalua compiler, which turns
|
||||
valid Lua source files and strings into abstract syntax trees
|
||||
(AST). This README includes a description of this AST format. People
|
||||
interested by Lua code analysis and generation are encouraged to
|
||||
produce and/or consume this format to represent ASTs.
|
||||
|
||||
It has been designed for Lua 5.1. It hasn't been tested against
|
||||
Lua 5.2, but should be easily ported.
|
||||
|
||||
## Usage
|
||||
|
||||
Module `metalua.compiler` has a `new()` function, which returns a
|
||||
compiler instance. This instance has a set of methods of the form
|
||||
`:xxx_to_yyy(input)`, where `xxx` and `yyy` must be one of the
|
||||
following:
|
||||
|
||||
* `srcfile` the name of a Lua source file;
|
||||
* `src` a string containing the Lua sources of a list of statements;
|
||||
* `lexstream` a lexical tokens stream;
|
||||
* `ast` an abstract syntax tree;
|
||||
* `bytecode` a chunk of Lua bytecode that can be loaded in a Lua 5.1
|
||||
VM (not available if you only installed the parser);
|
||||
* `function` an executable Lua function.
|
||||
|
||||
Compiling into bytecode or executable functions requires the whole
|
||||
Metalua compiler, not only the parser. The most frequently used
|
||||
functions are `:src_to_ast(source_string)` and
|
||||
`:srcfile_to_ast("path/to/source/file.lua")`.
|
||||
|
||||
mlc = require 'metalua.compiler'.new()
|
||||
ast = mlc :src_to_ast[[ return 123 ]]
|
||||
|
||||
A compiler instance can be reused as much as you want; it's only
|
||||
interesting to work with more than one compiler instance when you
|
||||
start extending their grammars.
|
||||
|
||||
## Abstract Syntax Trees definition
|
||||
|
||||
### Notation
|
||||
|
||||
Trees are written below with some Metalua syntax sugar, which
|
||||
increases their readability. the backquote symbol introduces a `tag`,
|
||||
i.e. a string stored in the `"tag"` field of a table:
|
||||
|
||||
* `` `Foo{ 1, 2, 3 }`` is a shortcut for `{tag="Foo", 1, 2, 3}`;
|
||||
* `` `Foo`` is a shortcut for `{tag="Foo"}`;
|
||||
* `` `Foo 123`` is a shortcut for `` `Foo{ 123 }``, and therefore
|
||||
`{tag="Foo", 123 }`; the expression after the tag must be a literal
|
||||
number or string.
|
||||
|
||||
When using a Metalua interpreter or compiler, the backtick syntax is
|
||||
supported and can be used directly. Metalua's pretty-printing helpers
|
||||
also try to use backtick syntax whenever applicable.
|
||||
|
||||
### Tree elements
|
||||
|
||||
Tree elements are mainly categorized into statements `stat`,
|
||||
expressions `expr` and lists of statements `block`. Auxiliary
|
||||
definitions include function applications/method invocation `apply`,
|
||||
are both valid statements and expressions, expressions admissible on
|
||||
the left-hand-side of an assignment statement `lhs`.
|
||||
|
||||
block: { stat* }
|
||||
|
||||
stat:
|
||||
`Do{ stat* }
|
||||
| `Set{ {lhs+} {expr+} } -- lhs1, lhs2... = e1, e2...
|
||||
| `While{ expr block } -- while e do b end
|
||||
| `Repeat{ block expr } -- repeat b until e
|
||||
| `If{ (expr block)+ block? } -- if e1 then b1 [elseif e2 then b2] ... [else bn] end
|
||||
| `Fornum{ ident expr expr expr? block } -- for ident = e, e[, e] do b end
|
||||
| `Forin{ {ident+} {expr+} block } -- for i1, i2... in e1, e2... do b end
|
||||
| `Local{ {ident+} {expr+}? } -- local i1, i2... = e1, e2...
|
||||
| `Localrec{ ident expr } -- only used for 'local function'
|
||||
| `Goto{ <string> } -- goto str
|
||||
| `Label{ <string> } -- ::str::
|
||||
| `Return{ <expr*> } -- return e1, e2...
|
||||
| `Break -- break
|
||||
| apply
|
||||
|
||||
expr:
|
||||
`Nil | `Dots | `True | `False
|
||||
| `Number{ <number> }
|
||||
| `String{ <string> }
|
||||
| `Function{ { ident* `Dots? } block }
|
||||
| `Table{ ( `Pair{ expr expr } | expr )* }
|
||||
| `Op{ opid expr expr? }
|
||||
| `Paren{ expr } -- significant to cut multiple values returns
|
||||
| apply
|
||||
| lhs
|
||||
|
||||
apply:
|
||||
`Call{ expr expr* }
|
||||
| `Invoke{ expr `String{ <string> } expr* }
|
||||
|
||||
ident: `Id{ <string> }
|
||||
|
||||
lhs: ident | `Index{ expr expr }
|
||||
|
||||
opid: 'add' | 'sub' | 'mul' | 'div'
|
||||
| 'mod' | 'pow' | 'concat'| 'eq'
|
||||
| 'lt' | 'le' | 'and' | 'or'
|
||||
| 'not' | 'len'
|
||||
|
||||
### Meta-data (lineinfo)
|
||||
|
||||
|
||||
ASTs also embed some metadata, allowing to map them to their source
|
||||
representation. Those informations are stored in a `"lineinfo"` field
|
||||
in each tree node, which points to the range of characters in the
|
||||
source string which represents it, and to the content of any comment
|
||||
that would appear immediately before or after that node.
|
||||
|
||||
Lineinfo objects have two fields, `"first"` and `"last"`, describing
|
||||
respectively the beginning and the end of the subtree in the
|
||||
sources. For instance, the sub-node ``Number{123}` produced by parsing
|
||||
`[[return 123]]` will have `lineinfo.first` describing offset 8, and
|
||||
`lineinfo.last` describing offset 10:
|
||||
|
||||
|
||||
> mlc = require 'metalua.compiler'.new()
|
||||
> ast = mlc :src_to_ast "return 123 -- comment"
|
||||
> print(ast[1][1].lineinfo)
|
||||
<?|L1|C8-10|K8-10|C>
|
||||
>
|
||||
|
||||
A lineinfo keeps track of character offsets relative to the beginning
|
||||
of the source string/file ("K8-10" above), line numbers (L1 above; a
|
||||
lineinfo spanning on several lines would read something like "L1-10"),
|
||||
columns i.e. offset within the line ("C8-10" above), and a filename if
|
||||
available (the "?" mark above indicating that we have no file name, as
|
||||
the AST comes from a string). The final "|C>" indicates that there's a
|
||||
comment immediately after the node; an initial "<C|" would have meant
|
||||
that there was a comment immediately before the node.
|
||||
|
||||
Positions represent either the end of a token and the beginning of an
|
||||
inter-token space (`"last"` fields) or the beginning of a token, and
|
||||
the end of an inter-token space (`"first"` fields). Inter-token spaces
|
||||
might be empty. They can also contain comments, which might be useful
|
||||
to link with surrounding tokens and AST subtrees.
|
||||
|
||||
Positions are chained with their "dual" one: a position at the
|
||||
beginning of and inter-token space keeps a refernce to the position at
|
||||
the end of that inter-token space in its `"facing"` field, and
|
||||
conversly, end-of-inter-token positions keep track of the inter-token
|
||||
space beginning, also in `"facing"`. An inter-token space can be
|
||||
empty, e.g. in `"2+2"`, in which case `lineinfo==lineinfo.facing`.
|
||||
|
||||
Comments are also kept in the `"comments"` field. If present, this
|
||||
field contains a list of comments, with a `"lineinfo"` field
|
||||
describing the span between the first and last comment. Each comment
|
||||
is represented by a list of one string, with a `"lineinfo"` describing
|
||||
the span of this comment only. Consecutive lines of `--` comments are
|
||||
considered as one comment: `"-- foo\n-- bar\n"` parses as one comment
|
||||
whose text is `"foo\nbar"`, whereas `"-- foo\n\n-- bar\n"` parses as
|
||||
two comments `"foo"` and `"bar"`.
|
||||
|
||||
So for instance, if `f` is the AST of a function and I want to
|
||||
retrieve the comment before the function, I'd do:
|
||||
|
||||
f_comment = f.lineinfo.first.comments[1][1]
|
||||
|
||||
The informations in lineinfo positions, i.e. in each `"first"` and
|
||||
`"last"` field, are held in the following fields:
|
||||
|
||||
* `"source"` the filename (optional);
|
||||
* `"offset"` the 1-based offset relative to the beginning of the string/file;
|
||||
* `"line"` the 1-based line number;
|
||||
* `"column"` the 1-based offset within the line;
|
||||
* `"facing"` the position at the opposite end of the inter-token space.
|
||||
* `"comments"` the comments in the associated inter-token space (optional).
|
||||
* `"id"` an arbitrary number, which uniquely identifies an inter-token
|
||||
space within a given tokens stream.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Metalua
|
||||
=======
|
||||
|
||||
Metalua is a Lua code analysis tool, as well as a compiler for a
|
||||
superset of Lua 5.1 supporting Compile-Time Meta-Programming. It's
|
||||
separated into two LuaRocks, `metalua-parser` and
|
||||
`metalua-compiler`. The documentation of each rock can be found in
|
||||
`README-parser.md` and `README-compiler.md`.
|
||||
|
||||
All the code in Metalue is released under dual lincenses:
|
||||
|
||||
* MIT public license (same as Lua);
|
||||
* EPL public license (same as Eclipse).
|
||||
@@ -0,0 +1,38 @@
|
||||
--*-lua-*--
|
||||
package = "metalua-parser"
|
||||
version = "0.7.3-2"
|
||||
source = {
|
||||
url = "http://git.eclipse.org/c/koneki/org.eclipse.koneki.metalua.git/snapshot/org.eclipse.koneki.metalua-v0.7.3.tar.gz"
|
||||
}
|
||||
description = {
|
||||
summary = "Metalua's parser: converting Lua source strings and files into AST",
|
||||
detailed = [[
|
||||
This is a subset of the full Metalua compiler. It defines and generates an AST
|
||||
format for Lua programs, which offers a nice level of abstraction to reason about
|
||||
and manipulate Lua programs.
|
||||
]],
|
||||
homepage = "http://git.eclipse.org/c/koneki/org.eclipse.koneki.metalua.git",
|
||||
license = "EPL + MIT"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
build = {
|
||||
type="builtin",
|
||||
modules={
|
||||
["metalua.grammar.generator"] = "metalua/grammar/generator.lua",
|
||||
["metalua.grammar.lexer"] = "metalua/grammar/lexer.lua",
|
||||
["metalua.compiler.parser"] = "metalua/compiler/parser.lua",
|
||||
["metalua.compiler.parser.table"] = "metalua/compiler/parser/table.lua",
|
||||
["metalua.compiler.parser.ext"] = "metalua/compiler/parser/ext.lua",
|
||||
["metalua.compiler.parser.annot.generator"] = "metalua/compiler/parser/annot/generator.lua",
|
||||
["metalua.compiler.parser.annot.grammar"] = "metalua/compiler/parser/annot/grammar.lua",
|
||||
["metalua.compiler.parser.stat"] = "metalua/compiler/parser/stat.lua",
|
||||
["metalua.compiler.parser.misc"] = "metalua/compiler/parser/misc.lua",
|
||||
["metalua.compiler.parser.lexer"] = "metalua/compiler/parser/lexer.lua",
|
||||
["metalua.compiler.parser.meta"] = "metalua/compiler/parser/meta.lua",
|
||||
["metalua.compiler.parser.expr"] = "metalua/compiler/parser/expr.lua",
|
||||
["metalua.compiler"] = "metalua/compiler.lua",
|
||||
["metalua.pprint"] = "metalua/pprint.lua",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
rock_manifest = {
|
||||
doc = {
|
||||
["README-compiler.md"] = "292523d759247d210d32fb2f6153e0f4",
|
||||
["README-parser.md"] = "b44e3673d96dd296f2c0e92a6c87ee18",
|
||||
["README.md"] = "20bfb490cddef9e101e44688791abcda"
|
||||
},
|
||||
lua = {
|
||||
metalua = {
|
||||
compiler = {
|
||||
parser = {
|
||||
annot = {
|
||||
["generator.lua"] = "d86f7507d66ba6a3692a6f8611e9939b",
|
||||
["grammar.lua"] = "7d195bde7992efd9923771751b67b18f"
|
||||
},
|
||||
["expr.lua"] = "3a0b1984a6f92280e2e63b074fdcec10",
|
||||
["ext.lua"] = "a99e31a07bc390b826f6653bcc47d89b",
|
||||
["lexer.lua"] = "eac0f9d475d9dae4ea5a2724014cebec",
|
||||
["meta.lua"] = "12870bceda6395695020b739196e2a92",
|
||||
["misc.lua"] = "49d59f4fc1bfb77b36f78d4f87ae258f",
|
||||
["stat.lua"] = "83f10ac899be12ca4df58bbe8645299f",
|
||||
["table.lua"] = "5d2389e89603b7f78c731e6918aa1a9b"
|
||||
},
|
||||
["parser.lua"] = "e6ae68ce200de8071bb0fefad97f9b79"
|
||||
},
|
||||
["compiler.lua"] = "ca65ee9a3053581f4315821a31d0c1fd",
|
||||
grammar = {
|
||||
["generator.lua"] = "b8a29e817d6798c12f40a230a0f6d0af",
|
||||
["lexer.lua"] = "7cb7c835479a9be884130eaacb9be60a"
|
||||
},
|
||||
["pprint.lua"] = "0b9bd8757b45c2d4be30106abcbd45b2"
|
||||
}
|
||||
},
|
||||
["metalua-parser-0.7.3-2.rockspec"] = "a56680900b0b51701db7cd7abf49af92"
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package = "penlight"
|
||||
version = "0.9.8-1"
|
||||
|
||||
source = {
|
||||
dir = "penlight-0.9.8",
|
||||
url = "http://stevedonovan.github.com/files/penlight-0.9.8-core.zip",
|
||||
}
|
||||
|
||||
description = {
|
||||
summary = "Lua utility libraries loosely based on the Python standard libraries",
|
||||
homepage = "http://stevedonovan.github.com/Penlight",
|
||||
license = "MIT/X11",
|
||||
maintainer = "steve.j.donovan@gmail.com",
|
||||
detailed = [[
|
||||
Penlight is a set of pure Lua libraries for making it easier to work with common tasks like
|
||||
iterating over directories, reading configuration files and the like. Provides functional operations
|
||||
on tables and sequences.
|
||||
]]
|
||||
}
|
||||
|
||||
dependencies = {
|
||||
"luafilesystem",
|
||||
}
|
||||
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
["pl.strict"] = "lua/pl/strict.lua",
|
||||
["pl.dir"] = "lua/pl/dir.lua",
|
||||
["pl.operator"] = "lua/pl/operator.lua",
|
||||
["pl.input"] = "lua/pl/input.lua",
|
||||
["pl.config"] = "lua/pl/config.lua",
|
||||
["pl.seq"] = "lua/pl/seq.lua",
|
||||
["pl.stringio"] = "lua/pl/stringio.lua",
|
||||
["pl.text"] = "lua/pl/text.lua",
|
||||
["pl.test"] = "lua/pl/test.lua",
|
||||
["pl.tablex"] = "lua/pl/tablex.lua",
|
||||
["pl.app"] = "lua/pl/app.lua",
|
||||
["pl.stringx"] = "lua/pl/stringx.lua",
|
||||
["pl.lexer"] = "lua/pl/lexer.lua",
|
||||
["pl.utils"] = "lua/pl/utils.lua",
|
||||
["pl.sip"] = "lua/pl/sip.lua",
|
||||
["pl.permute"] = "lua/pl/permute.lua",
|
||||
["pl.pretty"] = "lua/pl/pretty.lua",
|
||||
["pl.class"] = "lua/pl/class.lua",
|
||||
["pl.List"] = "lua/pl/List.lua",
|
||||
["pl.data"] = "lua/pl/data.lua",
|
||||
["pl.Date"] = "lua/pl/Date.lua",
|
||||
["pl"] = "lua/pl/init.lua",
|
||||
["pl.luabalanced"] = "lua/pl/luabalanced.lua",
|
||||
["pl.comprehension"] = "lua/pl/comprehension.lua",
|
||||
["pl.path"] = "lua/pl/path.lua",
|
||||
["pl.array2d"] = "lua/pl/array2d.lua",
|
||||
["pl.func"] = "lua/pl/func.lua",
|
||||
["pl.lapp"] = "lua/pl/lapp.lua",
|
||||
["pl.file"] = "lua/pl/file.lua",
|
||||
['pl.template'] = "lua/pl/template.lua",
|
||||
["pl.Map"] = "lua/pl/Map.lua",
|
||||
["pl.MultiMap"] = "lua/pl/MultiMap.lua",
|
||||
["pl.OrderedMap"] = "lua/pl/OrderedMap.lua",
|
||||
["pl.Set"] = "lua/pl/Set.lua",
|
||||
["pl.xml"] = "lua/pl/xml.lua",
|
||||
["pl.platf.luajava"] = "lua/pl/platf/luajava.lua"
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
rock_manifest = {
|
||||
lua = {
|
||||
pl = {
|
||||
["Date.lua"] = "d2131d59151ce978c4db6a648fcd275a",
|
||||
["List.lua"] = "1236c5eb08956619daacd25a462a9682",
|
||||
["Map.lua"] = "0297a536ac0595ac59e8828f8c867f53",
|
||||
["MultiMap.lua"] = "e5f898fe2443e51c38825e9bc3d1aee5",
|
||||
["OrderedMap.lua"] = "bd8e39c59e22c582a33e2f025d3ae914",
|
||||
["Set.lua"] = "346ff7392fd4aeda418fb832e8da7a7f",
|
||||
["app.lua"] = "23ffb79e69a3fd679013cf82d95ed792",
|
||||
["array2d.lua"] = "77618ec2e2de4d6d237484dfd742cd73",
|
||||
["class.lua"] = "6f58bf39e7f90711b6840ad6955d258e",
|
||||
["comprehension.lua"] = "f8600ba945dde5d959194500a687c69f",
|
||||
["config.lua"] = "9ea3ce0ac3cdf2ce0e17f1353f32abb6",
|
||||
["data.lua"] = "be446ff813b5bcf30b4063601165df6a",
|
||||
["dir.lua"] = "3d60d4c1caeaabe199fe361e4e9b14a4",
|
||||
["file.lua"] = "f5c9527ea14b511d2cb9af80b219c562",
|
||||
["func.lua"] = "cc50d73512b6d0518f6587b82844de8c",
|
||||
["init.lua"] = "9232be7d8790d4f907972a00dec7949d",
|
||||
["input.lua"] = "bab7c64ca9a740df5e9fb9909610bbc4",
|
||||
["lapp.lua"] = "1cc81f048bc3fcd775c40cd9a2d601a7",
|
||||
["lexer.lua"] = "da0db5e323a2d37545ccb02592d0d3c8",
|
||||
["luabalanced.lua"] = "00b94a997a9ea4d73f54c10893f3b35f",
|
||||
["operator.lua"] = "e606629c738966cf497bb938457adebd",
|
||||
["path.lua"] = "b0714bc337c068b7252f64250fe59604",
|
||||
["permute.lua"] = "b0ed9ba2787119ef99468329a54ea16a",
|
||||
platf = {
|
||||
["luajava.lua"] = "9c2898667281ad9501cc05a8e31a6f53"
|
||||
},
|
||||
["pretty.lua"] = "3ece64317ce05916eaba91fa96d9e7c0",
|
||||
["seq.lua"] = "e99e420345ab11120a7b741d8184920a",
|
||||
["sip.lua"] = "bde74f65e7246017d3ef034d178100ea",
|
||||
["strict.lua"] = "720e939931dbbe42fad8fd4e7736435e",
|
||||
["stringio.lua"] = "a8f4c786ea1b62f16ed05e6b09840044",
|
||||
["stringx.lua"] = "43f57755969c6b4001316226506a3744",
|
||||
["tablex.lua"] = "dec027cc3a3901766bd933c5fc0f3e93",
|
||||
["template.lua"] = "f358175bbb84c401c6213c953ce295a4",
|
||||
["test.lua"] = "1c45f7b1c438673f1eb668e2ca592f1c",
|
||||
["text.lua"] = "c30f90cab2d00186a6432e408ba1fe14",
|
||||
["utils.lua"] = "68cd38638a29b4ab5f1cc0eae38dce77",
|
||||
["xml.lua"] = "e13ed468c450fccb9a8e858a0f787eef"
|
||||
}
|
||||
},
|
||||
["penlight-0.9.8-1.rockspec"] = "96edac3ff1d0ac57cb45d6551a56a775"
|
||||
}
|
||||
Reference in New Issue
Block a user