Merge: doc: fixed some typos and other misc. corrections
[nit.git] / src / modelize / modelize.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Create a model from nit source files
16 module modelize
17
18 import modelize_property
19
20 redef class ModelBuilder
21 # Retrieve the associated AST node of a mentity.
22 # This method is used to associate model entity with syntactic entities.
23 #
24 # If the mentity is not associated with a node, returns null.
25 # This is always the case for MPackage, Mgroup, MClass and MProperty.
26 # MModule, MClassDef and MPropDef can also have no node associated
27 # (like fictive modules of generated attributes/methods).
28 fun mentity2node(mentity: MEntity): nullable ANode
29 do
30 if mentity isa MModule then
31 return mmodule2node(mentity)
32 else if mentity isa MClassDef then
33 return mclassdef2node(mentity)
34 else if mentity isa MPropDef then
35 return mpropdef2node(mentity)
36 end
37 return null
38 end
39 end