Skip to content

Commit

Permalink
Fix #2.
Browse files Browse the repository at this point in the history
  • Loading branch information
alban-linard committed Jan 28, 2016
1 parent c033972 commit ae7c4ee
Show file tree
Hide file tree
Showing 20 changed files with 154 additions and 154 deletions.
16 changes: 8 additions & 8 deletions src/formalisms/alphabet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ local _ = Layer.reference "alphabet"
--
-- An alphabet is a set of symbols.

layer.__labels__ = { alphabet = true }
layer[Layer.key.labels] = { alphabet = true }

layer.__meta__ = {
layer[Layer.key.meta] = {
symbol_type = {},
}

layer.symbols = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
__value_type__ = _.__meta__.symbol_type,
[Layer.key.meta] = {
__value_type__ = _ [Layer.key.meta].symbol_type,
},
__default__ = {
__refines__ = {
_.__meta__.symbol_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].symbol_type,
},
}
}
Expand Down
46 changes: 23 additions & 23 deletions src/formalisms/automaton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,56 +28,56 @@ local _ = Layer.reference "automaton"
--
-- For more information of automaton see [here](http://www.cs.odu.edu/~toida/nerzic/390teched/regular/fa/nfa-definitions.html)

layer.__refines__ = {
layer[Layer.key.refines] = {
labelled_edges_hyper_multi_graph,
labelled_vertices_hyper_multi_graph,
directed_hyper_multi_graph,
multi_graph,
alphabet,
}

layer.__labels__ = { automaton = true }
layer[Layer.key.labels] = { automaton = true }

layer.__meta__ = {
layer[Layer.key.meta] = {
edge_type = {
__tags__ = {
letter = {
__value_type__ = _.__meta__.symbol_type,
__value_type__ = _ [Layer.key.meta].symbol_type,
__value_container__ = _.symbols,
},
},
},

vertex_type = {
__meta__ = {
[Layer.key.meta] = {
__tags__ = {
id = {},
},
},
},

initial_state_type = {
__refines__ = {
[Layer.key.refines] = {
record,
},
__meta__ = {
[Layer.key.meta] = {
tags = {
vertex = {
__value_type__ = _.__meta__.vertex_type,
__value_type__ = _ [Layer.key.meta].vertex_type,
__value_container__ = _.vertices,
},
},
},
},

accept_state_type = {
__refines__ = {
[Layer.key.refines] = {
record,
},
__meta__ = {
[Layer.key.meta] = {
tags = {
vertex = {
__value_type__ = _.__meta__.vertex_type,
__value_type__ = _ [Layer.key.meta].vertex_type,
__value_container__ = _.vertices,
},
},
Expand All @@ -86,29 +86,29 @@ layer.__meta__ = {
}

layer.initials_states = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
__value_type__ = _.__meta__.initial_state_type,
[Layer.key.meta] = {
__value_type__ = _ [Layer.key.meta].initial_state_type,
},
__default__ = {
__refines__ = {
_.__meta__.initial_state_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].initial_state_type,
},
},
}

layer.accept_states = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
__value_type__ = _.__meta__.accept_state_type,
[Layer.key.meta] = {
__value_type__ = _ [Layer.key.meta].accept_state_type,
},
__default__ = {
__refines__ = {
_.__meta__.accept_state_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].accept_state_type,
},
},
}
Expand Down
10 changes: 5 additions & 5 deletions src/formalisms/collection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ local layer = Layer.new {
-- * `value_type` : type of values
-- * `value_container` : all values must reference an element of this container

layer.__meta__ = {
layer[Layer.key.meta] = {
key_type = nil,
key_container = nil,
value_type = nil,
value_container = nil,
}

layer.__checks__ = {
layer[Layer.key.checks] = {
check_collection = function (proxy)

local meta = proxy.__meta__
local meta = proxy[Layer.key.meta]
do
local exist = false
for _ in Layer.pairs(meta) do
Expand Down Expand Up @@ -62,7 +62,7 @@ layer.__checks__ = {
message = message .. tostring(key) .. " value : incompatible types. Waiting " .. tostring(meta["value_type"]) .. ", found " .. type(value) .. ". "
else
local exist = false
for _, ref in Layer.ipairs(value.__refines__) do
for _, ref in Layer.ipairs(value[Layer.key.refines]) do
print(ref)
if ref == meta["value_type"] then
exist = true
Expand Down Expand Up @@ -101,7 +101,7 @@ layer.__checks__ = {
message = message .. "key " .. tostring(key) .. " : incompatible types. Waiting " .. tostring(meta["key_type"]) .. ", found " .. type(key) .. ". "
else
local exist = false
for _, ref in Layer.ipairs(key.__refines__) do
for _, ref in Layer.ipairs(key[Layer.key.refines]) do
if ref == meta["key_type"] then
exist = true
break
Expand Down
8 changes: 4 additions & 4 deletions src/formalisms/directed_hyper_multi_graph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ local layer = Layer.new {
--
-- A definition of Directed Hyper Graph is given [here](http://link.springer.com/chapter/10.1007/3-540-45446-2_20)

layer.__refines__ = {
layer[Layer.key.refines] = {
hyper_multi_graph
}

layer.__meta__ = {
layer[Layer.key.meta] = {
edge_type = {
__meta__ = {
[Layer.key.meta] = {
arrow_type = {
__meta__ = {
[Layer.key.meta] = {
__tags__ = {
input = {
__value_type__ = "boolean",
Expand Down
6 changes: 3 additions & 3 deletions src/formalisms/hyper_graph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ local layer = Layer.new {
--
-- For more information see [here](https://en.wikipedia.org/wiki/Hypergraph)

layer.__refines__ = {
layer[Layer.key.refines] = {
hyper_multi_graph
}

layer.__meta__ = {
layer[Layer.key.meta] = {
edges = {
__checks__ = {
[Layer.key.checks] = {
function ()
-- TODO
-- check identical edges
Expand Down
48 changes: 24 additions & 24 deletions src/formalisms/hyper_multi_graph.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,68 @@ local _ = Layer.reference "HMGT"
--
-- For more information of Hyper and Multi Graph, see [here](https://en.wikipedia.org/?title=Hypergraph)

layer.__labels__ = { HMGT = true }
layer[Layer.key.labels] = { HMGT = true }

layer.__meta__ = {
layer[Layer.key.meta] = {
vertex_type = {},

edge_type = {
__meta__ = {
[Layer.key.meta] = {
arrow_type = {
__refines__ = {
[Layer.key.refines] = {
record,
},

__meta__ = {
[Layer.key.meta] = {
tags = {
vertex = {
value_type = _.__meta__.vertex_type,
value_type = _ [Layer.key.meta].vertex_type,
value_container = _.vertices,
},
},
},
},
},
arrows = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
value_type = _.__meta__.edge_type.__meta__.arrow_type,
[Layer.key.meta] = {
value_type = _ [Layer.key.meta].edge_type[Layer.key.meta].arrow_type,
},
__default__ = {
__refines__ = {
_.__meta__.edge_type.__meta__.arrow_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].edge_type[Layer.key.meta].arrow_type,
},
},
},
},
}

layer.vertices = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
value_type = _.__meta__.vertex_type,
[Layer.key.meta] = {
value_type = _ [Layer.key.meta].vertex_type,
},
__default__ = {
__refines__ = {
_.__meta__.vertex_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].vertex_type,
},
},
}

layer.edges = {
__refines__ = {
[Layer.key.refines] = {
collection,
},
__meta__ = {
value_type = _.__meta__.edge_type,
[Layer.key.meta] = {
value_type = _ [Layer.key.meta].edge_type,
},
__default__ = {
__refines__ = {
_.__meta__.edge_type,
[Layer.key.default] = {
[Layer.key.refines] = {
_ [Layer.key.meta].edge_type,
}
},
}
Expand Down
Loading

0 comments on commit ae7c4ee

Please sign in to comment.